Minor cleanup
This commit is contained in:
parent
a65d4511c5
commit
b74fc27079
@ -291,13 +291,13 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
getPossession(possessionId) {
|
||||
return this.items.find(it => it.type == TYPES.possession && it.system.possessionid == possessionId);
|
||||
return this.itemTypes[TYPES.possession].find(it => it.system.possessionid == possessionId);
|
||||
}
|
||||
getPossessions() {
|
||||
return this.items.filter(it => it.type == TYPES.possession);
|
||||
return this.itemTypes[TYPES.possession];
|
||||
}
|
||||
getEmpoignades() {
|
||||
return this.items.filter(it => it.type == TYPES.empoignade);
|
||||
return this.itemTypes[TYPES.empoignade];
|
||||
}
|
||||
getDemiReve() {
|
||||
return this.system.reve.tmrpos.coord;
|
||||
@ -549,7 +549,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
/* -------------------------------------------- */
|
||||
async _recuperationBlessures(message, isMaladeEmpoisonne) {
|
||||
const timestamp = game.system.rdd.calendrier.getTimestamp()
|
||||
const blessures = this.filterItems(it => it.system.gravite > 0, 'blessure').sort(Misc.ascending(it => it.system.gravite))
|
||||
const blessures = this.filterItems(it => it.system.gravite > 0, TYPES.blessure).sort(Misc.ascending(it => it.system.gravite))
|
||||
|
||||
await Promise.all(blessures.map(b => b.recuperationBlessure({
|
||||
actor: this,
|
||||
@ -563,7 +563,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
}
|
||||
|
||||
async supprimerBlessures(filterToDelete) {
|
||||
const toDelete = this.filterItems(filterToDelete, 'blessure')
|
||||
const toDelete = this.filterItems(filterToDelete, TYPES.blessure)
|
||||
.map(it => it.id);
|
||||
await this.deleteEmbeddedDocuments('Item', toDelete);
|
||||
}
|
||||
@ -571,7 +571,7 @@ export class RdDActor extends RdDBaseActor {
|
||||
/* -------------------------------------------- */
|
||||
async _recupererVie(message, isMaladeEmpoisonne) {
|
||||
const tData = this.system
|
||||
let blessures = this.filterItems(it => it.system.gravite > 0, 'blessure');
|
||||
let blessures = this.filterItems(it => it.system.gravite > 0, TYPES.blessure);
|
||||
if (blessures.length > 0) {
|
||||
return
|
||||
}
|
||||
|
@ -20,14 +20,14 @@ const nomCategorieParade = {
|
||||
export class RdDItemArme extends Item {
|
||||
|
||||
static isArme(item) {
|
||||
return RdDItemCompetenceCreature.getCategorieAttaque(item) || item.type == 'arme';
|
||||
return RdDItemCompetenceCreature.getCategorieAttaque(item) || item.type == TYPES.arme;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getArme(arme) {
|
||||
switch (arme ? arme.type : '') {
|
||||
case 'arme': return arme;
|
||||
case 'competencecreature':
|
||||
case TYPES.arme: return arme;
|
||||
case TYPES.competencecreature:
|
||||
return RdDItemCompetenceCreature.armeCreature(arme);
|
||||
}
|
||||
return RdDItemArme.mainsNues();
|
||||
@ -68,14 +68,14 @@ export class RdDItemArme extends Item {
|
||||
return armeData.system.categorie_parade;
|
||||
}
|
||||
// pour compatibilité avec des personnages existants
|
||||
if (armeData.type == 'competencecreature' || armeData.system.categorie == 'creature') {
|
||||
if (armeData.type == TYPES.competencecreature || armeData.system.categorie == 'creature') {
|
||||
return armeData.system.categorie_parade || (armeData.system.isparade ? 'armes-naturelles' : '');
|
||||
}
|
||||
if (!armeData.type.match(/arme|competencecreature/)) {
|
||||
return '';
|
||||
}
|
||||
if (armeData.system.competence == undefined) {
|
||||
return 'competencecreature';
|
||||
return TYPES.competencecreature;
|
||||
}
|
||||
let compname = armeData.system.competence.toLowerCase();
|
||||
if (compname.match(/^(dague de jet|javelot|fouet|arc|arbalête|fronde|hache de jet|fléau)$/)) return '';
|
||||
@ -179,7 +179,7 @@ export class RdDItemArme extends Item {
|
||||
static corpsACorps(mainsNuesActor) {
|
||||
const corpsACorps = {
|
||||
name: 'Corps à corps',
|
||||
type: 'arme',
|
||||
type: TYPES.arme,
|
||||
img: 'systems/foundryvtt-reve-de-dragon/icons/competence_corps_a_corps.webp',
|
||||
system: {
|
||||
equipe: true,
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
import { RdDItem, TYPES } from "./item.js";
|
||||
import { TYPES } from "./item.js";
|
||||
import { RdDCombatManager } from "./rdd-combat.js";
|
||||
|
||||
const categories = {
|
||||
|
@ -364,7 +364,7 @@ export class RdDCalendrier extends Application {
|
||||
if (request.rolled.isSuccess) {
|
||||
if (request.rolled.isPart) {
|
||||
// Gestion expérience (si existante)
|
||||
request.competence = actor.getCompetence("astrologie")
|
||||
request.competence = actor.getCompetence('Astrologie')
|
||||
request.selectedCarac = actor.system.carac["vue"];
|
||||
actor.appliquerAjoutExperience(request, 'hide');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user