Correction sur usage BA sur un jet impair au D20
This commit is contained in:
@@ -3,10 +3,10 @@ import { HawkmoonCombat } from "./hawkmoon-combat.js";
|
||||
import { HawkmoonCommands } from "./hawkmoon-commands.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
const __distanceDifficulte = { "porteecourte": 5, "porteemoyenne": 9, "porteelongue": 14}
|
||||
const __tireurDeplacement = { immobile: 0, lent: 3, rapide: 5}
|
||||
const __cibleCouvert = { aucun: 0, leger: 5, complet: 10}
|
||||
const __tailleCible = { normal: 0, main: 10, enfant: 3, maison: -10}
|
||||
const __distanceDifficulte = { "porteecourte": 5, "porteemoyenne": 9, "porteelongue": 14 }
|
||||
const __tireurDeplacement = { immobile: 0, lent: 3, rapide: 5 }
|
||||
const __cibleCouvert = { aucun: 0, leger: 5, complet: 10 }
|
||||
const __tailleCible = { normal: 0, main: 10, enfant: 3, maison: -10 }
|
||||
|
||||
/* -------------------------------------------- */
|
||||
export class HawkmoonUtility {
|
||||
@@ -130,7 +130,7 @@ export class HawkmoonUtility {
|
||||
static createArrayOptionList(min, max) {
|
||||
let options = [];
|
||||
for (let i = min; i <= max; i++) {
|
||||
options.push({key:`${i}`, label:`${i}`});
|
||||
options.push({ key: `${i}`, label: `${i}` });
|
||||
}
|
||||
return options;
|
||||
}
|
||||
@@ -280,7 +280,7 @@ export class HawkmoonUtility {
|
||||
static onSocketMesssage(msg) {
|
||||
if (msg.msg == "msg_apply_combativite") {
|
||||
let defender = game.canvas.tokens.get(msg.data.defenderTokenId)?.actor
|
||||
if(defender) {
|
||||
if (defender) {
|
||||
defender.changeEtatCombativite(msg.data.value)
|
||||
} else {
|
||||
console.warn("HawkmoonUtility.onSocketMesssage : Impossible de trouver le token pour appliquer la combativité", msg.defenderTokenId)
|
||||
@@ -358,14 +358,19 @@ export class HawkmoonUtility {
|
||||
}
|
||||
}
|
||||
|
||||
//console.log("Result : ", rollData)
|
||||
//console.log("Result : ", rollData
|
||||
this.computeResultQuality(rollData)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static computeResultQuality(rollData) {
|
||||
if (rollData.difficulte > 0 && !rollData.isDramatique) {
|
||||
rollData.isSuccess = (rollData.finalResult >= rollData.difficulte)
|
||||
rollData.isHeroique = ((rollData.finalResult - rollData.difficulte) >= 10)
|
||||
rollData.isDramatique = ((rollData.finalResult - rollData.difficulte) <= -10)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static applyCombativite(rollData, value) {
|
||||
if (game.user.isGM) {
|
||||
@@ -435,9 +440,9 @@ export class HawkmoonUtility {
|
||||
rollData.diceFormula += `+3`
|
||||
}
|
||||
if (rollData.hasAmbidextre) {
|
||||
if ( rollData.ambidextre1) {
|
||||
if (rollData.ambidextre1) {
|
||||
rollData.diceFormula += `-3`
|
||||
} else if ( rollData.ambidextre2) {
|
||||
} else if (rollData.ambidextre2) {
|
||||
rollData.diceFormula += `-6`
|
||||
}
|
||||
}
|
||||
@@ -457,7 +462,7 @@ export class HawkmoonUtility {
|
||||
rollData.diceFormula += `+5`
|
||||
}
|
||||
if (rollData.soutiens > 0) { // 1 soutien = +3, 2 soutiens = +4, 3 soutiens = +5
|
||||
rollData.diceFormula += `+${rollData.soutiens+2}`
|
||||
rollData.diceFormula += `+${rollData.soutiens + 2}`
|
||||
}
|
||||
|
||||
if (rollData.arme?.system.isDistance) {
|
||||
@@ -495,9 +500,9 @@ export class HawkmoonUtility {
|
||||
}
|
||||
if (rollData.feinte) {
|
||||
actor.changeBonneAventure(-1)
|
||||
if ( rollData.isHeroique) {
|
||||
if (rollData.isHeroique) {
|
||||
rollData.nbCombativitePerdu = "vaincu"
|
||||
} else if ( rollData.isSuccess) {
|
||||
} else if (rollData.isSuccess) {
|
||||
rollData.nbCombativitePerdu = 2
|
||||
}
|
||||
}
|
||||
@@ -506,7 +511,7 @@ export class HawkmoonUtility {
|
||||
content: await foundry.applications.handlebars.renderTemplate(`systems/fvtt-hawkmoon-cyd/templates/chat-generic-result.html`, rollData)
|
||||
}, rollData)
|
||||
|
||||
if ( (rollData.coupBas || rollData.arme) && rollData.isSuccess && rollData.defenderTokenId) {
|
||||
if ((rollData.coupBas || rollData.arme) && rollData.isSuccess && rollData.defenderTokenId) {
|
||||
this.applyCombativite(rollData, rollData.nbCombativitePerdu)
|
||||
}
|
||||
if (rollData.coupBas && rollData.isSuccess && rollData.defenderTokenId) {
|
||||
@@ -517,30 +522,35 @@ export class HawkmoonUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getCombativiteList(nbActivite) {
|
||||
let list = [ { value: String(0), label: "Combatif"}]
|
||||
for (let i = 1; i < nbActivite-2; i++) {
|
||||
list.push({ value: String(i), label:"Eprouvé " + i} )
|
||||
let list = [{ value: String(0), label: "Combatif" }]
|
||||
for (let i = 1; i < nbActivite - 2; i++) {
|
||||
list.push({ value: String(i), label: "Eprouvé " + i })
|
||||
}
|
||||
list[nbActivite-2] = { value: String(nbActivite-2), label:"Affaibli"}
|
||||
list[nbActivite-1] = { value: String(nbActivite-1), label:"Très Affaibli"}
|
||||
list[nbActivite] = { value: String(nbActivite), label:"Vaincu"}
|
||||
list[nbActivite - 2] = { value: String(nbActivite - 2), label: "Affaibli" }
|
||||
list[nbActivite - 1] = { value: String(nbActivite - 1), label: "Très Affaibli" }
|
||||
list[nbActivite] = { value: String(nbActivite), label: "Vaincu" }
|
||||
return list
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async bonusRollHawkmoon(rollData) {
|
||||
rollData.bonusFormula = rollData.addedBonus
|
||||
console.log("Bonus Roll Hawkmoon", rollData.bonusFormula)
|
||||
|
||||
let bonusRoll = await new Roll(rollData.bonusFormula).roll()
|
||||
await this.showDiceSoNice(bonusRoll, game.settings.get("core", "rollMode"));
|
||||
rollData.bonusRoll = foundry.utils.duplicate(bonusRoll)
|
||||
if (!Number(rollData.bonusFormula)) {
|
||||
let bonusRoll = await new Roll(rollData.bonusFormula).roll()
|
||||
await this.showDiceSoNice(bonusRoll, game.settings.get("core", "rollMode"));
|
||||
rollData.bonusRoll = foundry.utils.duplicate(bonusRoll)
|
||||
rollData.finalResult += Number(rollData.bonusRoll.total)
|
||||
} else {
|
||||
rollData.finalResult += Number(rollData.bonusFormula)
|
||||
console.log("Bonus Roll Hawkmoon 2", rollData.finalResult)
|
||||
}
|
||||
|
||||
rollData.finalResult += rollData.bonusRoll.total
|
||||
|
||||
this.computeResult(rollData)
|
||||
this.computeResultQuality(rollData)
|
||||
|
||||
this.createChatWithRollMode(rollData.alias, {
|
||||
content: await renderTemplate(`systems/fvtt-hawkmoon-cyd/templates/chat-generic-result.html`, rollData)
|
||||
content: await foundry.applications.handlebars.renderTemplate(`systems/fvtt-hawkmoon-cyd/templates/chat-generic-result.html`, rollData)
|
||||
}, rollData)
|
||||
|
||||
}
|
||||
@@ -650,11 +660,11 @@ export class HawkmoonUtility {
|
||||
distanceTir: "porteemoyenne",
|
||||
attaqueCharge: false,
|
||||
attaqueDesarme: false,
|
||||
attaqueAmbidextre1 : false,
|
||||
attaqueAmbidextre2 : false,
|
||||
chargeCavalerie : false,
|
||||
contenir : false,
|
||||
soutiens : 0
|
||||
attaqueAmbidextre1: false,
|
||||
attaqueAmbidextre2: false,
|
||||
chargeCavalerie: false,
|
||||
contenir: false,
|
||||
soutiens: 0
|
||||
}
|
||||
return rollData
|
||||
}
|
||||
@@ -675,13 +685,13 @@ export class HawkmoonUtility {
|
||||
} else if (rollData.coupBas) {
|
||||
let combatValues = defender.getCombatValues()
|
||||
rollData.difficulte = combatValues.defenseTotal
|
||||
}else if ( rollData.assomer) {
|
||||
} else if (rollData.assomer) {
|
||||
rollData.difficulte = 3 + (defender.system.attributs.tre.value * 2)
|
||||
} else if (rollData.desengager) {
|
||||
} else if (rollData.desengager) {
|
||||
rollData.difficulte = rollData.armeAttaqueDefenseur?.system?.totalOffensif || 0;
|
||||
} else if (rollData.armeDefense) {
|
||||
rollData.difficulte = rollData.armeDefense.system.totalDefensif
|
||||
if ( !rollData.desengager && !rollData.arme.system.armenaturelle && !rollData.arme.system.armefortune ){
|
||||
if (!rollData.desengager && !rollData.arme.system.armenaturelle && !rollData.arme.system.armefortune) {
|
||||
if (rollData.armeDefense.system.armenaturelle || rollData.armeDefense.system.armefortune) {
|
||||
rollData.bonusArmeNaturelle = 3
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user