Migration à Foundry v11/v12 + changes requests
This commit is contained in:
@@ -19,9 +19,9 @@ export class VadentisUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static updateCombat( combat, round, diff, id ) {
|
||||
if (game.user.isGM && combat.data.round != 0 && combat.turns && combat.data.active) {
|
||||
if (game.user.isGM && combat.round != 0 && combat.turns && combat.active) {
|
||||
let turn = combat.turns.find(t => t.tokenId == combat.current.tokenId);
|
||||
ChatMessage.create( { content: `Round ${combat.data.round} : C'est au tour de ${turn.actor.name}<br>` } );
|
||||
ChatMessage.create( { content: `Round ${combat.round} : C'est au tour de ${turn.actor.name}<br>` } );
|
||||
|
||||
canvas.tokens.get(turn.token._id).control();
|
||||
canvas.tokens.cycleTokens(1, true);
|
||||
@@ -46,6 +46,14 @@ export class VadentisUtility {
|
||||
return options;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static createDirectIntegerOptionList( min, max) {
|
||||
let options = {};
|
||||
for(let i=min; i<=max; i++) {
|
||||
options[i] = `${i}`;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static createDirectReverseOptionList( min, max) {
|
||||
let options = {};
|
||||
for(let i=max; i>=min; i--) {
|
||||
@@ -64,19 +72,6 @@ export class VadentisUtility {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static templateData(it) {
|
||||
return VadentisUtility.data(it)?.data ?? {}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static data(it) {
|
||||
if (it instanceof Actor || it instanceof Item || it instanceof Combatant) {
|
||||
return it.data;
|
||||
}
|
||||
return it;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static processDamageString( formula, actor ) {
|
||||
let workFormula = formula.toLowerCase();
|
||||
@@ -90,7 +85,7 @@ export class VadentisUtility {
|
||||
static async processRoll( formula, rollMode ) {
|
||||
let myRoll = new Roll(formula);
|
||||
myRoll.roll( { async: false} );
|
||||
if (game.modules.get("dice-so-nice") && game.modules.get("dice-so-nice").active) {
|
||||
if (game.modules.get("dice-so-nice")?.active) {
|
||||
await game.dice3d.showForRoll(myRoll, game.user, true);
|
||||
}
|
||||
return myRoll;
|
||||
@@ -117,17 +112,17 @@ export class VadentisUtility {
|
||||
}
|
||||
|
||||
let formulaTouche = "1d20+"+attaque;
|
||||
let formulaFull = attacker.buildTexteFormula( attacker.data.data.combat.attaque );
|
||||
let formulaFull = attacker.buildTexteFormula( attacker.system.combat.attaque );
|
||||
let myRoll = await this.processRoll(formulaTouche);
|
||||
if (myRoll.dice[0].results[0].result > 1 && myRoll.total >= defense) { // Success !
|
||||
let degats = `normaux : ${combatData.arme.data.damage}`;
|
||||
let formula = combatData.arme.data.damage.toLowerCase();
|
||||
let degats = `normaux : ${combatData.arme.system.damage}`;
|
||||
let formula = combatData.arme.system.damage.toLowerCase();
|
||||
msgData.msg = `${attacker.name} a réussi son attaque sur ${defender.name} (${formulaFull} => ${myRoll.total} / ${defense}) !<br> Les dégâts sont ${degats}.`;
|
||||
|
||||
msgData.msg += tirMsg;
|
||||
if ( myRoll.dice[0].results[0].result >= combatData.arme.data.valuecritical ) {
|
||||
degats = `critiques : ${combatData.arme.data.criticaldamage}`;
|
||||
formula = combatData.arme.data.criticaldamage.toLowerCase();
|
||||
if ( myRoll.dice[0].results[0].result >= combatData.arme.system.valuecritical ) {
|
||||
degats = `critiques : ${combatData.arme.system.criticaldamage}`;
|
||||
formula = combatData.arme.system.criticaldamage.toLowerCase();
|
||||
msgData.msg += `<br>C'est une <strong>réussite critique</strong> !`;
|
||||
}
|
||||
msgData.img = 'systems/foundryvtt-vadentis/images/icons/tchat_attaque_réussie.webp'
|
||||
|
||||
Reference in New Issue
Block a user