Dur au mal, parade, initiative management, amelioration dialogues, bonus/malus sur jets
This commit is contained in:
@@ -47,16 +47,31 @@ export class HawkmoonActor extends Actor {
|
||||
return super.create(data, options);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getBonusDefenseFromTalents() {
|
||||
let talents = this.items.filter(item => item.type == "talent" && item.system.isautomated)
|
||||
let bonus = 0
|
||||
for (let talent of talents) {
|
||||
for (let auto of talent.system.automations) {
|
||||
if (auto.eventtype == "bonus-permanent" && auto.bonusname == "bonus-defensif") {
|
||||
bonus += Number(auto.bonus || 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
return bonus
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareArme(arme) {
|
||||
arme = duplicate(arme)
|
||||
let combat = this.getCombatValues()
|
||||
if (arme.system.typearme == "contact" || arme.system.typearme == "contactjet") {
|
||||
let bonusDefense = this.getBonusDefenseFromTalents()
|
||||
arme.system.competence = duplicate(this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "mêlée"))
|
||||
arme.system.attrKey = "pui"
|
||||
arme.system.totalDegats = arme.system.degats + "+" + combat.bonusDegatsTotal
|
||||
arme.system.totalOffensif = this.system.attributs.pui.value + arme.system.competence.system.niveau + arme.system.bonusmaniementoff
|
||||
arme.system.totalDefensif = combat.defenseTotal + arme.system.competence.system.niveau + arme.system.seuildefense
|
||||
arme.system.totalDefensif = combat.defenseTotal + arme.system.competence.system.niveau + arme.system.seuildefense + bonusDefense
|
||||
arme.system.isdefense = true
|
||||
}
|
||||
if (arme.system.typearme == "jet" || arme.system.typearme == "tir") {
|
||||
@@ -205,7 +220,8 @@ export class HawkmoonActor extends Actor {
|
||||
prepareDerivedData() {
|
||||
|
||||
if (this.type == 'personnage') {
|
||||
let vigueur = Math.floor((this.system.attributs.pui.value + this.system.attributs.tre.value) / 2)
|
||||
let talentBonus = this.getVigueurBonus()
|
||||
let vigueur = Math.floor((this.system.attributs.pui.value + this.system.attributs.tre.value) / 2) + talentBonus
|
||||
if (vigueur != this.system.sante.vigueur) {
|
||||
this.update({ 'system.sante.vigueur': vigueur })
|
||||
}
|
||||
@@ -298,6 +314,21 @@ export class HawkmoonActor extends Actor {
|
||||
getVigueur() {
|
||||
return this.system.sante.vigueur
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getVigueurBonus() {
|
||||
let talents = this.items.filter(item => item.type == "talent" && item.system.isautomated)
|
||||
let bonus = 0
|
||||
for (let talent of talents) {
|
||||
for (let auto of talent.system.automations) {
|
||||
if (auto.eventtype == "bonus-permanent" && auto.bonusname == "vigueur") {
|
||||
bonus += Number(auto.bonus || 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
return bonus
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getBonneAventure() {
|
||||
return this.system.bonneaventure.actuelle
|
||||
@@ -417,7 +448,8 @@ export class HawkmoonActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getInitiativeScore() {
|
||||
return this.lastInit || -1
|
||||
let init = this.getFlag("world", "last-initiative")
|
||||
return init || -1
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -464,6 +496,8 @@ export class HawkmoonActor extends Actor {
|
||||
rollData.alias = this.name
|
||||
rollData.actorImg = this.img
|
||||
rollData.actorId = this.id
|
||||
rollData.isToken = this.isToken
|
||||
rollData.tokenId = this.token?.id
|
||||
rollData.img = this.img
|
||||
rollData.attributs = HawkmoonUtility.getAttributs()
|
||||
rollData.maitriseId = "none"
|
||||
@@ -518,6 +552,7 @@ export class HawkmoonActor extends Actor {
|
||||
}
|
||||
let rollData = this.getCommonRollData(arme.system.attrKey, arme.system.competence._id)
|
||||
rollData.arme = arme
|
||||
HawkmoonUtility.updateWithTarget(rollData)
|
||||
console.log("ARME!", rollData)
|
||||
let rollDialog = await HawkmoonRollDialog.create(this, rollData)
|
||||
rollDialog.render(true)
|
||||
|
Reference in New Issue
Block a user