Rollable damages + protection

This commit is contained in:
2022-01-16 22:53:41 +01:00
parent 831b192691
commit 2a83ba027b
9 changed files with 99 additions and 17 deletions

View File

@ -1,5 +1,17 @@
/*
Init order =
10 - Legendary
9 - Heroic
8 - Success
7 - Rivals/adversary
6 - Coriaces/tough
5 - Failure
4 - Pietaille
3 - Echec critique
*/
export class RdDCombatManager extends Combat {
export class BoLCombatManager extends Combat {
/************************************************************************************/
async rollInitiative(ids, formula = undefined, messageOptions = {}) {
@ -7,15 +19,35 @@ export class RdDCombatManager extends Combat {
// Structure input data
ids = typeof ids === "string" ? [ids] : ids;
const currentId = this.combatant._id;
// calculate initiative
if ( game.combat.current.round == 1) {
for (let cId = 0; cId < ids.length; cId++) {
const combatant = this.combatants.get(ids[cId]);
// TODO
console.log("TODO : Compute init for actor");
for (let cId = 0; cId < ids.length; cId++) {
const combatant = this.combatants.get(ids[cId]);
let fvttInit = 5
if (combatant.actor.type == 'character') {
let initData = combatant.actor.getLastInitData();
if (initData.isLegendary) {
fvttInit = 10
} else if (initData.isCritical) {
fvttInit = 9
} else if (initData.lastinit >= 9) {
fvttInit = 8
} else if (initData.isFumble) {
fvttInit = 3
}
} else {
fvttInit = 4 // Pietaille par defaut
if ( combatant.actor.getSubtype == 'adversary') {
fvttInit = 7
}
if ( combatant.actor.getSubtype == 'tough') {
fvttInit = 6
}
}
fvttInit += (cId / 10)
await this.updateEmbeddedDocuments("Combatant", [{ _id: ids[cId], initiative: fvttInit }]);
}
console.log("TODO : Compute init for actor");
}
}
}