Compare commits

..

No commits in common. "7f7148e6585e77fbdd93b584c8168228d474aab4" and "e9462998102bd95afa77f0d188af9e483475d23b" have entirely different histories.

53 changed files with 149 additions and 151 deletions

View File

@ -28,7 +28,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
return mergeObject(RdDBaseActorReveSheet.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
width: 550,
showCompNiveauBase: false,
@ -39,7 +39,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
/* -------------------------------------------- */
async getData() {
let formData = await super.getData();
foundry.utils.mergeObject(formData,
mergeObject(formData,
{
editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked",
@ -49,7 +49,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
biographie: await TextEditor.enrichHTML(this.actor.system.biographie, { async: true }),
notes: await TextEditor.enrichHTML(this.actor.system.notes, { async: true }),
});
foundry.utils.mergeObject(formData.calc, {
mergeObject(formData.calc, {
surenc: this.actor.computeMalusSurEncombrement(),
surprise: RdDBonus.find(this.actor.getSurprise(false)).descr,
resumeBlessures: this.actor.computeResumeBlessure(this.actor.system.blessures),
@ -80,7 +80,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
// toujours avoir une liste d'armes (pour mettre esquive et corps à corps)
const actor = this.actor;
formData.combat = foundry.utils.duplicate(formData.armes);
formData.combat = duplicate(formData.armes);
RdDItemArme.computeNiveauArmes(formData.combat, formData.competences);
formData.combat.push(RdDItemArme.mainsNues(actor));
formData.combat.push(RdDItemArme.empoignade(actor));
@ -221,7 +221,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
// Points de reve actuel
this.html.find('.ptreve-actuel a').click(async event => this.actor.rollCarac('reve-actuel', true))
this.html.find('.empoignade-label a').click(async event => RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor)))
this.html.find('.arme-label a').click(async event => this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event))))
this.html.find('.arme-label a').click(async event => this.actor.rollArme(duplicate(this._getEventArmeCombat(event))))
// Initiative pour l'arme
this.html.find('.arme-initiative a').click(async event => {
@ -388,7 +388,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
async _onSplitItem(item, split) {
if (split >= 1 && split < item.system.quantite) {
await item.diminuerQuantite(split);
const splitItem = foundry.utils.duplicate(item);
const splitItem = duplicate(item);
splitItem.system.quantite = split;
await this.actor.createEmbeddedDocuments('Item', [splitItem])
}

View File

@ -120,7 +120,7 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
getActivePoisons() {
return foundry.utils.duplicate(this.items.filter(item => item.type == 'poison' && item.system.active))
return 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 foundry.utils.duplicate(this.getDraconicList().sort(Misc.descending(it => it.system.niveau)).find(it => true)) }
getBestDraconic() { return 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 = foundry.utils.duplicate(carac);
carac = 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 = foundry.utils.duplicate(this.system.experiencelog);
let expLog = 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 = foundry.utils.duplicate(this.system.compteurs.ethylisme);
let ethylisme = 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 = foundry.utils.duplicate(carac);
carac = 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 = foundry.utils.duplicate(compData);
let newCompData = 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 = foundry.utils.duplicate(this.$filterSortList(this.itemTypes['sort'], coord));
let sorts = 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 = foundry.utils.duplicate(this.system.carac.reve);
const reve = duplicate(this.system.carac.reve);
const dialog = await this.openRollDialog({
name: 'lancer-un-sort',
@ -1731,7 +1731,7 @@ export class RdDActor extends RdDBaseActorSang {
else {
rollData.depenseReve = 0;
rollData.show.reveInsuffisant = true;
foundry.utils.mergeObject(rollData.rolled, RdDResolutionTable.getResultat("echec"), { overwrite: true });
mergeObject(rollData.rolled, RdDResolutionTable.getResultat("echec"), { overwrite: true });
}
} else {
if (rolled.isETotal) { // Echec total !
@ -1873,7 +1873,7 @@ export class RdDActor extends RdDBaseActorSang {
diffConditions: 0,
use: { libre: false, conditions: true },
carac: {
[tacheData.system.carac]: foundry.utils.duplicate(this.system.carac[tacheData.system.carac])
[tacheData.system.carac]: 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 = foundry.utils.duplicate(rollData.tache);
rollData.tache = duplicate(rollData.tache);
rollData.tache.system.points_de_tache_courant += rollData.rolled.ptTache;
if (rollData.rolled.isETotal) {
rollData.tache.system.difficulte--;
@ -1908,21 +1908,21 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async _rollArt(artData, selected, oeuvre, callbackAction = r => this._resultArt(r)) {
oeuvre.system.niveau = oeuvre.system.niveau ?? 0;
foundry.utils.mergeObject(artData,
mergeObject(artData,
{
oeuvre: oeuvre,
art: oeuvre.type,
competence: foundry.utils.duplicate(this.getCompetence(artData.compName ?? oeuvre.system.competence ?? artData.art)),
competence: duplicate(this.getCompetence(artData.compName ?? oeuvre.system.competence ?? artData.art)),
diffLibre: - oeuvre.system.niveau,
diffConditions: 0,
use: { libre: false, conditions: true, surenc: false },
selectedCarac: foundry.utils.duplicate(this.system.carac[selected])
selectedCarac: duplicate(this.system.carac[selected])
},
{ overwrite: false });
artData.competence.system.defaut_carac = selected;
if (!artData.forceCarac) {
artData.forceCarac = {};
artData.forceCarac[selected] = foundry.utils.duplicate(this.system.carac[selected]);
artData.forceCarac[selected] = 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 = foundry.utils.duplicate(this.getChant(id));
const oeuvre = duplicate(this.getChant(id));
await this._rollArt(artData, "ouie", oeuvre);
}
/* -------------------------------------------- */
async rollDanse(id) {
const artData = { art: 'danse', verbe: 'Danser', forceCarac: {} };
const oeuvre = foundry.utils.duplicate(this.findItemLike(id, artData.art));
const oeuvre = duplicate(this.findItemLike(id, artData.art));
if (oeuvre.system.agilite) {
artData.forceCarac['agilite'] = foundry.utils.duplicate(this.system.carac.agilite);
artData.forceCarac['agilite'] = duplicate(this.system.carac.agilite);
}
if (oeuvre.system.apparence) {
artData.forceCarac['apparence'] = foundry.utils.duplicate(this.system.carac.apparence);
artData.forceCarac['apparence'] = 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: foundry.utils.duplicate(this.getCompetence('jeu')),
competence: 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 = foundry.utils.duplicate(this.findItemLike(id, artData.art))
const oeuvre = duplicate(this.findItemLike(id, artData.art))
await this._rollArt(artData, oeuvre.system.default_carac, oeuvre)
}
/* -------------------------------------------- */
async rollMeditation(id) {
const meditation = foundry.utils.duplicate(this.getMeditation(id));
const competence = foundry.utils.duplicate(this.getCompetence(meditation.system.competence));
const meditation = duplicate(this.getMeditation(id));
const competence = 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 = foundry.utils.duplicate(draconic);
let draconicLecture = 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 = foundry.utils.duplicate(this.system.carac)
const carac = duplicate(this.system.carac)
const code = RdDBaseActor._findCaracNode(carac, xpData.caracName)
const selectedCarac = carac[code]
if (this.isCaracMax(code)) {
@ -2338,7 +2338,7 @@ export class RdDActor extends RdDBaseActorSang {
async _xpCaracDerivee(xpData) {
const caracs = RdDActor._getComposantsCaracDerivee(xpData.caracName)
.map(c => foundry.utils.mergeObject(this.system.carac[c], { isMax: this.isCaracMax(c) }))
.map(c => mergeObject(this.system.carac[c], { isMax: this.isCaracMax(c) }))
switch (caracs.filter(it => !it.isMax).length) {
case 0:
xpData.caracRepartitionManuelle = true;
@ -2618,7 +2618,7 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
async incDecItemUse(itemId, inc = 1) {
let itemUse = foundry.utils.duplicate(this.getFlag(SYSTEM_RDD, 'itemUse') ?? {});
let itemUse = 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);
@ -2686,7 +2686,7 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
static $transformSubActeurSuivant = (suivant, link) => {
return foundry.utils.mergeObject(RdDBaseActor.extractActorMin(suivant), {
return mergeObject(RdDBaseActor.extractActorMin(suivant), {
ephemere: !suivant.prototypeToken.actorLink,
coeur: link.coeur ?? 0,
prochainCoeur: link.prochainCoeur ?? link.coeur ?? 0
@ -2712,7 +2712,7 @@ export class RdDActor extends RdDBaseActorSang {
}
async setPointsCoeur(subActorId, coeurs, options = { immediat: false }) {
const newSuivants = foundry.utils.duplicate(this.system.subacteurs.suivants)
const newSuivants = duplicate(this.system.subacteurs.suivants)
const amoureux = newSuivants.find(it => it.id == subActorId);
if (amoureux) {
amoureux[options.immediat ? 'coeur' : 'prochainCoeur'] = coeurs
@ -2722,7 +2722,7 @@ export class RdDActor extends RdDBaseActorSang {
/* -------------------------------------------- */
static $transformSubActeurVehicule = (vehicle, link) => {
return foundry.utils.mergeObject(RdDBaseActor.extractActorMin(vehicle), {
return mergeObject(RdDBaseActor.extractActorMin(vehicle), {
system: { categorie: vehicle.system.categorie, etat: vehicle.system.etat }
})
};
@ -3066,7 +3066,7 @@ export class RdDActor extends RdDBaseActorSang {
incarnation.name = 'Réincarnation de ' + incarnation.name
incarnation.system = {
carac: foundry.utils.duplicate(this.system.carac),
carac: duplicate(this.system.carac),
heure: RdDTimestamp.defHeure(await RdDDice.rollTotal("1dh", { rollMode: "selfroll", showDice: SHOW_DICE })).key,
age: 18,
biographie: '',

View File

@ -11,7 +11,7 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(RdDBaseActorSheet.defaultOptions, {
return mergeObject(RdDBaseActorSheet.defaultOptions, {
width: 550
});
}

View File

@ -286,7 +286,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
getCarac() {
// TODO: le niveau d'une entité de cauchemar devrait être exclu...
const carac = foundry.utils.mergeObject(foundry.utils.duplicate(this.system.carac),
const carac = mergeObject(duplicate(this.system.carac),
{
'reve-actuel': this.getCaracReveActuel(),
'chance-actuelle': this.getCaracChanceActuelle()
@ -459,7 +459,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
async onAppliquerJetEncaissement(encaissement, attacker) { }
async $afficherEncaissement(encaissement, show) {
foundry.utils.mergeObject(encaissement, {
mergeObject(encaissement, {
alias: this.name,
hasPlayerOwner: this.hasPlayerOwner,
show: show ?? {}
@ -471,7 +471,7 @@ export class RdDBaseActorReve extends RdDBaseActor {
});
if (!encaissement.hasPlayerOwner && encaissement.endurance != 0) {
encaissement = foundry.utils.duplicate(encaissement);
encaissement = duplicate(encaissement);
encaissement.isGM = true;
ChatMessage.create({
whisper: ChatMessage.getWhisperRecipients("GM"),

View File

@ -89,12 +89,12 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
/* -------------------------------------------- */
async onAppliquerJetEncaissement(encaissement, attacker) {
const santeOrig = foundry.utils.duplicate(this.system.sante);
const santeOrig = duplicate(this.system.sante);
const blessure = await this.ajouterBlessure(encaissement, attacker); // Will update the result table
const perteVie = await this.santeIncDec("vie", -encaissement.vie);
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance, blessure?.isCritique());
foundry.utils.mergeObject(encaissement, {
mergeObject(encaissement, {
resteEndurance: perteEndurance.newValue,
sonne: perteEndurance.sonne,
jetEndurance: perteEndurance.jetEndurance,
@ -108,7 +108,7 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
if (name == 'fatigue' && !ReglesOptionnelles.isUsing("appliquer-fatigue")) {
return;
}
const sante = foundry.utils.duplicate(this.system.sante)
const sante = duplicate(this.system.sante)
let compteur = sante[name];
if (!compteur) {
return;
@ -135,7 +135,7 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
result.perte = perte;
if (perte > 1) {
// Peut-être sonné si 2 points d'endurance perdus d'un coup
foundry.utils.mergeObject(result, await this.jetEndurance(result.newValue));
mergeObject(result, await this.jetEndurance(result.newValue));
} else if (inc > 0) {
await this.setSonne(false);
}

View File

@ -15,7 +15,7 @@ export class RdDBaseActorSheet extends ActorSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(ActorSheet.defaultOptions, {
return mergeObject(ActorSheet.defaultOptions, {
classes: ["rdd", "sheet", "actor"],
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }],
dragDrop: [{ dragSelector: ".item-list .item", dropSelector: undefined }],
@ -312,7 +312,7 @@ export class RdDBaseActorSheet extends ActorSheet {
async _onSplitItem(item, split) {
if (split >= 1 && split < item.system.quantite) {
await item.diminuerQuantite(split);
const splitItem = foundry.utils.duplicate(item);
const splitItem = duplicate(item);
splitItem.system.quantite = split;
await this.actor.createEmbeddedDocuments('Item', [splitItem])
}

View File

@ -123,7 +123,7 @@ export class RdDBaseActor extends Actor {
constructor(docData, context = {}) {
if (!context.rdd?.ready) {
foundry.utils.mergeObject(context, { rdd: { ready: true } });
mergeObject(context, { rdd: { ready: true } });
const ActorConstructor = game.system.rdd.actorClasses[docData.type];
if (ActorConstructor) {
if (!docData.img) {
@ -377,7 +377,7 @@ export class RdDBaseActor extends Actor {
if (cout > 0) {
RdDAudio.PlayContextAudio("argent");
}
const chatAchatItem = foundry.utils.duplicate(achat.vente);
const chatAchatItem = duplicate(achat.vente);
chatAchatItem.quantiteTotal = quantite;
ChatMessage.create({
user: achat.userId,
@ -453,7 +453,7 @@ export class RdDBaseActor extends Actor {
type: item.type,
img: item.img,
name: item.name,
system: foundry.utils.mergeObject(item.system, { quantite: isItemEmpilable ? quantite : undefined })
system: mergeObject(item.system, { quantite: isItemEmpilable ? quantite : undefined })
};
const newItems = isItemEmpilable ? [baseItem] : Array.from({ length: quantite }, (_, i) => baseItem);
const items = await this.createEmbeddedDocuments("Item", newItems);
@ -649,7 +649,7 @@ export class RdDBaseActor extends Actor {
sourceActor.buildSubConteneurObjetList(itemId, itemsList); // Get itemId list
const itemsDataToCreate = itemsList.map(it => sourceActor.getItem(it.id))
.map(it => foundry.utils.duplicate(it))
.map(it => duplicate(it))
.map(it => { it.system.contenu = []; return it; });
let newItems = await this.createEmbeddedDocuments('Item', itemsDataToCreate);

View File

@ -11,7 +11,7 @@ export class RdDCommerceSheet extends RdDBaseActorSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
return mergeObject(super.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/actor/commerce-actor-sheet.html",
width: 600, height: 720,
tabs: []
@ -27,7 +27,7 @@ export class RdDCommerceSheet extends RdDBaseActorSheet {
async getData() {
const formData = await super.getData();
if (this.actor.token && this.actor.token != this.actor.prototypeToken) {
foundry.utils.mergeObject(formData,
mergeObject(formData,
{
title: this.actor.token.name,
token: {

View File

@ -9,7 +9,7 @@ export class RdDCreatureSheet extends RdDBaseActorSangSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(RdDBaseActorSangSheet.defaultOptions, {
return mergeObject(RdDBaseActorSangSheet.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/actor-creature-sheet.html",
width: 640, height: 720
});

View File

@ -48,7 +48,7 @@ export class RdDCreature extends RdDBaseActorSang {
/* -------------------------------------------- */
async setEntiteReveAccordee(attacker) {
if (this.isEntite([ENTITE_INCARNE])) {
let resonnance = foundry.utils.duplicate(this.system.sante.resonnance);
let resonnance = duplicate(this.system.sante.resonnance);
if (resonnance.actors.find(it => it == attacker.id)) {
// déjà accordé
return;

View File

@ -6,7 +6,7 @@ export class RdDActorEntiteSheet extends RdDBaseActorReveSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(RdDBaseActorReveSheet.defaultOptions, {
return mergeObject(RdDBaseActorReveSheet.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/actor-entite-sheet.html",
width: 640, height: 720,
});

View File

@ -76,7 +76,7 @@ export class RdDEntite extends RdDBaseActorReve {
async onAppliquerJetEncaissement(encaissement, attacker) {
const perteEndurance = await this.santeIncDec("endurance", -encaissement.endurance);
foundry.utils.mergeObject(encaissement, {
mergeObject(encaissement, {
resteEndurance: perteEndurance.newValue,
endurance: perteEndurance.perte
});
@ -93,7 +93,7 @@ export class RdDEntite extends RdDBaseActorReve {
/* -------------------------------------------- */
async setEntiteReveAccordee(attacker) {
if (this.isEntite([ENTITE_INCARNE])) {
let resonnance = foundry.utils.duplicate(this.system.sante.resonnance);
let resonnance = duplicate(this.system.sante.resonnance);
if (resonnance.actors.find(it => it == attacker.id)) {
// déjà accordé
return;

View File

@ -6,7 +6,7 @@ export class RdDActorVehiculeSheet extends RdDBaseActorSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(RdDBaseActorSheet.defaultOptions, {
return mergeObject(RdDBaseActorSheet.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/actor-vehicule-sheet.html",
width: 640, height: 720,
});
@ -15,7 +15,7 @@ export class RdDActorVehiculeSheet extends RdDBaseActorSheet {
/* -------------------------------------------- */
async getData() {
let formData = await super.getData();
foundry.utils.mergeObject(formData,
mergeObject(formData,
{
editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked",

View File

@ -131,7 +131,7 @@ export class ChatUtility {
/* -------------------------------------------- */
static blindMessageToGM(chatOptions) {
let chatGM = foundry.utils.duplicate(chatOptions);
let chatGM = duplicate(chatOptions);
chatGM.whisper = ChatUtility.getUsers(user => user.isGM);
chatGM.content = "Message aveugle de " + game.user.name + "<br>" + chatOptions.content;
console.log("blindMessageToGM", chatGM);

View File

@ -69,7 +69,7 @@ export class RdDCoeur {
}
static async applyCoeurChateauDormant(actor, message) {
const newSuivants = foundry.utils.duplicate(actor.system.subacteurs.suivants)
const newSuivants = duplicate(actor.system.subacteurs.suivants)
let count = 0
newSuivants.forEach(async link => {
const suivant = game.actors.get(link.id)

View File

@ -2,8 +2,8 @@
export class DialogChoixXpCarac extends Dialog {
static async choix(actor, xpData, caracs) {
caracs = caracs.map(it => foundry.utils.mergeObject({ ajout: 0 }, it))
xpData = foundry.utils.mergeObject({ reste: xpData.xpCarac }, xpData)
caracs = caracs.map(it => mergeObject({ ajout: 0 }, it))
xpData = mergeObject({ reste: xpData.xpCarac }, xpData)
const dialogData = {
title: `Choisissez la répartition d'expérience`,
content: await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/dialog-choix-xp-carac.hbs", {
@ -24,7 +24,7 @@ export class DialogChoixXpCarac extends Dialog {
}
constructor(dialogData, dialogOptions, actor, xpData, caracs) {
dialogData = foundry.utils.mergeObject(dialogData, {
dialogData = mergeObject(dialogData, {
default: 'appliquer',
buttons: {
'appliquer': { icon:'<i class="fa-solid fa-check"></i>', label: "Ajouter la répartition", callback: it => this.appliquerSelection() }

View File

@ -21,7 +21,7 @@ export class DialogFabriquerPotion extends Dialog {
/* -------------------------------------------- */
static prepareData(actor, item) {
let potionData = foundry.utils.duplicate(item)
let potionData = duplicate(item)
potionData.nbBrinsSelect = RdDUtility.buildListOptions(
DialogFabriquerPotion.nombreBrinsMinimum(item),
DialogFabriquerPotion.nombreBrinsOptimal(item));

View File

@ -47,7 +47,7 @@ export class DialogConsommer extends Dialog {
/* -------------------------------------------- */
static prepareData(actor, item) {
let consommerData = {
item: foundry.utils.duplicate(item),
item: duplicate(item),
cuisine: actor.getCompetence('cuisine'),
choix: {
doses: 1,

View File

@ -56,7 +56,7 @@ export class DialogItemVente extends Dialog {
}
updateVente(update) {
foundry.utils.mergeObject(this.venteData, update);
mergeObject(this.venteData, update);
}
getChoixVente() {

View File

@ -139,7 +139,7 @@ export class RdDItemArme extends Item {
const uneOuDeuxMains = armeData.system.unemain && armeData.system.deuxmains;
const containsSlash = !Number.isInteger(armeData.system.dommages) && armeData.system.dommages.includes("/");
if (containsSlash) { // Sanity check
armeData = foundry.utils.duplicate(armeData);
armeData = duplicate(armeData);
const tableauDegats = armeData.system.dommages.split("/");
if (aUneMain)

View File

@ -199,7 +199,7 @@ export class RdDItemCompetence extends Item {
if (idOrName == undefined || idOrName == "") {
return RdDItemCompetence.sansCompetence();
}
options = foundry.utils.mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, { overwrite: false });
options = mergeObject(options, { preFilter: it => it.isCompetence(), description: 'compétence' }, { overwrite: false });
return RdDItemCompetence.findFirstItem(list, idOrName, options);
}
@ -257,7 +257,7 @@ export class RdDItemCompetence extends Item {
/* -------------------------------------------- */
static computeResumeArchetype(competences) {
const computed = foundry.utils.duplicate(limitesArchetypes);
const computed = duplicate(limitesArchetypes);
computed.forEach(it => { it.nombre = 0; it.reste = it.nombreMax; });
competences.map(it => Math.max(0, it.system.niveau_archetype))

View File

@ -33,7 +33,7 @@ export class RdDItemCompetenceCreature extends Item {
if (categorieAttaque != undefined) {
// si c'est un Item compétence: cloner pour ne pas modifier la compétence
let arme = item.clone();
foundry.utils.mergeObject(arme,
mergeObject(arme,
{
action: item.isCompetencePossession() ? 'possession' : 'attaque',
system: {

View File

@ -57,7 +57,7 @@ export class Monnaie {
}
static creerDeniers(fortune) {
const deniers = foundry.utils.duplicate(MONNAIE_ETAIN);
const deniers = duplicate(MONNAIE_ETAIN);
deniers.system.quantite = fortune;
return deniers;
}

View File

@ -39,7 +39,7 @@ export class RdDItemSheet extends ItemSheet {
/** @override */
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
return mergeObject(super.defaultOptions, {
classes: [SYSTEM_RDD, "sheet", "item"],
template: RdDItemSheet.defaultTemplate(RdDItemSheet.ITEM_TYPE),
width: 550,
@ -108,8 +108,8 @@ export class RdDItemSheet extends ItemSheet {
const competences = await SystemCompendiums.getCompetences('personnage');
formData.categories = this.item.getCategories()
if (this.item.type == 'tache' || this.item.type == 'livre' || this.item.type == 'meditation' || this.item.type == 'oeuvre') {
formData.caracList = foundry.utils.duplicate(game.system.model.Actor.personnage.carac)
formData.caracList["reve-actuel"] = foundry.utils.duplicate(game.system.model.Actor.personnage.reve.reve)
formData.caracList = duplicate(game.system.model.Actor.personnage.carac)
formData.caracList["reve-actuel"] = duplicate(game.system.model.Actor.personnage.reve.reve)
formData.competences = competences;
}
if (this.item.type == 'arme') {
@ -228,7 +228,7 @@ export class RdDItemSheet extends ItemSheet {
});
}
const updateItemTimestamp = (path, timestamp) => this.item.update({ [path]: foundry.utils.duplicate(timestamp) })
const updateItemTimestamp = (path, timestamp) => this.item.update({ [path]: duplicate(timestamp) })
RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.debut', updateItemTimestamp);
RdDTimestamp.handleTimestampEditor(this.html, 'system.temporel.fin', updateItemTimestamp);

View File

@ -317,8 +317,8 @@ export class RdDItem extends Item {
const timestampFin = await this.calculerFinPeriodeTemporel(timestampDebut);
await actor.updateEmbeddedDocuments('Item', [{
_id: this.id,
'system.temporel.debut': foundry.utils.duplicate(timestampDebut),
'system.temporel.fin': foundry.utils.duplicate(timestampFin),
'system.temporel.debut': duplicate(timestampDebut),
'system.temporel.fin': duplicate(timestampFin),
}])
}
}

View File

@ -39,7 +39,7 @@ export class RdDItemBlessure extends RdDItem {
ui.notifications.warn(`Pas de tâche de soins pour une blessure ${gravite}`)
return undefined;
}
return foundry.utils.mergeObject(foundry.utils.duplicate(BASE_TACHE_SOIN_BLESSURE), tache)
return mergeObject(duplicate(BASE_TACHE_SOIN_BLESSURE), tache)
}
static async applyFullBlessure(actor, gravite) {
@ -106,7 +106,7 @@ export class RdDItemBlessure extends RdDItem {
}
async setSoinsBlessure(systemUpdate = {}) {
systemUpdate = foundry.utils.mergeObject(systemUpdate, this.system, { overwrite: false }),
systemUpdate = mergeObject(systemUpdate, this.system, { overwrite: false }),
systemUpdate.soinscomplets.done = systemUpdate.premierssoins.done && systemUpdate.soinscomplets.done
await this.update({
img: this.getImgSoins(systemUpdate.gravite, systemUpdate.soinscomplets.done),
@ -134,14 +134,14 @@ export class RdDItemBlessure extends RdDItem {
if (rolled.isETotal) {
message.content += ` -- une blessure ${label} s'infecte (temps de guérison augmenté de ${gravite} jours, perte de vie)`;
await actor.santeIncDec("vie", -1);
foundry.utils.mergeObject(update, {
mergeObject(update, {
system: { fin: { indexDate: timestamp.addJours(gravite).indexDate } }
});
}
else {
if (!isMaladeEmpoisonne && rolled.isSuccess && this.peutRetrograder(graviteMoindre, moindres)) {
message.content += ` -- une blessure ${label} cicatrise`;
foundry.utils.mergeObject(update, {
mergeObject(update, {
system: {
gravite: graviteMoindre,
temporel: { fin: { indexDate: timestamp.addJours(graviteMoindre).indexDate } }

View File

@ -38,7 +38,7 @@ export class RdDItemMaladie extends RdDItem {
await mal.actor.updateEmbeddedDocuments('Item', [{
_id: mal.id,
'system.temporel.fin': foundry.utils.duplicate(timestampFin),
'system.temporel.fin': duplicate(timestampFin),
}])
}
}

View File

@ -8,7 +8,7 @@ const TYPE_ITEMS_NATURELS = ["faune", "herbe", "plante", "ingredient"];
export class RdDItemInventaireSheet extends RdDItemSheet {
static get defaultOptions() {
return foundry.utils.mergeObject(RdDItemSheet.defaultOptions, {
return mergeObject(RdDItemSheet.defaultOptions, {
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
});
}
@ -23,7 +23,7 @@ export class RdDItemInventaireSheet extends RdDItemSheet {
async getData() {
const formData = await super.getData();
return foundry.utils.mergeObject(formData, {
return mergeObject(formData, {
milieux: await game.system.rdd.environnement.autresMilieux(this.item)
});
}

View File

@ -6,7 +6,7 @@ export class RdDRencontreItemSheet extends RdDItemSheet {
static get ITEM_TYPE() { return "rencontre" };
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
return mergeObject(super.defaultOptions, {
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "carac" }]
});
}
@ -24,7 +24,7 @@ export class RdDRencontreItemSheet extends RdDItemSheet {
/* -------------------------------------------- */
async getData() {
const formData = await super.getData();
foundry.utils.mergeObject(formData, {
mergeObject(formData, {
effets: {
succes: {
liste: RdDRencontre.getEffetsSucces(),

View File

@ -189,7 +189,7 @@ class _10_2_5_ArmesTirLancer extends Migration {
get version() { return "10.2.5"; }
migrateArmeTirLancer(it) {
let updates = foundry.utils.mergeObject({ _id: it.id }, this.getMapping(it).updates);
let updates = mergeObject({ _id: it.id }, this.getMapping(it).updates);
console.log(it.name, updates);
return updates;
}
@ -364,7 +364,7 @@ class _10_4_6_ServicesEnCommerces extends Migration {
const item = await RdDItem.getCorrespondingItem(serviceRefItem);
const itemToCreate = {
name: item.name, img: item.img, type: item.type,
system: foundry.utils.mergeObject({ cout: serviceRefItem.system.cout, quantite: serviceRefItem.system.quantite }, item.system, { overwrite: false })
system: mergeObject({ cout: serviceRefItem.system.cout, quantite: serviceRefItem.system.quantite }, item.system, { overwrite: false })
};
return itemToCreate;
}

View File

@ -200,7 +200,7 @@ export class Misc {
/* -------------------------------------------- */
static findFirstLike(value, elements, options = {}) {
options = foundry.utils.mergeObject({
options = mergeObject({
mapper: it => it.name,
preFilter: it => true,
description: 'valeur',
@ -225,7 +225,7 @@ export class Misc {
}
static findAllLike(value, elements, options = {}) {
options = foundry.utils.mergeObject({
options = mergeObject({
mapper: it => it.name,
preFilter: it => true,
description: 'valeur',

View File

@ -128,7 +128,7 @@ export class RdDCombatManager extends Combat {
// Send a chat message
let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode");
let messageData = foundry.utils.mergeObject(
let messageData = mergeObject(
{
speaker: {
scene: canvas.scene._id,
@ -218,7 +218,7 @@ export class RdDCombatManager extends Combat {
static $prepareAttaqueArme(infoAttaque) {
const comp = infoAttaque.competences.find(c => c.name == infoAttaque.competence);
const attaque = foundry.utils.duplicate(infoAttaque.arme);
const attaque = duplicate(infoAttaque.arme);
attaque.action = 'attaque';
attaque.system.competence = infoAttaque.competence;
attaque.system.dommagesReels = infoAttaque.dommagesReel;
@ -885,12 +885,12 @@ export class RdDCombat {
this.removeChatMessageActionsPasseArme(attackerRoll.passeArme);
if (essaisPrecedents) {
foundry.utils.mergeObject(attackerRoll.essais, essaisPrecedents, { overwrite: true });
mergeObject(attackerRoll.essais, essaisPrecedents, { overwrite: true });
}
// # utilisation esquive
const corpsACorps = this.defender.getCompetenceCorpsACorps({ onMessage: it => console.info(it, this.defender) });
const esquives = foundry.utils.duplicate(this.defender.getCompetencesEsquive())
const esquives = duplicate(this.defender.getCompetencesEsquive())
esquives.forEach(e => e.system.nbUsage = e?._id ? this.defender.getItemUse(e._id) : 0);
const paramChatDefense = {

View File

@ -14,10 +14,10 @@ export class RdDConfirm {
"cancel": RdDConfirm._createButtonCancel()
};
if (options.settingConfirmer) {
buttons = foundry.utils.mergeObject(RdDConfirm._createButtonActionSave(options), buttons);
buttons = mergeObject(RdDConfirm._createButtonActionSave(options), buttons);
}
if (autresActions) {
buttons = foundry.utils.mergeObject(autresActions, buttons);
buttons = mergeObject(autresActions, buttons);
}
const dialogDetails = {
title: options.title,

View File

@ -98,7 +98,7 @@ export class RdDEmpoignade {
/* -------------------------------------------- */
static getEmpoignadeById(actor, id) {
let emp = actor.itemTypes[TYPES.empoignade].find(it => it.system.empoignadeid == id)
return emp && foundry.utils.duplicate(emp) || undefined;
return emp && duplicate(emp) || undefined;
}
/* -------------------------------------------- */
@ -108,7 +108,7 @@ export class RdDEmpoignade {
(it.system.empoigneurid == defender.id && it.system.empoigneid == attacker.id)
)
if (emp) {
return foundry.utils.duplicate(emp);
return duplicate(emp);
}
return undefined;
}
@ -267,7 +267,7 @@ export class RdDEmpoignade {
return
}
empoignade = foundry.utils.duplicate(empoignade)
empoignade = duplicate(empoignade)
let defenderRoll = {
mode, attacker, defender, empoignade, attackerRoll,
diffLibre: attackerRoll.diffLibre,

View File

@ -24,7 +24,7 @@ export class RdDPossession {
if (!poss) {
poss = defender.items.find(poss => poss.type == TYPES.possession && poss.system.victime.actorid == defender.id);
}
return poss && foundry.utils.duplicate(poss) || undefined;
return poss && duplicate(poss) || undefined;
}
/* -------------------------------------------- */
@ -52,7 +52,7 @@ export class RdDPossession {
/* -------------------------------------------- */
static async onConjurerPossession(attacker, possession) {
possession = foundry.utils.duplicate(possession);
possession = duplicate(possession);
RdDPossession.$updateEtatPossession(possession)
const defender = game.actors.get(possession.system.entite.actorid);
@ -80,7 +80,7 @@ export class RdDPossession {
ui.notifications.warn("Une erreur s'est produite : Aucune possession trouvée !!")
return
}
possession = foundry.utils.duplicate(possession)
possession = duplicate(possession)
// Update for draconic roll
let rollData = {
mode: "defense",

View File

@ -114,7 +114,7 @@ export class RdDResolutionTable {
/* -------------------------------------------- */
static async roll(caracValue, finalLevel, rollData = {}) {
let chances = foundry.utils.duplicate(this.computeChances(caracValue, finalLevel));
let chances = duplicate(this.computeChances(caracValue, finalLevel));
this._updateChancesWithBonus(chances, rollData.bonus, finalLevel);
this._updateChancesFactor(chances, rollData.diviseurSignificative);
chances.showDice = rollData.showDice;
@ -158,7 +158,7 @@ export class RdDResolutionTable {
static _updateChancesFactor(chances, diviseur) {
if (chances.level > -11 && diviseur && diviseur > 1) {
let newScore = Math.floor(chances.score / diviseur);
foundry.utils.mergeObject(chances, this._computeCell(undefined, newScore), { overwrite: true });
mergeObject(chances, this._computeCell(undefined, newScore), { overwrite: true });
}
}
@ -166,27 +166,27 @@ export class RdDResolutionTable {
static _updateChancesWithBonus(chances, bonus, finalLevel) {
if (bonus && finalLevel > -11) {
let newScore = Number(chances.score) + bonus;
foundry.utils.mergeObject(chances, this._computeCell(undefined, newScore), { overwrite: true });
mergeObject(chances, this._computeCell(undefined, newScore), { overwrite: true });
}
}
/* -------------------------------------------- */
static significativeRequise(chances) {
chances.roll = Math.floor(chances.score / 2);
foundry.utils.mergeObject(chances, reussites.find(x => x.code == 'sign'), { overwrite: true });
mergeObject(chances, reussites.find(x => x.code == 'sign'), { overwrite: true });
}
/* -------------------------------------------- */
static succesRequis(chances) {
chances.roll = chances.score;
foundry.utils.mergeObject(chances, reussites.find(x => x.code == 'norm'), { overwrite: true });
mergeObject(chances, reussites.find(x => x.code == 'norm'), { overwrite: true });
}
/* -------------------------------------------- */
static async rollChances(chances, diviseur, forceDiceResult = -1) {
chances.forceDiceResult = forceDiceResult <= 0 || forceDiceResult > 100 ? undefined : { total: forceDiceResult };
chances.roll = await RdDDice.rollTotal("1d100", chances);
foundry.utils.mergeObject(chances, this.computeReussite(chances, chances.roll, diviseur), { overwrite: true });
mergeObject(chances, this.computeReussite(chances, chances.roll, diviseur), { overwrite: true });
return chances;
}

View File

@ -38,7 +38,7 @@ export class RdDRollResolutionTable extends Dialog {
diffLibre: 0,
use: { conditions:true, libre:true }
}
foundry.utils.mergeObject(rollData, defRollData, { overwrite: false });
mergeObject(rollData, defRollData, { overwrite: false });
for (let i = 1; i < 21; i++) {
const key = `${i}`;
rollData.carac[key] = { type: "number", value: i, label: key }

View File

@ -65,7 +65,7 @@ export class RdDRoll extends Dialog {
defaultRollData.carac["reve-actuel"] = actor.system.reve.reve
}
foundry.utils.mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
mergeObject(rollData, defaultRollData, { recursive: true, overwrite: false });
if (rollData.forceCarac) {
rollData.carac = rollData.forceCarac;
}

View File

@ -16,7 +16,7 @@ export class RdDSheetUtility {
isObserver: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OBSERVER,
isOwner: userRightLevel >= CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER
}
foundry.utils.mergeObject(options, newOptions);
mergeObject(options, newOptions);
return options;
}
@ -76,7 +76,7 @@ export class RdDSheetUtility {
static async _onSplitItem(item, split, actor) {
if (split >= 1 && split < item.system.quantite) {
await item.diminuerQuantite(split);
const splitItem = foundry.utils.duplicate(item);
const splitItem = duplicate(item);
// todo: ajouter dans le même conteneur?
splitItem.system.quantite = split;
await actor.createEmbeddedDocuments('Item', [splitItem])

View File

@ -70,7 +70,7 @@ export class RdDTMRDialog extends Dialog {
'z-index': 40
}
super(dialogConf, dialogOptions);
this.tmrdata = foundry.utils.duplicate(tmrData);
this.tmrdata = duplicate(tmrData);
this.actor = actor;
this.actor.tmrApp = this; // reference this app in the actor structure
this.viewOnly = tmrData.mode == "visu"
@ -407,7 +407,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
$marquerCasesTMR(listCoordTMR) {
this.currentRencontre.locList = foundry.utils.duplicate(listCoordTMR); // And track of allowed location
this.currentRencontre.locList = duplicate(listCoordTMR); // And track of allowed location
this.currentRencontre.graphics = listCoordTMR.map(coordTMR => this.pixiTMR.addMarkTMR(coordTMR))
}
@ -536,7 +536,7 @@ export class RdDTMRDialog extends Dialog {
/* -------------------------------------------- */
_rollPresentCite(rencData) {
let rolled = RdDResolutionTable.computeChances(rencData.reve, 0);
foundry.utils.mergeObject(rolled, { caracValue: rencData.reve, finalLevel: 0, roll: rolled.score });
mergeObject(rolled, { caracValue: rencData.reve, finalLevel: 0, roll: rolled.score });
RdDResolutionTable.succesRequis(rolled);
return rolled;
}
@ -679,7 +679,7 @@ export class RdDTMRDialog extends Dialog {
if (this.isCaseHumide(tmr)) {
let rollData = {
actor: this.actor,
competence: foundry.utils.duplicate(this.actor.getBestDraconic()),
competence: duplicate(this.actor.getBestDraconic()),
tmr: tmr,
canClose: false,
diffLibre: -7,
@ -804,7 +804,7 @@ export class RdDTMRDialog extends Dialog {
async _conquerir(tmr, options) {
let rollData = {
actor: this.actor,
competence: foundry.utils.duplicate(this.actor.getBestDraconic()),
competence: duplicate(this.actor.getBestDraconic()),
tmr: tmr,
canClose: options.canClose ?? false,
diffLibre: options.difficulte ?? -7,

View File

@ -31,7 +31,7 @@ function _buildAllSegmentsFatigue(max) {
const cycle = [5, 2, 4, 1, 3, 0];
const fatigue = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
for (let i = 0; i <= max; i++) {
const ligneFatigue = foundry.utils.duplicate(fatigue[i]);
const ligneFatigue = duplicate(fatigue[i]);
const caseIncrementee = cycle[i % 6];
ligneFatigue[caseIncrementee]++;
ligneFatigue[caseIncrementee + 6]++;
@ -45,7 +45,7 @@ function _buildAllSegmentsFatigue(max) {
function _cumulSegmentsFatigue(matrix) {
let cumulMatrix = [];
for (let line of matrix) {
let cumul = foundry.utils.duplicate(line);
let cumul = duplicate(line);
for (let i = 1; i < 12; i++) {
cumul[i] += cumul[i - 1];
@ -607,10 +607,10 @@ export class RdDUtility {
for (let encaissement of table) {
if ((encaissement.minimum === undefined || encaissement.minimum <= degats)
&& (encaissement.maximum === undefined || degats <= encaissement.maximum)) {
return foundry.utils.duplicate(encaissement);
return duplicate(encaissement);
}
}
return foundry.utils.duplicate(table[0]);
return duplicate(table[0]);
}
/* -------------------------------------------- */

View File

@ -166,7 +166,7 @@ export class RollDataAjustements {
/* -------------------------------------------- */
static calcul(rollData, actor) {
// s'assurer de la correction des infos rollData
foundry.utils.mergeObject(rollData, { ajustements: {}, use: {} }, { overwrite: false })
mergeObject(rollData, { ajustements: {}, use: {} }, { overwrite: false })
for (var key in referenceAjustements) {
const reference = referenceAjustements[key];

View File

@ -71,7 +71,7 @@ export class ReglesOptionnelles extends FormApplication {
static get defaultOptions() {
const options = super.defaultOptions;
foundry.utils.mergeObject(options, {
mergeObject(options, {
id: "regles-optionnelles",
template: "systems/foundryvtt-reve-de-dragon/templates/settings/regles-optionnelles.html",
height: 650,
@ -86,7 +86,7 @@ export class ReglesOptionnelles extends FormApplication {
getData() {
let formData = super.getData();
const regles = listeReglesOptionnelles.filter(it => game.user.isGM || it.scope == "client").map(it => {
it = foundry.utils.duplicate(it);
it = duplicate(it);
it.id = ReglesOptionnelles._getIdRegle(it.name);
it.active = ReglesOptionnelles.isSet(it.name);
return it;

View File

@ -94,7 +94,7 @@ export class StatusEffects extends FormApplication {
static prepareActiveEffect(effectId) {
let status = rddStatusEffects.find(it => it.id == effectId)
if (status) {
status = foundry.utils.duplicate(status)
status = duplicate(status)
status.statuses = [effectId]
}
return status;
@ -125,7 +125,7 @@ export class StatusEffects extends FormApplication {
getData() {
const used = StatusEffects._getUseStatusEffects();
let formData = super.getData();
formData.effects = foundry.utils.duplicate(CONFIG.RDD.allEffects);
formData.effects = duplicate(CONFIG.RDD.allEffects);
formData.effects.forEach(it => it.active = used.includes(it.id))
return formData;
}

View File

@ -27,7 +27,7 @@ export class SystemCompendiums extends FormApplication {
static init() {
Object.keys(CONFIGURABLE_COMPENDIUMS).forEach(compendium => {
const definition = CONFIGURABLE_COMPENDIUMS[compendium];
foundry.utils.mergeObject(definition, {
mergeObject(definition, {
compendium: compendium,
default: SystemCompendiums._getDefaultCompendium(compendium),
setting: SystemCompendiums._getSettingCompendium(compendium)
@ -138,7 +138,7 @@ export class SystemCompendiums extends FormApplication {
static get defaultOptions() {
const options = super.defaultOptions;
foundry.utils.mergeObject(options, {
mergeObject(options, {
id: "system-compendiums",
template: "systems/foundryvtt-reve-de-dragon/templates/settings/system-compendiums.html",
height: 'fit-content',
@ -152,7 +152,7 @@ export class SystemCompendiums extends FormApplication {
getData() {
const systemCompendiums = Object.values(CONFIGURABLE_COMPENDIUMS)
.map(it => foundry.utils.mergeObject(it, { value: SystemCompendiums.getCompendium(it.compendium) }));
.map(it => mergeObject(it, { value: SystemCompendiums.getCompendium(it.compendium) }));
const availableCompendiums = game.packs.map(pack => {
return {
name: pack.collection,
@ -160,7 +160,7 @@ export class SystemCompendiums extends FormApplication {
type: pack.metadata.type
}
});
return foundry.utils.mergeObject(super.getData(), {
return mergeObject(super.getData(), {
systemCompendiums: systemCompendiums,
availableCompendiums: availableCompendiums
});

View File

@ -17,7 +17,7 @@ export class AppAstrologie extends Application {
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
return mergeObject(super.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/sommeil/app-astrologie.hbs",
title: "Astrologie",
width: 'fit-content',
@ -37,7 +37,7 @@ export class AppAstrologie extends Application {
getData(options) {
this.appData = super.getData(options)
const calendrier = game.system.rdd.calendrier;
foundry.utils.mergeObject(this.appData, {
mergeObject(this.appData, {
isGM: game.user.isGM,
isActor: this.actor != undefined,
calendrier: calendrier.getTimestamp().toCalendrier(),
@ -104,7 +104,7 @@ export class AppAstrologie extends Application {
}
getDetailNombreAstral(nombreAstral) {
const detail = foundry.utils.duplicate(nombreAstral);
const detail = duplicate(nombreAstral);
const timestamp = new RdDTimestamp({ indexDate: nombreAstral.index });
detail.date = { mois: timestamp.mois, jour: timestamp.jour + 1 };
detail.valeursFausses.forEach(fausse => fausse.actorName = game.actors.get(fausse.actorId).name ?? "Inconnu");

View File

@ -61,7 +61,7 @@ export class RdDCalendrierEditor extends Dialog {
/* -------------------------------------------- */
updateData(calendrierData) {
this.calendrierData = foundry.utils.duplicate(calendrierData);
this.calendrierData = duplicate(calendrierData);
}
}

View File

@ -35,7 +35,7 @@ export class RdDCalendrier extends Application {
}
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
return mergeObject(super.defaultOptions, {
title: "Calendrier",
template: TEMPLATE_CALENDRIER,
classes: ["calendar"],
@ -120,7 +120,7 @@ export class RdDCalendrier extends Application {
/* -------------------------------------------- */
fillCalendrierData(formData = {}) {
foundry.utils.mergeObject(formData, this.timestamp.toCalendrier());
mergeObject(formData, this.timestamp.toCalendrier());
formData.isGM = game.user.isGM;
formData.heures = RdDTimestamp.definitions()
formData.horlogeAnalogique = this.horlogeAnalogique;

View File

@ -202,7 +202,7 @@ export class RdDTimestamp {
}
static setWorldTime(timestamp) {
game.settings.set(SYSTEM_RDD, WORLD_TIMESTAMP_SETTING, foundry.utils.duplicate(timestamp));
game.settings.set(SYSTEM_RDD, WORLD_TIMESTAMP_SETTING, duplicate(timestamp));
}
/** construit un RdDTimestamp à partir de l'année/mois/jour/heure?/minute? */

View File

@ -117,7 +117,7 @@ function $loadFilters(parameters) {
export class FenetreRechercheTirage extends Application {
static get defaultOptions() {
return foundry.utils.mergeObject(super.defaultOptions, {
return mergeObject(super.defaultOptions, {
template: "systems/foundryvtt-reve-de-dragon/templates/tirage/fenetre-recherche-tirage.hbs",
title: `Recherches et tirages`,
width: 600,
@ -133,7 +133,7 @@ export class FenetreRechercheTirage extends Application {
const parameters = {
milieux: milieux,
filterMilieux: $filterMilieux(milieux),
filterGroups: foundry.utils.duplicate(FILTER_GROUPS).filter(it => it.group),
filterGroups: duplicate(FILTER_GROUPS).filter(it => it.group),
}
const options = {}
$loadFilters(parameters);
@ -147,7 +147,7 @@ export class FenetreRechercheTirage extends Application {
}
async getData() {
return foundry.utils.mergeObject(await super.getData(), this.parameters)
return mergeObject(await super.getData(), this.parameters)
}
_canDragStart() { return true; }
@ -294,7 +294,7 @@ class FenetreRechercheConfiguration extends Dialog {
static async create() {
const configuration = {
compendiums: game.packs.filter(it => it.metadata.type == 'Item').map(it => it.metadata)
.map(it => foundry.utils.mergeObject({ selected: game.system.rdd.environnement.compendiums.includes(it.id) }, it))
.map(it => mergeObject({ selected: game.system.rdd.environnement.compendiums.includes(it.id) }, it))
}
const html = await renderTemplate("systems/foundryvtt-reve-de-dragon/templates/tirage/fenetre-recherche-configuration.hbs", configuration);
new FenetreRechercheConfiguration(html).render(true);

View File

@ -107,7 +107,7 @@ export class EffetsRencontre {
}
static rdd_part_tete = async (dialog, context) => {
foundry.utils.mergeObject(context, {
mergeObject(context, {
tete: context.rolled.isPart,
poesie: await Poetique.getExtrait()
})
@ -118,7 +118,7 @@ export class EffetsRencontre {
}
static rdd_echec_queue = async (dialog, context) => {
foundry.utils.mergeObject(context, {
mergeObject(context, {
queues: [await context.actor.ajouterQueue()],
poesie: await Poetique.getExtrait()
})

View File

@ -147,7 +147,7 @@ export class DialogFatigueVoyage extends Dialog {
ChatMessage.create({
whisper: ChatUtility.getWhisperRecipientsAndGMs(it.actor.name),
content: await renderTemplate(
'systems/foundryvtt-reve-de-dragon/templates/voyage/chat-fatigue_voyage.hbs', foundry.utils.mergeObject(it,
'systems/foundryvtt-reve-de-dragon/templates/voyage/chat-fatigue_voyage.hbs', mergeObject(it,
{
parameters: this.parameters,
fatigueBase: fatigueBase,

View File

@ -528,10 +528,8 @@
}
],
"socket": true,
"grid": {
"distance": 1,
"units": "m"
},
"gridDistance": 1,
"gridUnits": "m",
"primaryTokenAttribute": "sante.vie",
"secondaryTokenAttribute": "sante.endurance",
"media": [