forked from public/bol
Various fixes
This commit is contained in:
parent
82c902099f
commit
3e50a9135f
@ -212,6 +212,9 @@ export class BoLActor extends Actor {
|
||||
get fightoptions() {
|
||||
return this.itemData.filter(i => i.type === "feature" && i.data.subtype === "fightoption")
|
||||
}
|
||||
get godsfaith() {
|
||||
return this.itemData.filter(i => i.type === "feature" && i.data.subtype === "godsfaith")
|
||||
}
|
||||
get features() {
|
||||
return this.itemData.filter(i => i.type === "feature")
|
||||
}
|
||||
@ -440,6 +443,11 @@ export class BoLActor extends Actor {
|
||||
"label": "BOL.featureCategory.fightoptions",
|
||||
"ranked": false,
|
||||
"items": this.fightoptions
|
||||
},
|
||||
"godsfaith": {
|
||||
"label": "BOL.featureSubtypes.gods",
|
||||
"ranked": false,
|
||||
"items": this.godsfaith
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -535,7 +543,7 @@ export class BoLActor extends Actor {
|
||||
|
||||
/*-------------------------------------------- */
|
||||
buildListeActions() {
|
||||
return this.melee.concat(this.ranged)
|
||||
return this.melee.concat(this.ranged).concat(this.natural)
|
||||
}
|
||||
|
||||
/*-------------------------------------------- */
|
||||
@ -573,8 +581,8 @@ export class BoLActor extends Actor {
|
||||
|
||||
/*-------------------------------------------- */
|
||||
async sufferDamage(damage) {
|
||||
let newHP = this.data.data.resources.hp.value - damage;
|
||||
await this.update({ 'data.resources.hp.value': newHP });
|
||||
let newHP = this.data.data.resources.hp.value - damage
|
||||
await this.update({ 'data.resources.hp.value': newHP })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -314,12 +314,12 @@ export class BoLRoll {
|
||||
})
|
||||
html.find('#boon').change((event) => {
|
||||
let boons = $('#boon').val()
|
||||
this.rollData.nbBoons = (!boons || boons.length == 0) ? 0 : Math.max(...boons.map(i => parseInt(i)))
|
||||
this.rollData.nbBoons = (!boons || boons.length == 0) ? 0 : boons.length
|
||||
this.updateTotalDice()
|
||||
})
|
||||
html.find('#flaw').change((event) => {
|
||||
let flaws = $('#flaw').val()
|
||||
this.rollData.nbFlaws = (!flaws || flaws.length == 0) ? 0 : Math.max(...flaws.map(i => parseInt(i)))
|
||||
this.rollData.nbFlaws = (!flaws || flaws.length == 0) ? 0 : flaws.length
|
||||
this.updateTotalDice()
|
||||
})
|
||||
html.find('.bdice').click((event) => {
|
||||
@ -335,15 +335,15 @@ export class BoLRoll {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static preProcessWeapon(rollData) {
|
||||
static preProcessWeapon(rollData, defender) {
|
||||
if (rollData.mode == "weapon") {
|
||||
rollData.weaponModifier = rollData.weapon.data.data.properties.attackModifiers ?? 0;
|
||||
rollData.attackBonusDice = rollData.weapon.data.data.properties.attackBonusDice
|
||||
if (rollData.defender) { // If target is selected
|
||||
rollData.defence = rollData.defender.defenseValue
|
||||
rollData.armorMalus = rollData.defender.armorMalusValue
|
||||
if (defender) { // If target is selected
|
||||
rollData.defence = defender.defenseValue
|
||||
rollData.armorMalus = defender.armorMalusValue
|
||||
rollData.shieldBlock = 'none'
|
||||
let shields = rollData.defender.shields
|
||||
let shields = defender.shields
|
||||
for (let shield of shields) {
|
||||
rollData.shieldBlock = (shield.data.properties.blocking.blockingAll) ? 'blockall' : 'blockone';
|
||||
rollData.shieldAttackMalus = (shield.data.properties.blocking.malus) ? shield.data.properties.blocking.malus : 1;
|
||||
@ -361,6 +361,12 @@ export class BoLRoll {
|
||||
const rollOptionTpl = `systems/bol/templates/dialogs/${rollData.mode}-roll-dialog.hbs`
|
||||
|
||||
let actor = game.actors.get( rollData.actorId )
|
||||
let defender
|
||||
if ( rollData.targetId) {
|
||||
let token = game.scenes.current.tokens.get(rollData.targetId)
|
||||
defender = token.actor
|
||||
}
|
||||
|
||||
rollData.careers = actor.careers
|
||||
rollData.boons = actor.bonusBoons
|
||||
rollData.flaws = actor.malusFlaws
|
||||
@ -386,7 +392,7 @@ export class BoLRoll {
|
||||
rollData.attackBonusDice = false
|
||||
rollData.armorMalus = 0
|
||||
// Specific stuff
|
||||
this.preProcessWeapon(rollData)
|
||||
this.preProcessWeapon(rollData, defender)
|
||||
this.preProcessFightOption(rollData)
|
||||
this.updateArmorMalus(rollData)
|
||||
this.updatePPCost(rollData)
|
||||
|
@ -256,8 +256,9 @@ export class BoLUtility {
|
||||
return
|
||||
} // ?? Why ???
|
||||
attackDef.defenseDone = true
|
||||
attackDef.defenseMode = defenseMode;
|
||||
let defender = game.actors.get(attackDef.defenderId)
|
||||
attackDef.defenseMode = defenseMode
|
||||
let token = game.scenes.current.tokens.get(attackDef.targetId)
|
||||
let defender = token.actor
|
||||
|
||||
if (defenseMode == 'damage-with-armor') {
|
||||
let armorFormula = defender.getArmorFormula()
|
||||
@ -300,6 +301,7 @@ export class BoLUtility {
|
||||
rollHero: attackDef.rollHero,
|
||||
weaponHero: attackDef.weaponHero,
|
||||
armorProtect: attackDef.armorProtect,
|
||||
name: defender.name,
|
||||
defender: defender,
|
||||
defenseMode: attackDef.defenseMode,
|
||||
finalDamage: attackDef.finalDamage
|
||||
|
@ -14,7 +14,7 @@
|
||||
"url": "https://github.com/ZigmundKreud/bol",
|
||||
"license": "LICENSE.txt",
|
||||
"flags": {},
|
||||
"version": "1.3.19",
|
||||
"version": "1.3.20",
|
||||
"templateVersion": 10,
|
||||
"minimumCoreVersion": "0.8.6",
|
||||
"compatibleCoreVersion": "9",
|
||||
|
Loading…
Reference in New Issue
Block a user