Corrections mineures

Plus besoin de vérifier game.versions pour utiliser game.users
Plus besoin d'une indirection Misc.getUsers

defender.system.name => defender.name
This commit is contained in:
Vincent Vandemeulebrouck 2022-10-08 15:38:56 +02:00
parent d75eef1926
commit 6dc7272ef6
4 changed files with 6 additions and 10 deletions

View File

@ -129,7 +129,7 @@ export class ChatUtility {
/* -------------------------------------------- */
static getUsers(filter) {
return Misc.getUsers().filter(filter).map(user => user.id);
return game.users.filter(filter).map(user => user.id);
}
/* -------------------------------------------- */

View File

@ -112,16 +112,12 @@ export class Misc {
return Misc.firstConnectedGM()?.id ?? game.user.id;
}
static getUsers() {
return game.version ? game.users : game.users.entities;
}
static getActiveUser(id) {
return Misc.getUsers().find(u => u.id == id && u.active);
return game.users.find(u => u.id == id && u.active);
}
static firstConnectedGM() {
return Misc.getUsers().filter(u => u.isGM && u.active).sort(Misc.ascending(u => u.id)).find(u => u.isGM && u.active);
return game.users.filter(u => u.isGM && u.active).sort(Misc.ascending(u => u.id)).find(u => u.isGM && u.active);
}
@ -142,7 +138,7 @@ export class Misc {
/* -------------------------------------------- */
static findPlayer(name) {
return Misc.findFirstLike(name, Misc.getUsers(), { description: 'joueur' });
return Misc.findFirstLike(name, game.users, { description: 'joueur' });
}
/* -------------------------------------------- */

View File

@ -878,7 +878,7 @@ export class RdDCombat {
attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker.getBonusDegat(), this.defender.isEntite());
let defenderRoll = { attackerRoll: attackerRoll, passeArme: attackerRoll.passeArme, show: {} }
attackerRoll.show = {
cible: this.target ? this.defender.system.name : 'la cible',
cible: this.target ? this.defender.name : 'la cible',
isRecul: (attackerRoll.particuliere == 'force' || attackerRoll.tactique == 'charge')
}
await RdDResolutionTable.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.html');

View File

@ -1,4 +1,4 @@
import { ENTITE_BLURETTE, ENTITE_INCARNE, ENTITE_NONINCARNE } from "./constants.js";
import { ENTITE_BLURETTE, ENTITE_INCARNE} from "./constants.js";
/**
* Extend the base Dialog entity by defining a custom window to perform roll.