forked from public/foundryvtt-reve-de-dragon
Preparation du passage en v12
This commit is contained in:
@ -120,7 +120,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getActivePoisons() {
|
||||
return duplicate(this.items.filter(item => item.type == 'poison' && item.system.active))
|
||||
return foundry.utils.duplicate(this.items.filter(item => item.type == 'poison' && item.system.active))
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -143,7 +143,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
getDemiReve() { return this.system.reve.tmrpos.coord }
|
||||
getDraconicList() { return this.itemTypes[TYPES.competence].filter(it => it.system.categorie == 'draconic') }
|
||||
getBestDraconic() { return duplicate(this.getDraconicList().sort(Misc.descending(it => it.system.niveau)).find(it => true)) }
|
||||
getBestDraconic() { return foundry.utils.duplicate(this.getDraconicList().sort(Misc.descending(it => it.system.niveau)).find(it => true)) }
|
||||
getDraconicOuPossession() {
|
||||
return [...this.getDraconicList().filter(it => it.system.niveau >= 0),
|
||||
super.getDraconicOuPossession()]
|
||||
@ -691,7 +691,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
let carac = this.findCaracByName(caracName);
|
||||
if (carac) {
|
||||
carac = duplicate(carac);
|
||||
carac = foundry.utils.duplicate(carac);
|
||||
const fromXp = Number(carac.xp);
|
||||
const fromValue = Number(carac.value);
|
||||
let toXp = fromXp;
|
||||
@ -827,7 +827,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
async deleteExperienceLog(from, count) {
|
||||
if (from >= 0 && count > 0) {
|
||||
let expLog = duplicate(this.system.experiencelog);
|
||||
let expLog = foundry.utils.duplicate(this.system.experiencelog);
|
||||
expLog.splice(from, count);
|
||||
await this.update({ [`system.experiencelog`]: expLog });
|
||||
}
|
||||
@ -1312,7 +1312,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async saouler(forceAlcool, alcool = undefined) {
|
||||
let ethylisme = duplicate(this.system.compteurs.ethylisme);
|
||||
let ethylisme = foundry.utils.duplicate(this.system.compteurs.ethylisme);
|
||||
|
||||
const etat = this.getEtatGeneral({ ethylisme: true });
|
||||
const nbDoses = Number(this.system.compteurs.ethylisme.nb_doses || 0);
|
||||
@ -1489,7 +1489,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
const niveauSuivant = Number(carac.value) + 1;
|
||||
let xpNeeded = RdDCarac.getCaracNextXp(niveauSuivant);
|
||||
if (carac.xp >= xpNeeded) {
|
||||
carac = duplicate(carac);
|
||||
carac = foundry.utils.duplicate(carac);
|
||||
carac.value = niveauSuivant;
|
||||
|
||||
let checkXp = {
|
||||
@ -1519,7 +1519,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (compData && newXP > 0) {
|
||||
let xpNeeded = RdDItemCompetence.getCompetenceNextXp(compData.system.niveau + 1);
|
||||
if (newXP >= xpNeeded) {
|
||||
let newCompData = duplicate(compData);
|
||||
let newCompData = foundry.utils.duplicate(compData);
|
||||
newCompData.system.niveau += 1;
|
||||
newCompData.system.xp = newXP;
|
||||
let checkXp = {
|
||||
@ -1625,14 +1625,14 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
return;
|
||||
}
|
||||
// Duplication car les pts de reve sont modifiés dans le sort
|
||||
let sorts = duplicate(this.$filterSortList(this.itemTypes['sort'], coord));
|
||||
let sorts = foundry.utils.duplicate(this.$filterSortList(this.itemTypes['sort'], coord));
|
||||
if (sorts.length == 0) {
|
||||
ui.notifications.info(`Aucun sort disponible en ${TMRUtility.getTMR(coord).label} !`);
|
||||
return;
|
||||
}
|
||||
|
||||
const draconicList = this.computeDraconicAndSortIndex(sorts);
|
||||
const reve = duplicate(this.system.carac.reve);
|
||||
const reve = foundry.utils.duplicate(this.system.carac.reve);
|
||||
|
||||
const dialog = await this.openRollDialog({
|
||||
name: 'lancer-un-sort',
|
||||
@ -1873,7 +1873,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
diffConditions: 0,
|
||||
use: { libre: false, conditions: true },
|
||||
carac: {
|
||||
[tacheData.system.carac]: duplicate(this.system.carac[tacheData.system.carac])
|
||||
[tacheData.system.carac]: foundry.utils.duplicate(this.system.carac[tacheData.system.carac])
|
||||
}
|
||||
},
|
||||
callbackAction: r => this._tacheResult(r, options)
|
||||
@ -1884,7 +1884,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
async _tacheResult(rollData, options) {
|
||||
// Mise à jour de la tache
|
||||
rollData.appliquerFatigue = ReglesOptionnelles.isUsing("appliquer-fatigue");
|
||||
rollData.tache = duplicate(rollData.tache);
|
||||
rollData.tache = foundry.utils.duplicate(rollData.tache);
|
||||
rollData.tache.system.points_de_tache_courant += rollData.rolled.ptTache;
|
||||
if (rollData.rolled.isETotal) {
|
||||
rollData.tache.system.difficulte--;
|
||||
@ -1912,17 +1912,17 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
{
|
||||
oeuvre: oeuvre,
|
||||
art: oeuvre.type,
|
||||
competence: duplicate(this.getCompetence(artData.compName ?? oeuvre.system.competence ?? artData.art)),
|
||||
competence: foundry.utils.duplicate(this.getCompetence(artData.compName ?? oeuvre.system.competence ?? artData.art)),
|
||||
diffLibre: - oeuvre.system.niveau,
|
||||
diffConditions: 0,
|
||||
use: { libre: false, conditions: true, surenc: false },
|
||||
selectedCarac: duplicate(this.system.carac[selected])
|
||||
selectedCarac: foundry.utils.duplicate(this.system.carac[selected])
|
||||
},
|
||||
{ overwrite: false });
|
||||
artData.competence.system.defaut_carac = selected;
|
||||
if (!artData.forceCarac) {
|
||||
artData.forceCarac = {};
|
||||
artData.forceCarac[selected] = duplicate(this.system.carac[selected]);
|
||||
artData.forceCarac[selected] = foundry.utils.duplicate(this.system.carac[selected]);
|
||||
}
|
||||
|
||||
await this.openRollDialog({
|
||||
@ -1946,19 +1946,19 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async rollChant(id) {
|
||||
const artData = { art: 'chant', verbe: 'Chanter' };
|
||||
const oeuvre = duplicate(this.getChant(id));
|
||||
const oeuvre = foundry.utils.duplicate(this.getChant(id));
|
||||
await this._rollArt(artData, "ouie", oeuvre);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollDanse(id) {
|
||||
const artData = { art: 'danse', verbe: 'Danser', forceCarac: {} };
|
||||
const oeuvre = duplicate(this.findItemLike(id, artData.art));
|
||||
const oeuvre = foundry.utils.duplicate(this.findItemLike(id, artData.art));
|
||||
if (oeuvre.system.agilite) {
|
||||
artData.forceCarac['agilite'] = duplicate(this.system.carac.agilite);
|
||||
artData.forceCarac['agilite'] = foundry.utils.duplicate(this.system.carac.agilite);
|
||||
}
|
||||
if (oeuvre.system.apparence) {
|
||||
artData.forceCarac['apparence'] = duplicate(this.system.carac.apparence);
|
||||
artData.forceCarac['apparence'] = foundry.utils.duplicate(this.system.carac.apparence);
|
||||
}
|
||||
const selectedCarac = this._getCaracDanse(oeuvre);
|
||||
await this._rollArt(artData, selectedCarac, oeuvre);
|
||||
@ -2061,7 +2061,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
const artData = {
|
||||
art: 'jeu', verbe: 'Jeu',
|
||||
use: { libre: true, conditions: true, },
|
||||
competence: duplicate(this.getCompetence('jeu')),
|
||||
competence: foundry.utils.duplicate(this.getCompetence('jeu')),
|
||||
forceCarac: {}
|
||||
};
|
||||
listCarac.forEach(c => artData.forceCarac[c] = this.system.carac[c]);
|
||||
@ -2072,14 +2072,14 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
async rollOeuvre(id) {
|
||||
const artData = { art: 'oeuvre', verbe: 'Interpréter' }
|
||||
const oeuvre = duplicate(this.findItemLike(id, artData.art))
|
||||
const oeuvre = foundry.utils.duplicate(this.findItemLike(id, artData.art))
|
||||
await this._rollArt(artData, oeuvre.system.default_carac, oeuvre)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollMeditation(id) {
|
||||
const meditation = duplicate(this.getMeditation(id));
|
||||
const competence = duplicate(this.getCompetence(meditation.system.competence));
|
||||
const meditation = foundry.utils.duplicate(this.getMeditation(id));
|
||||
const competence = foundry.utils.duplicate(this.getCompetence(meditation.system.competence));
|
||||
competence.system.defaut_carac = "intellect"; // Meditation = toujours avec intellect
|
||||
let meditationData = {
|
||||
competence: competence,
|
||||
@ -2145,7 +2145,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
let draconicList = this.getDraconicList()
|
||||
.map(draconic => {
|
||||
let draconicLecture = duplicate(draconic);
|
||||
let draconicLecture = foundry.utils.duplicate(draconic);
|
||||
draconicLecture.system.defaut_carac = "intellect";
|
||||
return draconicLecture;
|
||||
});
|
||||
@ -2314,7 +2314,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async _xpCarac(xpData) {
|
||||
if (xpData.xpCarac > 0) {
|
||||
const carac = duplicate(this.system.carac)
|
||||
const carac = foundry.utils.duplicate(this.system.carac)
|
||||
const code = RdDBaseActor._findCaracNode(carac, xpData.caracName)
|
||||
const selectedCarac = carac[code]
|
||||
if (this.isCaracMax(code)) {
|
||||
@ -2618,7 +2618,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incDecItemUse(itemId, inc = 1) {
|
||||
let itemUse = duplicate(this.getFlag(SYSTEM_RDD, 'itemUse') ?? {});
|
||||
let itemUse = foundry.utils.duplicate(this.getFlag(SYSTEM_RDD, 'itemUse') ?? {});
|
||||
itemUse[itemId] = (itemUse[itemId] ?? 0) + inc;
|
||||
await this.setFlag(SYSTEM_RDD, 'itemUse', itemUse);
|
||||
console.log("ITEM USE INC", inc, itemUse);
|
||||
@ -2712,7 +2712,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
async setPointsCoeur(subActorId, coeurs, options = { immediat: false }) {
|
||||
const newSuivants = duplicate(this.system.subacteurs.suivants)
|
||||
const newSuivants = foundry.utils.duplicate(this.system.subacteurs.suivants)
|
||||
const amoureux = newSuivants.find(it => it.id == subActorId);
|
||||
if (amoureux) {
|
||||
amoureux[options.immediat ? 'coeur' : 'prochainCoeur'] = coeurs
|
||||
@ -3066,7 +3066,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
incarnation.name = 'Réincarnation de ' + incarnation.name
|
||||
incarnation.system = {
|
||||
carac: duplicate(this.system.carac),
|
||||
carac: foundry.utils.duplicate(this.system.carac),
|
||||
heure: RdDTimestamp.defHeure(await RdDDice.rollTotal("1dh", { rollMode: "selfroll", showDice: SHOW_DICE })).key,
|
||||
age: 18,
|
||||
biographie: '',
|
||||
|
Reference in New Issue
Block a user