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