Divers fixes + fiches creatures

This commit is contained in:
2022-11-13 23:01:41 +01:00
parent f88fbf977d
commit 50e42d4ecf
17 changed files with 552 additions and 105 deletions

View File

@@ -291,6 +291,10 @@ export class HawkmoonActor extends Actor {
return { isValid: false }
}
/* -------------------------------------------- */
getVigueur() {
return this.system.sante.vigueur
}
/* -------------------------------------------- */
getBonneAventure() {
return this.system.bonneaventure.actuelle
}
@@ -409,8 +413,9 @@ export class HawkmoonActor extends Actor {
/* -------------------------------------------- */
getInitiativeScore() {
return Number(this.system.attributs.adr.value) + Number(this.system.combat.initbonus)
return this.lastInit || -1
}
/* -------------------------------------------- */
getBestDefenseValue() {
let defenseList = this.items.filter(item => (item.type == "arme") && item.system.equipped)
@@ -484,9 +489,10 @@ export class HawkmoonActor extends Actor {
}
/* -------------------------------------------- */
async rollAttribut(attrKey, multiplier = 1) {
async rollAttribut(attrKey, isInit = false) {
let rollData = this.getCommonRollData(attrKey)
rollData.multiplier = multiplier
rollData.multiplier = (isInit)? 1 : 2
rollData.isInit = isInit
let rollDialog = await HawkmoonRollDialog.create(this, rollData)
rollDialog.render(true)
}
@@ -506,9 +512,6 @@ export class HawkmoonActor extends Actor {
if (arme.type == "arme") {
arme = this.prepareArme(arme)
}
if (arme.type == "bouclier") {
arme = this.prepareBouclier(arme)
}
let rollData = this.getCommonRollData(arme.system.attrKey, arme.system.competence._id)
rollData.arme = arme
console.log("ARME!", rollData)
@@ -517,17 +520,18 @@ export class HawkmoonActor extends Actor {
}
/* -------------------------------------------- */
async rollArmeDegats(armeId) {
async rollArmeDegats(armeId, targetVigueur = undefined) {
let arme = this.items.get(armeId)
if (arme.type == "arme") {
arme = this.prepareArme(arme)
}
if (arme.type == "bouclier") {
arme = this.prepareBouclier(arme)
}
console.log("DEGATS", arme)
let roll = new Roll( "1d10+"+arme.system.totalDegats).roll({ async: false })
await HawkmoonUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode"));
let nbEtatPerdus = 0
if (targetVigueur) {
nbEtatPerdus = Math.floor(roll.total / targetVigueur)
}
let rollData = {
arme: arme,
finalResult: roll.total,
@@ -535,6 +539,8 @@ export class HawkmoonActor extends Actor {
actorImg: this.img,
actorId: this.id,
actionImg: arme.img,
targetVigueur: targetVigueur,
nbEtatPerdus: nbEtatPerdus
}
HawkmoonUtility.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-hawkmoon-cyd/templates/chat-degats-result.html`, rollData)