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:
@@ -703,9 +703,9 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
rencontre: rencontre,
|
||||
tmr: true,
|
||||
use: { libre: false, conditions: false },
|
||||
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: this.getReveActuel() } }
|
||||
forceCarac: this.getCaracReveActuel()
|
||||
}
|
||||
rollData.competence.system.defaut_carac = 'reve-actuel';
|
||||
rollData.competence.system.defaut_carac = CARACS.REVE_ACTUEL
|
||||
|
||||
const dialog = await RdDRoll.create(this, rollData,
|
||||
{ html: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-reve-de-dragon.hbs' },
|
||||
|
||||
@@ -48,39 +48,26 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
}
|
||||
|
||||
getCarac() {
|
||||
return foundry.utils.mergeObject(this.system.carac,
|
||||
{
|
||||
'reve-actuel': this.getCaracReveActuel(),
|
||||
'chance-actuelle': this.getCaracChanceActuelle()
|
||||
},
|
||||
{ inplace: false })
|
||||
}
|
||||
|
||||
getCaracChanceActuelle() {
|
||||
return {
|
||||
label: 'Chance actuelle',
|
||||
value: this.getChanceActuel(),
|
||||
type: "number"
|
||||
};
|
||||
}
|
||||
|
||||
getCaracReveActuel() {
|
||||
return {
|
||||
label: 'Rêve actuel',
|
||||
value: this.getReveActuel(),
|
||||
type: "number"
|
||||
};
|
||||
const carac = super.getCarac()
|
||||
foundry.utils.mergeObject(carac, this.getCaracReveActuel())
|
||||
foundry.utils.mergeObject(carac, this.getCaracCompetenceCreature(), { overwrite: false })
|
||||
return carac
|
||||
}
|
||||
|
||||
getTaille() { return Misc.toInt(this.system.carac.taille?.value) }
|
||||
getConstitution() { return this.getReve() }
|
||||
getVie() { return this.getReve() }
|
||||
getCaracVie() { return { [CARACS.VIE]: { label: "Vie", value: this.getVieMax(), type: "number" } } }
|
||||
|
||||
getForce() { return this.getReve() }
|
||||
getAgilite() { return this.getForce() }
|
||||
getReve() { return Misc.toInt(this.system.carac.reve?.value) }
|
||||
getChance() { return this.getReve() }
|
||||
getChanceActuel() { return this.getChance() }
|
||||
getCaracChanceActuelle() { return { [CARACS.CHANCE_ACTUELLE]: { label: 'Chance actuelle', value: this.getChanceActuel(), type: "number" } } }
|
||||
|
||||
getReveActuel() { return this.getReve() }
|
||||
getChanceActuel() { return this.getChance() }
|
||||
getCaracReveActuel() { return { [CARACS.REVE_ACTUEL]: { label: "Rêve Actuel", value: this.getReveActuel(), type: "number" } } }
|
||||
|
||||
getEnduranceMax() { return Math.max(1, this.getTaille() + this.getConstitution()) }
|
||||
getEncombrementMax() { return (this.getForce() + this.getTaille()) / 2 }
|
||||
|
||||
@@ -23,10 +23,18 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
||||
this.system.attributs.encombrement.value = this.getEncombrementMax()
|
||||
}
|
||||
|
||||
getCarac() {
|
||||
const carac = super.getCarac()
|
||||
foundry.utils.mergeObject(carac, this.getCaracChanceActuelle())
|
||||
foundry.utils.mergeObject(carac, this.getCaracVie())
|
||||
return carac
|
||||
}
|
||||
|
||||
getForce() { return Misc.toInt(this.system.carac.force?.value) }
|
||||
getConstitution() { return Misc.toInt(this.system.carac.constitution?.value) }
|
||||
getVolonte() { return Misc.toInt(this.system.carac.volonte?.value) }
|
||||
|
||||
getCaracVie() { return { [CARACS.VIE]: { label: "Vie", value: this.getVieMax(), type: "number" } } }
|
||||
getVieMax() { return Misc.toInt(this.system.sante.vie?.max) }
|
||||
getEnduranceMax() { return Math.max(1, this.getTaille() + this.getConstitution()) }
|
||||
getFatigueMax() { return this.getEnduranceMax() * 2 }
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { ItemAction } from "./item/item-actions.js";
|
||||
import { SANS_COMPETENCE } from "./item/base-items.js";
|
||||
import { Apprecier } from "./moral/apprecier.mjs";
|
||||
import { CARACS } from "./rdd-carac.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet for RdD specific items
|
||||
@@ -118,7 +119,7 @@ export class RdDItemSheetV1 extends foundry.appv1.sheets.ItemSheet {
|
||||
this.item.type == ITEM_TYPES.meditation ||
|
||||
this.item.type == ITEM_TYPES.oeuvre) {
|
||||
formData.caracList = foundry.utils.duplicate(game.model.Actor.personnage.carac)
|
||||
formData.caracList["reve-actuel"] = foundry.utils.duplicate(game.model.Actor.personnage.reve.reve)
|
||||
formData.caracList[CARACS.REVE_ACTUEL] = foundry.utils.duplicate(game.model.Actor.personnage.reve.reve)
|
||||
}
|
||||
if (this.item.type == ITEM_TYPES.arme) {
|
||||
formData.competences = formData.competences.filter(it => it.isCompetenceArme())
|
||||
|
||||
@@ -61,7 +61,9 @@ export const CARACS = {
|
||||
DEROBEE: 'derobee',
|
||||
CHANCE_ACTUELLE: 'chance-actuelle',
|
||||
REVE_ACTUEL: 'reve-actuel',
|
||||
VIE: 'vie'
|
||||
}
|
||||
|
||||
export const LIST_CARAC_PERSONNAGE = {
|
||||
[CARACS.TAILLE]: { code: CARACS.TAILLE, label: 'Taille', isCarac: true, path: 'system.carac.taille.value' },
|
||||
[CARACS.APPARENCE]: { code: CARACS.APPARENCE, label: 'Apparence', isCarac: true, path: 'system.carac.apparence.value' },
|
||||
|
||||
@@ -2,6 +2,7 @@ import { RdDRoll } from "./rdd-roll.js";
|
||||
import { Targets } from "./targets.js";
|
||||
import { ITEM_TYPES } from "./constants.js";
|
||||
import { RdDRollResult } from "./rdd-roll-result.js";
|
||||
import { CARACS } from "./rdd-carac.js";
|
||||
|
||||
/* -------------------------------------------- */
|
||||
/* On part du principe qu'une entité démarre tjs
|
||||
@@ -96,15 +97,14 @@ export class RdDPossession {
|
||||
static selectCompetenceDraconicOuPossession(rollData, rollingActor) {
|
||||
rollData.competence = rollingActor.getDraconicOuPossession().find(it => true);
|
||||
if (rollingActor.isCreatureOuEntite()) {
|
||||
const carac = rollingActor.system.carac
|
||||
rollData.carac = carac
|
||||
rollData.competence.system.defaut_carac = 'reve'
|
||||
rollData.selectedCarac = carac.reve
|
||||
rollData.carac = rollingActor.system.carac
|
||||
rollData.competence.system.defaut_carac = CARACS.REVE
|
||||
rollData.selectedCarac = rollingActor.system.carac.reve
|
||||
}
|
||||
else {
|
||||
rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: rollingActor.getReveActuel() } }
|
||||
rollData.selectedCarac = rollData.forceCarac['reve-actuel']
|
||||
rollData.competence.system.defaut_carac = 'reve-actuel'
|
||||
rollData.forceCarac = rollingActor.getCaracReveActuel()
|
||||
rollData.selectedCarac = rollData.forceCarac[CARACS.REVE_ACTUEL]
|
||||
rollData.competence.system.defaut_carac = CARACS.REVE_ACTUEL
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { RdDItemCompetence } from "./item-competence.js";
|
||||
import { RdDItemSort } from "./item-sort.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDBonus } from "./rdd-bonus.js";
|
||||
import { RdDCarac } from "./rdd-carac.js";
|
||||
import { CARACS, RdDCarac } from "./rdd-carac.js";
|
||||
import { RdDResolutionTable } from "./rdd-resolution-table.js";
|
||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
||||
import { Grammar } from "./grammar.js";
|
||||
@@ -65,7 +65,7 @@ export class RdDRoll extends Dialog {
|
||||
}
|
||||
// Mini patch :Ajout du rêve actuel
|
||||
if (actor.type == ACTOR_TYPES.personnage) {
|
||||
defaultRollData.carac["reve-actuel"] = actor.system.reve.reve
|
||||
defaultRollData.carac[CARACS.REVE_ACTUEL] = actor.system.reve.reve
|
||||
}
|
||||
|
||||
foundry.utils.mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
|
||||
|
||||
@@ -16,6 +16,7 @@ import { RdDDice } from "./rdd-dice.js";
|
||||
import { RdDRencontre } from "./item/rencontre.js";
|
||||
import { ITEM_TYPES } from "./constants.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { CARACS } from "./rdd-carac.js";
|
||||
|
||||
const TMR_DISPLAY_SIZE = {
|
||||
code: 'tmr-display-size',
|
||||
@@ -125,7 +126,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
HtmlUtility.showControlWhen(this.html.find(".lire-signe-draconique"), this.actor.isResonanceSigneDraconique(this._getCoordActor()));
|
||||
|
||||
this.html.find('form.tmr-dialog *').click(event => {
|
||||
if (this.subdialog?.rendered){
|
||||
if (this.subdialog?.rendered) {
|
||||
this.subdialog?.bringToFront()
|
||||
}
|
||||
})
|
||||
@@ -685,12 +686,12 @@ export class RdDTMRDialog extends Dialog {
|
||||
tmr: tmr,
|
||||
canClose: false,
|
||||
diffLibre: -7,
|
||||
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: this.actor.getReveActuel() } },
|
||||
forceCarac: this.actor.getCaracReveActuel(),
|
||||
maitrise: { verbe: 'maîtriser', action: 'Maîtriser le fleuve' }
|
||||
}
|
||||
rollData.double = EffetsDraconiques.isDoubleResistanceFleuve(this.actor) ? true : undefined,
|
||||
rollData.competence.system.defaut_carac = 'reve-actuel';
|
||||
await this._rollMaitriseCaseHumide(rollData);
|
||||
rollData.double = EffetsDraconiques.isDoubleResistanceFleuve(this.actor) ? true : undefined
|
||||
rollData.competence.system.defaut_carac = CARACS.REVE_ACTUEL
|
||||
await this._rollMaitriseCaseHumide(rollData)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -810,30 +811,30 @@ export class RdDTMRDialog extends Dialog {
|
||||
tmr: tmr,
|
||||
canClose: options.canClose ?? false,
|
||||
diffLibre: options.difficulte ?? -7,
|
||||
forceCarac: { 'reve-actuel': { label: "Rêve Actuel", value: this.actor.getReveActuel() } },
|
||||
forceCarac: this.actor.getCaracReveActuel(),
|
||||
maitrise: { verbe: 'conquérir', action: options.action }
|
||||
};
|
||||
rollData.competence.system.defaut_carac = 'reve-actuel';
|
||||
}
|
||||
rollData.competence.system.defaut_carac = CARACS.REVE_ACTUEL
|
||||
|
||||
await this._maitriserTMR(rollData, r => this._onResultatConquerir(r, options));
|
||||
await this._maitriserTMR(rollData, r => this._onResultatConquerir(r, options))
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onResultatConquerir(rollData, options) {
|
||||
if (rollData.rolled.isETotal) {
|
||||
rollData.souffle = await this.actor.ajouterSouffle({ chat: false });
|
||||
rollData.souffle = await this.actor.ajouterSouffle({ chat: false })
|
||||
}
|
||||
rollData.poesie = await Poetique.getExtrait();
|
||||
rollData.poesie = await Poetique.getExtrait()
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getOwners(this.actor),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.hbs`, rollData)
|
||||
});
|
||||
})
|
||||
if (rollData.rolled.isEchec) {
|
||||
options.onConqueteEchec(rollData, options.effetDraconique);
|
||||
options.onConqueteEchec(rollData, options.effetDraconique)
|
||||
}
|
||||
else {
|
||||
await options.onConqueteReussie(rollData, options.effetDraconique);
|
||||
this.updateTokens();
|
||||
await options.onConqueteReussie(rollData, options.effetDraconique)
|
||||
this.updateTokens()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -967,7 +968,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
const targetOddq = this.pixiTMR.computeEventOddq(event)
|
||||
const targetCoord = TMRUtility.oddqToCoordTMR(targetOddq)
|
||||
|
||||
if (targetCoord == COORD_TMR_INCONNU){
|
||||
if (targetCoord == COORD_TMR_INCONNU) {
|
||||
ui.notifications.error("Vous ne pouvez pas vous déplacer ici");
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user