Step 5.2 fixes
This commit is contained in:
@ -85,9 +85,8 @@ export class PegasusUtility {
|
||||
static updateHindranceBonusDice(rollData) {
|
||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-hindrance")
|
||||
for (let hindrance of rollData.effectsList) {
|
||||
if (hindrance && hindrance.applied && hindrance.type == "hindrance") {
|
||||
console.log("Manage Hindrance", hindrance)
|
||||
let diceKey = PegasusUtility.getDiceFromLevel(hindrance.value)
|
||||
if (hindrance && hindrance.applied && (hindrance.type == "hindrance" || (hindrance.type == "effect" && hindrance.effect?.data?.hindrance) ) ) {
|
||||
let diceKey = PegasusUtility.getDiceFromLevel( (hindrance.value) ? hindrance.value : hindrance.effect.data.effectlevel)
|
||||
let newDice = {
|
||||
name: "effect-hindrance", key: diceKey, level: hindrance.value, effect: hindrance.name,
|
||||
img: `systems/fvtt-pegasus-rpg/images/dice/${diceKey}.webp`
|
||||
@ -139,6 +138,24 @@ export class PegasusUtility {
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateStatDicePool( rollData) {
|
||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "stat")
|
||||
let statDice = rollData.dicePool.find(dice => dice.name == "stat")
|
||||
if (rollData.statDicesLevel > 0) {
|
||||
let diceKey = PegasusUtility.getDiceFromLevel(rollData.statDicesLevel)
|
||||
let diceList = diceKey.split(" ")
|
||||
for (let myDice of diceList) {
|
||||
let newDice = {
|
||||
name: "stat", key: myDice, level: rollData.statDicesLevel, mod: statDice.mod,
|
||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
||||
}
|
||||
newDicePool.push(newDice)
|
||||
}
|
||||
}
|
||||
rollData.dicePool = newDicePool
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateSpecDicePool(rollData) {
|
||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "spec")
|
||||
@ -557,8 +574,20 @@ export class PegasusUtility {
|
||||
if (msg.name == "msg_reroll_hero") {
|
||||
this.rerollHeroRemaining(msg.data.userId, msg.data.rollId)
|
||||
}
|
||||
if (msg.name == "msg_gm_remove_effect") {
|
||||
this.removeForeignEffect(msg.data)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static removeForeignEffect( effectData) {
|
||||
if (game.user.isGM) {
|
||||
console.log("Remote removal of effects", effectData)
|
||||
let actor = game.actors.get(effectData.actorId)
|
||||
actor.deleteEmbeddedDocuments('Item', [effectData.effect._id])
|
||||
}
|
||||
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static chatDataSetup(content, modeOverride, isRoll = false, forceWhisper) {
|
||||
let chatData = {
|
||||
@ -638,8 +667,16 @@ export class PegasusUtility {
|
||||
let toRem = []
|
||||
for (let effect of rollData.effectsList) {
|
||||
if (effect.effect && effect.effect.data.isUsed && effect.effect.data.oneuse) {
|
||||
toRem.push(effect.effect._id)
|
||||
ChatMessage.create({ content: `One used effect ${effect.effect.name} has been auto-deleted.` })
|
||||
if (effect.foreign) {
|
||||
if (game.user.isGM) {
|
||||
this.removeForeignEffect(effect)
|
||||
} else {
|
||||
game.socket.emit("system.fvtt-pegasus-rgp", { msg: "msg_gm_remove_effect", data: effect })
|
||||
}
|
||||
} else {
|
||||
toRem.push(effect.effect._id)
|
||||
ChatMessage.create({ content: `One used effect ${effect.effect.name} has been auto-deleted.` })
|
||||
}
|
||||
}
|
||||
}
|
||||
if (toRem.length > 0) {
|
||||
@ -874,7 +911,7 @@ export class PegasusUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getBasicRollData() {
|
||||
static getBasicRollData(isInit) {
|
||||
let rollData = {
|
||||
rollId: randomID(16),
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
@ -893,7 +930,9 @@ export class PegasusUtility {
|
||||
equipmentsList: [],
|
||||
optionsDiceList: PegasusUtility.getOptionsDiceList()
|
||||
}
|
||||
PegasusUtility.updateWithTarget(rollData)
|
||||
if ( !isInit) { // For init, do not display target hindrances
|
||||
PegasusUtility.updateWithTarget(rollData)
|
||||
}
|
||||
return rollData
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user