Simplifications en cherchant bug rêve actuel
Parfois, le rêve actuel est ajouté dans les caractéristiques des feuilles de personnage. Simplifications pour essayer d'isoler le souci.
This commit is contained in:
+24
-14
@@ -12,6 +12,7 @@ import { SystemCompendiums } from "../settings/system-compendiums.js";
|
||||
import { RdDItem } from "../item.js";
|
||||
import { StatusEffects, STATUSES } from "../settings/status-effects.js";
|
||||
import { Apprecier } from "../moral/apprecier.mjs";
|
||||
import { CARACS } from "../rdd-carac.js";
|
||||
|
||||
export class RdDBaseActor extends Actor {
|
||||
|
||||
@@ -155,20 +156,21 @@ export class RdDBaseActor extends Actor {
|
||||
super(docData, context);
|
||||
}
|
||||
|
||||
getCarac() {
|
||||
return foundry.utils.duplicate(this.system.carac)
|
||||
}
|
||||
|
||||
findCaracByName(name) {
|
||||
name = Grammar.toLowerCaseNoAccent(name)
|
||||
switch (name) {
|
||||
case 'reve-actuel': case 'reve actuel':
|
||||
return this.system.carac.reve
|
||||
case 'chance-actuelle': case 'chance actuelle':
|
||||
return this.system.carac.chance
|
||||
case 'vie':
|
||||
return this.system.sante.vie
|
||||
case 'reve actuel':
|
||||
name = CARACS.REVE_ACTUEL
|
||||
break
|
||||
case 'chance actuelle':
|
||||
name = CARACS.CHANCE_ACTUELLE
|
||||
break
|
||||
}
|
||||
|
||||
const carac = {}
|
||||
foundry.utils.mergeObject(carac, this.system.carac, { overwrite: false })
|
||||
foundry.utils.mergeObject(carac, this.getCaracCompetenceCreature(), { overwrite: false })
|
||||
const carac = this.getCarac()
|
||||
return RdDBaseActor.$findCaracByName(carac, name);
|
||||
}
|
||||
|
||||
@@ -183,10 +185,18 @@ export class RdDBaseActor extends Actor {
|
||||
getCaracByName(name) {
|
||||
name = this.mapCarac(Grammar.toLowerCaseNoAccent(name)) ?? name
|
||||
switch (name) {
|
||||
case 'reve-actuel': case 'reve actuel':
|
||||
return this.getCaracReveActuel();
|
||||
case 'chance-actuelle': case 'chance-actuelle':
|
||||
return this.getCaracChanceActuelle();
|
||||
case 'reve actuel':
|
||||
name = CARACS.REVE_ACTUEL
|
||||
break
|
||||
case 'chanceactuelle':
|
||||
name = CARACS.CHANCE_ACTUELLE
|
||||
break
|
||||
}
|
||||
switch (name) {
|
||||
case CARACS.REVE_ACTUEL:
|
||||
return this.getCaracReveActuel()[CARACS.REVE_ACTUEL]
|
||||
case CARACS.CHANCE_ACTUELLE:
|
||||
return this.getCaracChanceActuelle()[CARACS.CHANCE_ACTUELLE]
|
||||
}
|
||||
return this.findCaracByName(name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user