Manage hindrance dices
This commit is contained in:
parent
b81e5ec17e
commit
d5f27ae9ea
BIN
images/dice/hindrance-dice.png
Normal file
BIN
images/dice/hindrance-dice.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 37 KiB |
@ -114,10 +114,10 @@ export class PegasusActor extends Actor {
|
|||||||
prepareDerivedData() {
|
prepareDerivedData() {
|
||||||
|
|
||||||
if (this.system.secondary.stealthhealth) {
|
if (this.system.secondary.stealthhealth) {
|
||||||
this.update({"system.secondary": {"-=stealthhealth": null}} )
|
this.update({ "system.secondary": { "-=stealthhealth": null } })
|
||||||
}
|
}
|
||||||
if (this.system.secondary.socialhealth) {
|
if (this.system.secondary.socialhealth) {
|
||||||
this.update({"system.secondary": {"-=socialhealth": null}} )
|
this.update({ "system.secondary": { "-=socialhealth": null } })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.traumaState) {
|
if (!this.traumaState) {
|
||||||
@ -770,7 +770,7 @@ export class PegasusActor extends Actor {
|
|||||||
let combat = duplicate(myself.system.combat)
|
let combat = duplicate(myself.system.combat)
|
||||||
combat.stunlevel += incDec
|
combat.stunlevel += incDec
|
||||||
if (combat.stunlevel >= 0) {
|
if (combat.stunlevel >= 0) {
|
||||||
myself.update({ 'system.combat': combat } )
|
myself.update({ 'system.combat': combat })
|
||||||
let chatData = {
|
let chatData = {
|
||||||
user: game.user.id,
|
user: game.user.id,
|
||||||
rollMode: game.settings.get("core", "rollMode"),
|
rollMode: game.settings.get("core", "rollMode"),
|
||||||
@ -959,7 +959,7 @@ export class PegasusActor extends Actor {
|
|||||||
async equipGear(equipmentId) {
|
async equipGear(equipmentId) {
|
||||||
let item = this.items.find(item => item.id == equipmentId);
|
let item = this.items.find(item => item.id == equipmentId);
|
||||||
if (item && item.system) {
|
if (item && item.system) {
|
||||||
let update = { _id: item.id, "data.equipped": !item.system.equipped };
|
let update = { _id: item.id, "system.equipped": !item.system.equipped };
|
||||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1154,7 +1154,7 @@ export class PegasusActor extends Actor {
|
|||||||
async updatePerkUsed(itemId, index, checked) {
|
async updatePerkUsed(itemId, index, checked) {
|
||||||
let item = this.items.get(itemId)
|
let item = this.items.get(itemId)
|
||||||
if (item && index) {
|
if (item && index) {
|
||||||
let key = "data.used" + index
|
let key = "system.used" + index
|
||||||
await this.updateEmbeddedDocuments('Item', [{ _id: itemId, [`${key}`]: checked }])
|
await this.updateEmbeddedDocuments('Item', [{ _id: itemId, [`${key}`]: checked }])
|
||||||
item = this.items.get(itemId) // Refresh
|
item = this.items.get(itemId) // Refresh
|
||||||
if (item.system.nbuse == "next1action" && item.system.used1) {
|
if (item.system.nbuse == "next1action" && item.system.used1) {
|
||||||
@ -1346,10 +1346,10 @@ export class PegasusActor extends Actor {
|
|||||||
getTraumaState() {
|
getTraumaState() {
|
||||||
this.traumaState = "none"
|
this.traumaState = "none"
|
||||||
if (this.type == "character") {
|
if (this.type == "character") {
|
||||||
if ( this.system.secondary.delirium.status == "trauma") {
|
if (this.system.secondary.delirium.status == "trauma") {
|
||||||
this.traumaState = "trauma"
|
this.traumaState = "trauma"
|
||||||
}
|
}
|
||||||
if ( this.system.secondary.delirium.status == "severetrauma") {
|
if (this.system.secondary.delirium.status == "severetrauma" || this.system.secondary.delirium.status == "defeated") {
|
||||||
this.traumaState = "severetrauma"
|
this.traumaState = "severetrauma"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1540,7 +1540,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (this.system.secondary.health.status == "wounded") {
|
if (this.system.secondary.health.status == "wounded") {
|
||||||
hindrance += 1
|
hindrance += 1
|
||||||
}
|
}
|
||||||
if (this.system.secondary.health.status == "severelywounded") {
|
if (this.system.secondary.health.status == "severlywounded" || this.system.secondary.health.status == "defeated") {
|
||||||
hindrance += 3
|
hindrance += 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1555,7 +1555,7 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
getArmorResistanceBonus() {
|
getArmorResistanceBonus() {
|
||||||
let bonus = 0
|
let bonus = 0
|
||||||
for (let a of armors) {
|
for (let a of armors) {
|
||||||
bonus += Number(a.system.resistance)
|
bonus += Number(a.system.resistance)
|
||||||
}
|
}
|
||||||
@ -1567,43 +1567,52 @@ export class PegasusActor extends Actor {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
let updates = []
|
let updates = []
|
||||||
|
let role = this.getRole() // Get the role for optionnal bonuses
|
||||||
|
let roleBonus = 0
|
||||||
|
|
||||||
/* Get MDL bonus */
|
/* Get MDL bonus */
|
||||||
let meleeBonus = 0
|
let meleeBonus = 0
|
||||||
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.affectstatus && effect.system.affectstatus == "mdl" && (Number(effect.system.effectlevel) > 0))
|
let effects = this.items.filter(effect => effect.type == "effect" && effect.system.affectstatus && effect.system.affectstatus == "mdl" && (Number(effect.system.effectlevel) > 0))
|
||||||
for(let e of effects) {
|
for (let e of effects) {
|
||||||
meleeBonus += Number(e.system.effectlevel)
|
meleeBonus += Number(e.system.effectlevel)
|
||||||
}
|
}
|
||||||
let weaponsMelee = this.items.filter( it => it.type == "weapon" && it.system.damagestatistic.toLowerCase() == "str")
|
let weaponsMelee = this.items.filter(it => it.type == "weapon" && it.system.damagestatistic.toLowerCase() == "str")
|
||||||
for (let w of weaponsMelee) {
|
for (let w of weaponsMelee) {
|
||||||
let damage = Number(w.system.damage) + this.system.biodata.sizenum + this.system.biodata.sizebonus + this.system.statistics.str.value + this.system.statistics.str.bonuseffect + meleeBonus
|
let damage = Number(w.system.damage) + this.system.biodata.sizenum + this.system.biodata.sizebonus + this.system.statistics.str.value + this.system.statistics.str.bonuseffect + meleeBonus
|
||||||
if (damage != w.system.mdl ) {
|
if (damage != w.system.mdl) {
|
||||||
updates.push({ _id: w.id, "system.mdl": damage })
|
updates.push({ _id: w.id, "system.mdl": damage })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let rangedBonus = 0
|
let rangedBonus = 0
|
||||||
effects = this.items.filter(effect => effect.type == "effect" && effect.system.affectstatus && effect.system.affectstatus == "rdl" && (Number(effect.system.effectlevel) > 0))
|
effects = this.items.filter(effect => effect.type == "effect" && effect.system.affectstatus && effect.system.affectstatus == "rdl" && (Number(effect.system.effectlevel) > 0))
|
||||||
for(let e of effects) {
|
for (let e of effects) {
|
||||||
rangedBonus += Number(e.system.effectlevel)
|
rangedBonus += Number(e.system.effectlevel)
|
||||||
}
|
}
|
||||||
let weaponsRanged = this.items.filter( it => it.type == "weapon" && it.system.statistic.toLowerCase() == "agi")
|
if (role?.name?.toLowerCase() == "ranged") { // Add ranged bonus to ADRL
|
||||||
|
roleBonus = this.getRoleLevel()
|
||||||
|
}
|
||||||
|
let weaponsRanged = this.items.filter(it => it.type == "weapon" && it.system.damagestatistic.toLowerCase() == "pre")
|
||||||
for (let w of weaponsRanged) {
|
for (let w of weaponsRanged) {
|
||||||
let damage = Number(w.system.damage) + rangedBonus
|
let damage = roleBonus + Number(w.system.damage) + rangedBonus
|
||||||
if (damage != w.system.rdl ) {
|
if (damage != w.system.rdl) {
|
||||||
updates.push({ _id: w.id, "system.rdl": damage })
|
updates.push({ _id: w.id, "system.rdl": damage })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let armorBonus = 0
|
let armorBonus = 0
|
||||||
effects = this.items.filter(effect => effect.type == "effect" && effect.system.affectstatus && effect.system.affectstatus == " adrl" && (Number(effect.system.effectlevel) > 0))
|
effects = this.items.filter(effect => effect.type == "effect" && effect.system.affectstatus && effect.system.affectstatus == " adrl" && (Number(effect.system.effectlevel) > 0))
|
||||||
for(let e of effects) {
|
for (let e of effects) {
|
||||||
armorBonus += Number(e.system.effectlevel)
|
armorBonus += Number(e.system.effectlevel)
|
||||||
}
|
}
|
||||||
let armors = this.items.filter( it => it.type == "armor")
|
roleBonus = 0
|
||||||
|
if (role?.name?.toLowerCase() == "defender") { // Add defender bonus to ADRL
|
||||||
|
roleBonus = this.getRoleLevel()
|
||||||
|
}
|
||||||
|
let armors = this.items.filter(it => it.type == "armor")
|
||||||
for (let a of armors) {
|
for (let a of armors) {
|
||||||
let adrl = this.system.statistics.phy.value + this.system.statistics.phy.bonuseffect + this.system.biodata.sizenum + this.system.biodata.sizebonus + a.system.resistance + armorBonus
|
let adrl = roleBonus + this.system.statistics.phy.value + this.system.statistics.phy.bonuseffect + this.system.biodata.sizenum + this.system.biodata.sizebonus + a.system.resistance + armorBonus
|
||||||
if (adrl != a.system.adrl ) {
|
if (adrl != a.system.adrl) {
|
||||||
updates.push({ _id: a.id, "system.adrl": adrl })
|
updates.push({ _id: a.id, "system.adrl": adrl })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1693,7 +1702,7 @@ export class PegasusActor extends Actor {
|
|||||||
async modStat(key, inc = 1) {
|
async modStat(key, inc = 1) {
|
||||||
let stat = duplicate(this.system.statistics[key])
|
let stat = duplicate(this.system.statistics[key])
|
||||||
stat.mod += parseInt(inc)
|
stat.mod += parseInt(inc)
|
||||||
await this.update({ [`data.statistics.${key}`]: stat })
|
await this.update({ [`system.statistics.${key}`]: stat })
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1701,7 +1710,7 @@ export class PegasusActor extends Actor {
|
|||||||
key = key.toLowerCase()
|
key = key.toLowerCase()
|
||||||
let stat = duplicate(this.system.statistics[key])
|
let stat = duplicate(this.system.statistics[key])
|
||||||
stat.value += parseInt(inc)
|
stat.value += parseInt(inc)
|
||||||
await this.update({ [`data.statistics.${key}`]: stat })
|
await this.update({ [`system.statistics.${key}`]: stat })
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1709,11 +1718,11 @@ export class PegasusActor extends Actor {
|
|||||||
if (key == "nrg") {
|
if (key == "nrg") {
|
||||||
let nrg = duplicate(this.system.nrg)
|
let nrg = duplicate(this.system.nrg)
|
||||||
nrg.mod += parseInt(inc)
|
nrg.mod += parseInt(inc)
|
||||||
await this.update({ [`data.nrg`]: nrg })
|
await this.update({ [`system.nrg`]: nrg })
|
||||||
} else {
|
} else {
|
||||||
let status = duplicate(this.system.secondary[key])
|
let status = duplicate(this.system.secondary[key])
|
||||||
status.bonus += parseInt(inc)
|
status.bonus += parseInt(inc)
|
||||||
await this.update({ [`data.secondary.${key}`]: status })
|
await this.update({ [`system.secondary.${key}`]: status })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1752,7 +1761,7 @@ export class PegasusActor extends Actor {
|
|||||||
if (objetQ) {
|
if (objetQ) {
|
||||||
let newQ = objetQ.system.quantity + incDec
|
let newQ = objetQ.system.quantity + incDec
|
||||||
if (newQ >= 0) {
|
if (newQ >= 0) {
|
||||||
const updated = await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantity': newQ }]) // pdates one EmbeddedEntity
|
await this.updateEmbeddedDocuments('Item', [{ _id: objetQ.id, 'system.quantity': newQ }]) // pdates one EmbeddedEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1774,7 +1783,7 @@ export class PegasusActor extends Actor {
|
|||||||
ability.system = ability.data
|
ability.system = ability.data
|
||||||
}
|
}
|
||||||
if (ability.system.affectedstat != "notapplicable") {
|
if (ability.system.affectedstat != "notapplicable") {
|
||||||
if ( ability.system.affectedstat == "mr") {
|
if (ability.system.affectedstat == "mr") {
|
||||||
let stat = duplicate(this.system.mr)
|
let stat = duplicate(this.system.mr)
|
||||||
stat.mod += Number(ability.system.statmodifier)
|
stat.mod += Number(ability.system.statmodifier)
|
||||||
updates[`system.mr`] = stat
|
updates[`system.mr`] = stat
|
||||||
@ -1881,7 +1890,7 @@ export class PegasusActor extends Actor {
|
|||||||
getIncreaseStatValue(updates, statKey) {
|
getIncreaseStatValue(updates, statKey) {
|
||||||
let stat = duplicate(this.system.statistics[statKey])
|
let stat = duplicate(this.system.statistics[statKey])
|
||||||
stat.value += 1;
|
stat.value += 1;
|
||||||
updates[`data.statistics.${statKey}`] = stat
|
updates[`system.statistics.${statKey}`] = stat
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1906,6 +1915,48 @@ export class PegasusActor extends Actor {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
|
computeCurrentHindrances() {
|
||||||
|
let hindrancesDices = 0
|
||||||
|
if (this.type == "character") {
|
||||||
|
|
||||||
|
if (this.system.combat.stunlevel > 0) {
|
||||||
|
hindrancesDices += 2
|
||||||
|
}
|
||||||
|
hindrancesDices += this.system.combat.hindrancedice
|
||||||
|
let overCapacity = Math.floor(this.encCurrent / this.getEncumbranceCapacity())
|
||||||
|
if (overCapacity > 0) {
|
||||||
|
hindrancesDices += overCapacity
|
||||||
|
}
|
||||||
|
let effects = this.items.filter(item => item.type == 'effect')
|
||||||
|
for (let effect of effects) {
|
||||||
|
if (effect.system.hindrance) {
|
||||||
|
hindrancesDices += effect.system.effectlevel
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.type == "vehicle") {
|
||||||
|
if (this.system.stun.value > 0) {
|
||||||
|
hindrancesDices += 2
|
||||||
|
}
|
||||||
|
if (this.isVehicleCrawling()) {
|
||||||
|
hindrancesDices += 3
|
||||||
|
}
|
||||||
|
if (this.isVehicleSlow()) {
|
||||||
|
hindrancesDices += 1
|
||||||
|
}
|
||||||
|
if (this.isVehicleAverage()) {
|
||||||
|
hindrancesDices += 1
|
||||||
|
}
|
||||||
|
if (this.isVehicleFast()) {
|
||||||
|
hindrancesDices += 3
|
||||||
|
}
|
||||||
|
if (this.isVehicleExFast()) {
|
||||||
|
hindrancesDices += 5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return hindrancesDices
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
addHindrancesList(effectsList) {
|
addHindrancesList(effectsList) {
|
||||||
@ -1957,7 +2008,7 @@ export class PegasusActor extends Actor {
|
|||||||
/* ROLL SECTION
|
/* ROLL SECTION
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
pushEffect(rollData, effect) {
|
pushEffect(rollData, effect) {
|
||||||
if ( (this.getTraumaState() == "none" && !this.checkNoBonusDice()) || !effect.system.bonusdice) {
|
if ((this.getTraumaState() == "none" && !this.checkNoBonusDice()) || !effect.system.bonusdice) {
|
||||||
rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.system.effectlevel })
|
rollData.effectsList.push({ label: effect.name, type: "effect", applied: false, effect: effect, value: effect.system.effectlevel })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1993,7 +2044,7 @@ export class PegasusActor extends Actor {
|
|||||||
rollData.effectsList.push({ label: "Ranged Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
rollData.effectsList.push({ label: "Ranged Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
||||||
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0, "Ranged Role Bonus"))
|
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0, "Ranged Role Bonus"))
|
||||||
}
|
}
|
||||||
if (role && role.name.toLowerCase() == "defender" && subKey == "defence") {
|
if (role && role.name.toLowerCase() == "defender" && (subKey == "defence" || subKey == "dmg-res")) {
|
||||||
rollData.effectsList.push({ label: "Defender Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
rollData.effectsList.push({ label: "Defender Role Bonus", type: "effect", applied: true, isdynamic: true, value: this.getRoleLevel() })
|
||||||
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0, "Defender Role Bonus"))
|
rollData.dicePool = rollData.dicePool.concat(PegasusUtility.buildDicePool("effect-bonus-dice", this.getRoleLevel(), 0, "Defender Role Bonus"))
|
||||||
}
|
}
|
||||||
@ -2179,6 +2230,8 @@ export class PegasusActor extends Actor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rollData.hindranceDices = this.computeCurrentHindrances()
|
||||||
|
|
||||||
this.processSizeBonus(rollData)
|
this.processSizeBonus(rollData)
|
||||||
this.addEffects(rollData, isInit, isPower, subKey == "power-dmg")
|
this.addEffects(rollData, isInit, isPower, subKey == "power-dmg")
|
||||||
this.addArmorsShields(rollData, statKey, useShield, subKey)
|
this.addArmorsShields(rollData, statKey, useShield, subKey)
|
||||||
|
@ -72,9 +72,22 @@ export class PegasusUtility {
|
|||||||
})
|
})
|
||||||
Handlebars.registerHelper('getStatusConfig', function (a) {
|
Handlebars.registerHelper('getStatusConfig', function (a) {
|
||||||
let key = a + "Status"
|
let key = a + "Status"
|
||||||
console.log("TABE", key, game.system.pegasus.config[key] )
|
//console.log("TABE", key, game.system.pegasus.config[key] )
|
||||||
return game.system.pegasus.config[key]
|
return game.system.pegasus.config[key]
|
||||||
})
|
})
|
||||||
|
Handlebars.registerHelper('valueAtIndex', function (arr, idx) {
|
||||||
|
return arr[idx];
|
||||||
|
})
|
||||||
|
Handlebars.registerHelper('for', function (from, to, incr, block) {
|
||||||
|
let accum = '';
|
||||||
|
for (let i = from; i <= to; i += incr)
|
||||||
|
accum += block.fn(i);
|
||||||
|
return accum;
|
||||||
|
})
|
||||||
|
Handlebars.registerHelper('isGM', function () {
|
||||||
|
return game.user.isGM
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,10 +149,10 @@ export class PegasusUtility {
|
|||||||
let diceKey = PegasusUtility.getDiceFromLevel(level)
|
let diceKey = PegasusUtility.getDiceFromLevel(level)
|
||||||
let diceList = diceKey.split(" ")
|
let diceList = diceKey.split(" ")
|
||||||
for (let myDice of diceList) {
|
for (let myDice of diceList) {
|
||||||
myDice = myDice.trim()
|
let myDiceTrim = myDice.trim()
|
||||||
let newDice = {
|
let newDice = {
|
||||||
name: name, key: myDice, level: PegasusUtility.getLevelFromDice(myDice), mod: mod, effect: effectName,
|
name: name, key: myDiceTrim, level: PegasusUtility.getLevelFromDice(myDiceTrim), mod: mod, effect: effectName,
|
||||||
img: `systems/fvtt-pegasus-rpg/images/dice/${myDice}.webp`
|
img: `systems/fvtt-pegasus-rpg/images/dice/${myDiceTrim}.webp`
|
||||||
}
|
}
|
||||||
dicePool.push(newDice)
|
dicePool.push(newDice)
|
||||||
mod = 0 // Only first dice has modifier
|
mod = 0 // Only first dice has modifier
|
||||||
@ -151,10 +164,10 @@ export class PegasusUtility {
|
|||||||
static updateEffectsBonusDice(rollData) {
|
static updateEffectsBonusDice(rollData) {
|
||||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-bonus-dice")
|
let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-bonus-dice")
|
||||||
for (let effect of rollData.effectsList) {
|
for (let effect of rollData.effectsList) {
|
||||||
if (effect && effect.applied && effect.type == "effect" && !effect.effect?.system?.hindrance && effect.effect && effect.effect.system.bonusdice) {
|
if (effect?.applied && effect.type == "effect" && !effect.effect?.system?.hindrance && effect.effect && effect.effect.system.bonusdice) {
|
||||||
newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.effect.system.effectlevel, 0, effect.effect.name))
|
newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.effect.system.effectlevel, 0, effect.effect.name))
|
||||||
}
|
}
|
||||||
if (effect && effect.applied && effect.type == "effect" && effect.value && effect.isdynamic && !effect.effect?.system?.hindrance) {
|
if (effect?.applied && effect.type == "effect" && effect.value && effect.isdynamic && !effect.effect?.system?.hindrance) {
|
||||||
newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.value, 0, effect.name))
|
newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.value, 0, effect.name))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -165,7 +178,7 @@ export class PegasusUtility {
|
|||||||
static updateHindranceBonusDice(rollData) {
|
static updateHindranceBonusDice(rollData) {
|
||||||
let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-hindrance")
|
let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-hindrance")
|
||||||
for (let hindrance of rollData.effectsList) {
|
for (let hindrance of rollData.effectsList) {
|
||||||
if (hindrance && hindrance.applied && (hindrance.type == "hindrance" || (hindrance.type == "effect" && hindrance.effect?.system?.hindrance))) {
|
if (hindrance?.applied && (hindrance.type == "hindrance" || (hindrance.type == "effect" && hindrance.effect?.system?.hindrance))) {
|
||||||
console.log("Adding Hindrance 1", hindrance, newDicePool)
|
console.log("Adding Hindrance 1", hindrance, newDicePool)
|
||||||
newDicePool = newDicePool.concat(this.buildDicePool("effect-hindrance", (hindrance.value) ? hindrance.value : hindrance.effect.system.effectlevel, 0, hindrance.name))
|
newDicePool = newDicePool.concat(this.buildDicePool("effect-hindrance", (hindrance.value) ? hindrance.value : hindrance.effect.system.effectlevel, 0, hindrance.name))
|
||||||
console.log("Adding Hindrance 2", newDicePool)
|
console.log("Adding Hindrance 2", newDicePool)
|
||||||
@ -826,9 +839,19 @@ export class PegasusUtility {
|
|||||||
let myRoll = rollData.roll
|
let myRoll = rollData.roll
|
||||||
if (!myRoll || rollData.rerollHero || rollData.rerollMomentum) { // New rolls only of no rerolls
|
if (!myRoll || rollData.rerollHero || rollData.rerollMomentum) { // New rolls only of no rerolls
|
||||||
myRoll = new Roll(diceFormula).roll({ async: false })
|
myRoll = new Roll(diceFormula).roll({ async: false })
|
||||||
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
|
||||||
rollData.roll = myRoll
|
rollData.roll = myRoll
|
||||||
}
|
}
|
||||||
|
if ( rollData.hindranceDices > 0) {
|
||||||
|
rollData.hindranceRoll = new Roll(rollData.hindranceDices + "d6").roll({ async: false })
|
||||||
|
this.showDiceSoNice(rollData.hindranceRoll, game.settings.get("core", "rollMode"))
|
||||||
|
for (let res of rollData.hindranceRoll.terms[0].results) {
|
||||||
|
if (res.result == 6) {
|
||||||
|
rollData.hindranceFailure = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
|
||||||
|
|
||||||
// Final score and keep data
|
// Final score and keep data
|
||||||
rollData.finalScore = myRoll.total
|
rollData.finalScore = myRoll.total
|
||||||
|
|
||||||
@ -1048,7 +1071,7 @@ export class PegasusUtility {
|
|||||||
}
|
}
|
||||||
//rollData.attackerId = this.id
|
//rollData.attackerId = this.id
|
||||||
console.log("Target/DEFENDER", defenderActor)
|
console.log("Target/DEFENDER", defenderActor)
|
||||||
defenderActor.addHindrancesList(rollData.effectsList)
|
//defenderActor.addHindrancesList(rollData.effectsList) /* No more used */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@
|
|||||||
],
|
],
|
||||||
"title": "Pegasus RPG",
|
"title": "Pegasus RPG",
|
||||||
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
|
||||||
"version": "11.0.3",
|
"version": "11.0.4",
|
||||||
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.3.zip",
|
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v11.0.4.zip",
|
||||||
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
|
||||||
}
|
}
|
@ -56,13 +56,13 @@
|
|||||||
<li>Power Damage type : {{power.system.powerdamagetype}} {{power.system.powerdamagetypelevel}}</li>
|
<li>Power Damage type : {{power.system.powerdamagetype}} {{power.system.powerdamagetypelevel}}</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if isResistance}}
|
{{#if hindranceFailure}}
|
||||||
<li><strong>Defense Result : {{finalScore}}</strong>
|
<li><strong>Failed due to Hindrance Dice(s) !!</strong>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#if isDamage}}
|
{{#if isResistance}}
|
||||||
<li><strong>Damages : {{finalScore}}</strong>
|
<li><strong>Defense Result : {{finalScore}}</strong>
|
||||||
{{else}}
|
{{else}}
|
||||||
<li><strong>Final Result : {{finalScore}}</strong>
|
<li><strong>Final Result : {{finalScore}}</strong>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="flexrow"><label class="generic-label">DMG RES Dice</label>
|
<li class="flexrow"><label class="generic-label">Damage Resistance</label>
|
||||||
<select class="competence-base flexrow" type="text" name="system.resistance" value="{{data.resistance}}" data-dtype="Number">
|
<select class="competence-base flexrow" type="text" name="system.resistance" value="{{data.resistance}}" data-dtype="Number">
|
||||||
{{#select data.resistance}}
|
{{#select data.resistance}}
|
||||||
{{{optionsDiceList}}}
|
{{{optionsDiceList}}}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
<label class="competence-base">{{data.mdl}}</label>
|
<label class="competence-base">{{data.mdl}}</label>
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if (and owner (eq data.statistic "agi"))}}
|
{{#if (and owner (eq data.damagestatistic "pre"))}}
|
||||||
<li class="flexrow">
|
<li class="flexrow">
|
||||||
<label class="generic-label">RDL</label>
|
<label class="generic-label">RDL</label>
|
||||||
<label class="competence-base">{{data.rdl}}</label>
|
<label class="competence-base">{{data.rdl}}</label>
|
||||||
|
@ -87,7 +87,7 @@
|
|||||||
<div class="flexrow dice-pool-stack">
|
<div class="flexrow dice-pool-stack">
|
||||||
{{#each dicePool as |dice idx|}}
|
{{#each dicePool as |dice idx|}}
|
||||||
<span><a class="pool-remove-dice" data-dice-idx="{{idx}}" data-dice-level="{{dice.level}}" data-dice-key="{{dice.key}}"><img class="dice-pool-image"
|
<span><a class="pool-remove-dice" data-dice-idx="{{idx}}" data-dice-level="{{dice.level}}" data-dice-key="{{dice.key}}"><img class="dice-pool-image"
|
||||||
src="{{dice.img}}"></a></span>
|
src="{{dice.img}}" alt="dices"></a></span>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -100,11 +100,25 @@
|
|||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
{{#each diceList as |dice idx|}}
|
{{#each diceList as |dice idx|}}
|
||||||
<span><a class="pool-add-dice" data-dice-key="{{dice.key}}" data-dice-level="{{dice.level}}"><img class="dice-pool-image"
|
<span><a class="pool-add-dice" data-dice-key="{{dice.key}}" data-dice-level="{{dice.level}}"><img class="dice-pool-image"
|
||||||
src="{{dice.img}}"></a></span>
|
src="{{dice.img}}" alt="dices"></a></span>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if hindranceDices}}
|
||||||
|
<div class="dice-pool-div">
|
||||||
|
<span>
|
||||||
|
<h3 class="dice-pool-label">Hindrance Dices</h3>
|
||||||
|
</span>
|
||||||
|
<div class="flexrow dice-pool-stack">
|
||||||
|
{{#for 1 hindranceDices 1}}
|
||||||
|
<span><a class="" data-dice-idx="{{idx}}" data-dice-level="2" data-dice-key="d6"><img class="dice-pool-image"
|
||||||
|
src="systems/fvtt-pegasus-rpg/images/dice/hindrance-dice.png" alt="dices"></a></span>
|
||||||
|
{{/for}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
|
|
||||||
<span class="roll-dialog-label">Modifiers : </span>
|
<span class="roll-dialog-label">Modifiers : </span>
|
||||||
|
Loading…
Reference in New Issue
Block a user