Advantage!

This commit is contained in:
sladecraven 2022-05-10 23:04:04 +02:00
parent 33da01707d
commit 34c7024191
4 changed files with 17 additions and 16 deletions

View File

@ -589,7 +589,7 @@ export class BoLActor extends Actor {
if (!protect.data.properties.soak.formula || protect.data.properties.soak.formula == "") { if (!protect.data.properties.soak.formula || protect.data.properties.soak.formula == "") {
ui.notifications.warn(`L'armure ${protect.name} n'a pas de formule pour la protection !`) ui.notifications.warn(`L'armure ${protect.name} n'a pas de formule pour la protection !`)
} else { } else {
formula += "+" + protect.data.properties.soak.formula formula += "+" + " max(" + protect.data.properties.soak.formula +",0)"
} }
} else { } else {
if (protect.data.properties.soak.value == undefined) { if (protect.data.properties.soak.value == undefined) {
@ -608,9 +608,9 @@ export class BoLActor extends Actor {
rollProtection(itemId) { rollProtection(itemId) {
let armor = this.data.items.get(itemId) let armor = this.data.items.get(itemId)
if (armor) { if (armor) {
let armorFormula = armor.data.data.properties.soak.formula; let armorFormula = "max("+armor.data.data.properties.soak.formula + ", 0)"
let rollArmor = new Roll(armorFormula) let rollArmor = new Roll(armorFormula)
rollArmor.roll({ async: false }).toMessage(); rollArmor.roll({ async: false }).toMessage()
} }
} }
@ -618,7 +618,7 @@ export class BoLActor extends Actor {
rollWeaponDamage(itemId) { rollWeaponDamage(itemId) {
let weapon = this.data.items.get(itemId) let weapon = this.data.items.get(itemId)
if (weapon) { if (weapon) {
let r = new BoLDefaultRoll({ id: randomID(16), isSuccess: true, mode: "weapon", weapon: weapon, actor: this }) let r = new BoLDefaultRoll({ id: randomID(16), isSuccess: true, mode: "weapon", weapon: weapon, actorId: this.id, actor: this })
r.setSuccess(true) r.setSuccess(true)
r.rollDamage() r.rollDamage()
} }

View File

@ -555,9 +555,10 @@ export class BoLDefaultRoll {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
getDamageAttributeValue(attrDamage) { getDamageAttributeValue(attrDamage, actorId = undefined) {
let attrDamageValue = 0 let attrDamageValue = 0
let actor = game.actors.get( this.rollData.actorId)
let actor = game.actors.get( (actorId) ? actorId: this.rollData.actorId)
if (attrDamage.includes("vigor")) { if (attrDamage.includes("vigor")) {
attrDamageValue = actor.data.data.attributes.vigor.value attrDamageValue = actor.data.data.attributes.vigor.value
if (attrDamage.includes("half")) { if (attrDamage.includes("half")) {

View File

@ -274,16 +274,16 @@ export class BoLUtility {
defender.sufferDamage(attackDef.finalDamage); defender.sufferDamage(attackDef.finalDamage);
} }
if (defenseMode == 'hero-reduce-damage') { if (defenseMode == 'hero-reduce-damage') {
let armorFormula = defender.getArmorFormula(); let armorFormula = defender.getArmorFormula()
attackDef.rollArmor = new Roll(armorFormula) attackDef.rollArmor = new Roll(armorFormula)
attackDef.rollArmor.roll({ async: false }); attackDef.rollArmor.roll({ async: false })
attackDef.armorProtect = (attackDef.rollArmor.total < 0) ? 0 : attackDef.rollArmor.total; attackDef.armorProtect = (attackDef.rollArmor.total < 0) ? 0 : attackDef.rollArmor.total
attackDef.rollHero = new Roll("1d6"); attackDef.rollHero = new Roll("1d6")
attackDef.rollHero.roll({ async: false }); attackDef.rollHero.roll({ async: false })
attackDef.finalDamage = attackDef.damageRoll.total - attackDef.rollHero.total - attackDef.armorProtect; attackDef.finalDamage = attackDef.damageRoll.total - attackDef.rollHero.total - attackDef.armorProtect
attackDef.finalDamage = (attackDef.finalDamage < 0) ? 0 : attackDef.finalDamage; attackDef.finalDamage = (attackDef.finalDamage < 0) ? 0 : attackDef.finalDamage
defender.sufferDamage(attackDef.finalDamage); defender.sufferDamage(attackDef.finalDamage)
defender.subHeroPoints(1); defender.subHeroPoints(1)
} }
if (defenseMode == 'hero-in-extremis') { if (defenseMode == 'hero-in-extremis') {
attackDef.finalDamage = 0; attackDef.finalDamage = 0;

View File

@ -14,7 +14,7 @@
"url": "https://github.com/ZigmundKreud/bol", "url": "https://github.com/ZigmundKreud/bol",
"license": "LICENSE.txt", "license": "LICENSE.txt",
"flags": {}, "flags": {},
"version": "1.3.6", "version": "1.3.7",
"templateVersion": 10, "templateVersion": 10,
"minimumCoreVersion": "0.8.6", "minimumCoreVersion": "0.8.6",
"compatibleCoreVersion": "9", "compatibleCoreVersion": "9",