v10/v11 compatibility

This commit is contained in:
2023-05-25 07:23:25 +02:00
parent b1966412a0
commit 189411eef8
6 changed files with 49 additions and 14 deletions

View File

@@ -599,11 +599,17 @@ export class HawkmoonActor extends Actor {
}
console.log("DEGATS", arme)
let roll
let bonus = 0
if (rollDataInput?.isHeroique) {
roll = new Roll("2d10rr10+" + arme.system.totalDegats).roll({ async: false })
if (rollDataInput?.attaqueCharge) {
bonus = 5
}
roll = new Roll("2d10rr10+" + arme.system.totalDegats + "+" + bonus).roll({ async: false })
} else {
roll = new Roll("1d10+" + arme.system.totalDegats).roll({ async: false })
if (rollDataInput?.attaqueCharge) {
bonus = 3
}
roll = new Roll("1d10+" + arme.system.totalDegats + "+" + bonus).roll({ async: false })
}
await HawkmoonUtility.showDiceSoNice(roll, game.settings.get("core", "rollMode"));
let nbEtatPerdus = 0

View File

@@ -102,9 +102,13 @@ export class HawkmoonRollDialog extends Dialog {
html.find('#defenseur-immobilise').change((event) => {
this.rollData.defenseurImmobilise = event.currentTarget.checked
})
html.find('#attaque-charge').change((event) => {
this.rollData.attaqueCharge = event.currentTarget.checked
})
html.find('#attaque-desarme').change((event) => {
this.rollData.attaqueDesarme = event.currentTarget.checked
})
}
}

View File

@@ -325,7 +325,7 @@ export class HawkmoonUtility {
let pa = Math.floor((valueSC - (po * 400)) / 20)
let sc = valueSC - (po * 400) - (pa * 20)
return {
po: po, pa: pa, sc: sc, valueSC: valueSC
po, pa, sc, valueSC
}
}
@@ -419,7 +419,7 @@ export class HawkmoonUtility {
rollData.diceFormula += `+5`
}
if (rollData.arme && rollData.arme.system.isDistance) {
if (rollData.arme?.system.isDistance) {
rollData.difficulte = __distanceDifficulte[rollData.distanceTir]
rollData.difficulte += __tireurDeplacement[rollData.tireurDeplacement]
rollData.difficulte += __cibleCouvert[rollData.cibleCouvert]
@@ -427,6 +427,10 @@ export class HawkmoonUtility {
rollData.difficulte += rollData.cibleDeplace ? 3 : 0
rollData.difficulte += rollData.cibleCaC ? 3 : 0
}
if (rollData.attaqueDesarme) {
rollData.difficulte += 10
}
// Ajout adversités
rollData.diceFormula += `-${rollData.nbAdversites}`
@@ -436,7 +440,7 @@ export class HawkmoonUtility {
let myRoll = new Roll(rollData.diceFormula).roll({ async: false })
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
rollData.roll = myRoll
rollData.roll = duplicate(myRoll)
console.log(">>>> ", myRoll)
rollData.finalResult = myRoll.total
@@ -457,7 +461,7 @@ export class HawkmoonUtility {
let bonusRoll = new Roll(rollData.bonusFormula).roll({ async: false })
await this.showDiceSoNice(bonusRoll, game.settings.get("core", "rollMode"));
rollData.bonusRoll = bonusRoll
rollData.bonusRoll = duplicate(bonusRoll)
rollData.finalResult += rollData.bonusRoll.total
@@ -571,7 +575,9 @@ export class HawkmoonUtility {
tailleCible: "normal",
tireurDeplacement: "immobile",
cibleCouvert: "aucun",
distanceTir: "porteemoyenne"
distanceTir: "porteemoyenne",
attaqueCharge: false,
attaqueDesarme: false
}
return rollData
}