Big WIP...
This commit is contained in:
parent
698ff79d41
commit
255c0a77b4
@ -36,12 +36,12 @@ export class RdDActorEntiteSheet extends ActorSheet {
|
|||||||
editable: this.isEditable,
|
editable: this.isEditable,
|
||||||
cssClass: this.isEditable ? "editable" : "locked",
|
cssClass: this.isEditable ? "editable" : "locked",
|
||||||
data: foundry.utils.deepClone(this.actor.system),
|
data: foundry.utils.deepClone(this.actor.system),
|
||||||
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
|
effects: this.object.effects.map(e => foundry.utils.deepClone(e)),
|
||||||
// items: items,
|
// items: items,
|
||||||
limited: this.object.limited,
|
limited: this.object.limited,
|
||||||
options: this.options,
|
options: this.options,
|
||||||
owner: this.document.isOwner,
|
owner: this.document.isOwner,
|
||||||
itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i.system))),
|
itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i))),
|
||||||
};
|
};
|
||||||
|
|
||||||
formData.options.isGM = game.user.isGM;
|
formData.options.isGM = game.user.isGM;
|
||||||
|
@ -93,7 +93,6 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac);
|
RdDItemArme.ajoutCorpsACorps(formData.combat, formData.competences, formData.data.carac);
|
||||||
formData.esquives = this.actor.getCompetences("Esquive").map(i => foundry.utils.deepClone(i.system))
|
formData.esquives = this.actor.getCompetences("Esquive").map(i => foundry.utils.deepClone(i.system))
|
||||||
formData.combat = RdDCombatManager.finalizeArmeList(formData.combat, formData.competences, formData.data.carac);
|
formData.combat = RdDCombatManager.finalizeArmeList(formData.combat, formData.competences, formData.data.carac);
|
||||||
console.log("COMBAT STUFF", formData.combat, formData.armes)
|
|
||||||
this.armesList = formData.combat;
|
this.armesList = formData.combat;
|
||||||
|
|
||||||
// Common data
|
// Common data
|
||||||
@ -382,12 +381,12 @@ export class RdDActorSheet extends ActorSheet {
|
|||||||
if (this.options.editCaracComp) {
|
if (this.options.editCaracComp) {
|
||||||
// On carac change
|
// On carac change
|
||||||
html.find('.carac-value').change(async event => {
|
html.find('.carac-value').change(async event => {
|
||||||
let caracName = event.currentTarget.name.replace(".value", "").replace("data.carac.", "");
|
let caracName = event.currentTarget.name.replace(".value", "").replace("system.carac.", "");
|
||||||
//console.log("Value changed :", event, caracName);
|
//console.log("Value changed :", event, caracName);
|
||||||
this.actor.updateCarac(caracName, parseInt(event.target.value));
|
this.actor.updateCarac(caracName, parseInt(event.target.value));
|
||||||
});
|
});
|
||||||
html.find('.carac-xp').change(async event => {
|
html.find('.carac-xp').change(async event => {
|
||||||
let caracName = event.currentTarget.name.replace(".xp", "").replace("data.carac.", "");
|
let caracName = event.currentTarget.name.replace(".xp", "").replace("system.carac.", "");
|
||||||
//console.log("Value changed :", event, caracName);
|
//console.log("Value changed :", event, caracName);
|
||||||
this.actor.updateCaracXP(caracName, parseInt(event.target.value));
|
this.actor.updateCaracXP(caracName, parseInt(event.target.value));
|
||||||
});
|
});
|
||||||
|
@ -37,11 +37,11 @@ export class RdDActorVehiculeSheet extends ActorSheet {
|
|||||||
editable: this.isEditable,
|
editable: this.isEditable,
|
||||||
cssClass: this.isEditable ? "editable" : "locked",
|
cssClass: this.isEditable ? "editable" : "locked",
|
||||||
data: foundry.utils.deepClone(this.object.system),
|
data: foundry.utils.deepClone(this.object.system),
|
||||||
effects: this.object.effects.map(e => foundry.utils.deepClone(e.data)),
|
effects: this.object.effects.map(e => foundry.utils.deepClone(e)),
|
||||||
limited: this.object.limited,
|
limited: this.object.limited,
|
||||||
options: this.options,
|
options: this.options,
|
||||||
owner: this.document.isOwner,
|
owner: this.document.isOwner,
|
||||||
itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i.data))),
|
itemsByType: Misc.classify(this.object.items.map(i => foundry.utils.deepClone(i))),
|
||||||
};
|
};
|
||||||
|
|
||||||
RdDUtility.filterItemsPerTypeForSheet(formData);
|
RdDUtility.filterItemsPerTypeForSheet(formData);
|
||||||
|
100
module/actor.js
100
module/actor.js
@ -415,7 +415,7 @@ export class RdDActor extends Actor {
|
|||||||
);
|
);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
reserve.list.splice(index, 1);
|
reserve.list.splice(index, 1);
|
||||||
await this.update({ "data.reve.reserve": reserve });
|
await this.update({ "system.reve.reserve": reserve });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ export class RdDActor extends Actor {
|
|||||||
await this._recupererBlessures(message, "legere", blessures.legeres.liste.filter(b => b.active), []);
|
await this._recupererBlessures(message, "legere", blessures.legeres.liste.filter(b => b.active), []);
|
||||||
await this._recupererBlessures(message, "grave", blessures.graves.liste.filter(b => b.active), blessures.legeres.liste);
|
await this._recupererBlessures(message, "grave", blessures.graves.liste.filter(b => b.active), blessures.legeres.liste);
|
||||||
await this._recupererBlessures(message, "critique", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste);
|
await this._recupererBlessures(message, "critique", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste);
|
||||||
await this.update({ "data.blessures": blessures });
|
await this.update({ "system.blessures": blessures });
|
||||||
await this._recupererVie(message);
|
await this._recupererVie(message);
|
||||||
|
|
||||||
const moralActuel = Misc.toInt(this.system.compteurs.moral.value);
|
const moralActuel = Misc.toInt(this.system.compteurs.moral.value);
|
||||||
@ -472,7 +472,7 @@ export class RdDActor extends Actor {
|
|||||||
await this._recupererBlessures(message, "legere", blessures.legeres.liste.filter(b => b.active), []);
|
await this._recupererBlessures(message, "legere", blessures.legeres.liste.filter(b => b.active), []);
|
||||||
await this._recupererBlessures(message, "grave", blessures.graves.liste.filter(b => b.active), blessures.legeres.liste);
|
await this._recupererBlessures(message, "grave", blessures.graves.liste.filter(b => b.active), blessures.legeres.liste);
|
||||||
await this._recupererBlessures(message, "critique", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste);
|
await this._recupererBlessures(message, "critique", blessures.critiques.liste.filter(b => b.active), blessures.graves.liste);
|
||||||
await this.update({ "data.blessures": blessures });
|
await this.update({ "system.blessures": blessures });
|
||||||
await this._recupererVie(message);
|
await this._recupererVie(message);
|
||||||
await this._jetDeMoralChateauDormant(message);
|
await this._jetDeMoralChateauDormant(message);
|
||||||
await this._recupereChance();
|
await this._recupereChance();
|
||||||
@ -607,7 +607,7 @@ export class RdDActor extends Actor {
|
|||||||
this._supprimerBlessure(blessure);
|
this._supprimerBlessure(blessure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.update({ "data.blessures": blessures });
|
await this.update({ "system.blessures": blessures });
|
||||||
}
|
}
|
||||||
if (this.isPersonnage()) {
|
if (this.isPersonnage()) {
|
||||||
await this.setEthylisme(1);
|
await this.setEthylisme(1);
|
||||||
@ -676,7 +676,7 @@ export class RdDActor extends Actor {
|
|||||||
message.content += `Vous dégrisez un peu (${RdDUtility.getNomEthylisme(ethylisme.value)}). `;
|
message.content += `Vous dégrisez un peu (${RdDUtility.getNomEthylisme(ethylisme.value)}). `;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.update({ "data.compteurs.ethylisme": ethylisme });
|
await this.update({ "system.compteurs.ethylisme": ethylisme });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -697,7 +697,7 @@ export class RdDActor extends Actor {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue));
|
fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue));
|
||||||
await this.update({ "data.sante.fatigue.value": fatigue });
|
await this.update({ "system.sante.fatigue.value": fatigue });
|
||||||
if (fatigue == 0) {
|
if (fatigue == 0) {
|
||||||
message.content += "Vous êtes complêtement reposé. ";
|
message.content += "Vous êtes complêtement reposé. ";
|
||||||
}
|
}
|
||||||
@ -835,7 +835,7 @@ export class RdDActor extends Actor {
|
|||||||
async sortMisEnReserve(rollData, sort) {
|
async sortMisEnReserve(rollData, sort) {
|
||||||
let reserve = duplicate(this.system.reve.reserve.list);
|
let reserve = duplicate(this.system.reve.reserve.list);
|
||||||
reserve.push({ coord: rollData.tmr.coord, sort: sort, draconic: duplicate(rollData.competence) });
|
reserve.push({ coord: rollData.tmr.coord, sort: sort, draconic: duplicate(rollData.competence) });
|
||||||
await this.update({ "data.reve.reserve.list": reserve });
|
await this.update({ "system.reve.reserve.list": reserve });
|
||||||
this.currentTMR.updateTokens();
|
this.currentTMR.updateTokens();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -886,7 +886,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
carac.xp = xp;
|
carac.xp = xp;
|
||||||
carac.value = value;
|
carac.value = value;
|
||||||
await this.update({ [`data.carac.${caracName}`]: carac });
|
await this.update({ [`system.carac.${caracName}`]: carac });
|
||||||
this.updateExperienceLog("Carac +", xp, caracName + " passée à " + value);
|
this.updateExperienceLog("Carac +", xp, caracName + " passée à " + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -902,8 +902,8 @@ export class RdDActor extends Actor {
|
|||||||
niveau++;
|
niveau++;
|
||||||
}
|
}
|
||||||
await competence.update({
|
await competence.update({
|
||||||
"data.xp": xp,
|
"system.xp": xp,
|
||||||
"data.niveau": niveau,
|
"system.niveau": niveau,
|
||||||
});
|
});
|
||||||
this.updateExperienceLog("Compétence +", xp, competence.name + " passée à " + niveau);
|
this.updateExperienceLog("Compétence +", xp, competence.name + " passée à " + niveau);
|
||||||
}
|
}
|
||||||
@ -944,11 +944,11 @@ export class RdDActor extends Actor {
|
|||||||
if (competence) {
|
if (competence) {
|
||||||
const update = { _id: competence.id }
|
const update = { _id: competence.id }
|
||||||
if (fieldName == "niveau")
|
if (fieldName == "niveau")
|
||||||
update['data.niveau'] = compValue;
|
update['system.niveau'] = compValue;
|
||||||
else if (fieldName == "dommages")
|
else if (fieldName == "dommages")
|
||||||
update['data.dommages'] = compValue;
|
update['system.dommages'] = compValue;
|
||||||
else
|
else
|
||||||
update['data.carac_value'] = compValue;
|
update['system.carac_value'] = compValue;
|
||||||
await this.updateEmbeddedDocuments('Item', [update]); // updates one EmbeddedEntity
|
await this.updateEmbeddedDocuments('Item', [update]); // updates one EmbeddedEntity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -973,7 +973,7 @@ export class RdDActor extends Actor {
|
|||||||
content: message
|
content: message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const update = { _id: competence.id, 'data.niveau': nouveauNiveau };
|
const update = { _id: competence.id, 'system.niveau': nouveauNiveau };
|
||||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||||
} else {
|
} else {
|
||||||
console.log("Competence not found", idOrName);
|
console.log("Competence not found", idOrName);
|
||||||
@ -1000,7 +1000,7 @@ export class RdDActor extends Actor {
|
|||||||
let competence = this.getCompetence(idOrName);
|
let competence = this.getCompetence(idOrName);
|
||||||
if (competence) {
|
if (competence) {
|
||||||
if (isNaN(compValue) || typeof (compValue) != 'number') compValue = 0;
|
if (isNaN(compValue) || typeof (compValue) != 'number') compValue = 0;
|
||||||
const update = { _id: competence.id, 'data.xp_sort': compValue };
|
const update = { _id: competence.id, 'system.xp_sort': compValue };
|
||||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||||
this.updateExperienceLog("XP Sort", compValue, "XP modifié en sort de " + competence.name);
|
this.updateExperienceLog("XP Sort", compValue, "XP modifié en sort de " + competence.name);
|
||||||
} else {
|
} else {
|
||||||
@ -1013,7 +1013,7 @@ export class RdDActor extends Actor {
|
|||||||
let competence = this.getCompetence(idOrName);
|
let competence = this.getCompetence(idOrName);
|
||||||
if (competence) {
|
if (competence) {
|
||||||
compValue = compValue ?? 0;
|
compValue = compValue ?? 0;
|
||||||
const update = { _id: competence.id, 'data.niveau_archetype': compValue };
|
const update = { _id: competence.id, 'system.niveau_archetype': compValue };
|
||||||
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
await this.updateEmbeddedDocuments('Item', [update]); // Updates one EmbeddedEntity
|
||||||
} else {
|
} else {
|
||||||
console.log("Competence not found", idOrName);
|
console.log("Competence not found", idOrName);
|
||||||
@ -1029,20 +1029,20 @@ export class RdDActor extends Actor {
|
|||||||
mode: Misc.upperFirst(modeXP), valeur: valeurXP, raison: Misc.upperFirst(raisonXP),
|
mode: Misc.upperFirst(modeXP), valeur: valeurXP, raison: Misc.upperFirst(raisonXP),
|
||||||
daterdd: game.system.rdd.calendrier.getDateFromIndex(), datereel: `${d.getDate()}/${d.getMonth() + 1}/${d.getFullYear()}`
|
daterdd: game.system.rdd.calendrier.getDateFromIndex(), datereel: `${d.getDate()}/${d.getMonth() + 1}/${d.getFullYear()}`
|
||||||
});
|
});
|
||||||
await this.update({ [`data.experiencelog`]: expLog });
|
await this.update({ [`system.experiencelog`]: expLog });
|
||||||
console.log("Add XP log", expLog);
|
console.log("Add XP log", expLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateCompteurValue(fieldName, fieldValue, raison = 'Inconnue') {
|
async updateCompteurValue(fieldName, fieldValue, raison = 'Inconnue') {
|
||||||
await this.update({ [`data.compteurs.${fieldName}.value`]: fieldValue });
|
await this.update({ [`system.compteurs.${fieldName}.value`]: fieldValue });
|
||||||
await this.addStressExperienceLog(fieldName, fieldValue, 'forcé: ' + raison);
|
await this.addStressExperienceLog(fieldName, fieldValue, 'forcé: ' + raison);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async addCompteurValue(fieldName, fieldValue, raison = 'Inconnue') {
|
async addCompteurValue(fieldName, fieldValue, raison = 'Inconnue') {
|
||||||
let oldValue = this.system.compteurs[fieldName].value;
|
let oldValue = this.system.compteurs[fieldName].value;
|
||||||
await this.update({ [`data.compteurs.${fieldName}.value`]: Number(oldValue) + Number(fieldValue) });
|
await this.update({ [`system.compteurs.${fieldName}.value`]: Number(oldValue) + Number(fieldValue) });
|
||||||
await this.addStressExperienceLog(fieldName, fieldValue, raison);
|
await this.addStressExperienceLog(fieldName, fieldValue, raison);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1069,7 +1069,7 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async updateAttributeValue(fieldName, fieldValue) {
|
async updateAttributeValue(fieldName, fieldValue) {
|
||||||
await this.update({ [`data.attributs.${fieldName}.value`]: fieldValue });
|
await this.update({ [`system.attributs.${fieldName}.value`]: fieldValue });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1261,7 +1261,7 @@ export class RdDActor extends Actor {
|
|||||||
console.log('New conteneur filling!', newConteneur, newItemId, item);
|
console.log('New conteneur filling!', newConteneur, newItemId, item);
|
||||||
let contenu = duplicate(this.system.contenu);
|
let contenu = duplicate(this.system.contenu);
|
||||||
contenu.push(newItemId);
|
contenu.push(newItemId);
|
||||||
await this.updateEmbeddedDocuments('Item', [{ _id: newConteneurId, 'data.contenu': contenu }]);
|
await this.updateEmbeddedDocuments('Item', [{ _id: newConteneurId, 'system.contenu': contenu }]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (let item of itemsList) {
|
for (let item of itemsList) {
|
||||||
@ -1389,7 +1389,7 @@ export class RdDActor extends Actor {
|
|||||||
computeEtatGeneral() {
|
computeEtatGeneral() {
|
||||||
// Pas d'état général pour les entités forçage à 0
|
// Pas d'état général pour les entités forçage à 0
|
||||||
if (this.type == 'entite') {
|
if (this.type == 'entite') {
|
||||||
this.compteurs.etat.value = 0;
|
this.system.compteurs.etat.value = 0;
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Pour les autres
|
// Pour les autres
|
||||||
@ -1416,7 +1416,7 @@ export class RdDActor extends Actor {
|
|||||||
refoulement = 0;
|
refoulement = 0;
|
||||||
await this.ajouterSouffle({ chat: true });
|
await this.ajouterSouffle({ chat: true });
|
||||||
}
|
}
|
||||||
await this.update({ "data.reve.refoulement.value": refoulement });
|
await this.update({ "system.reve.refoulement.value": refoulement });
|
||||||
return refoulement == 0 ? "souffle" : "none";
|
return refoulement == 0 ? "souffle" : "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1439,7 +1439,7 @@ export class RdDActor extends Actor {
|
|||||||
let queue;
|
let queue;
|
||||||
if (this.system.reve.reve.thanatosused) {
|
if (this.system.reve.reve.thanatosused) {
|
||||||
queue = await RdDRollTables.getOmbre();
|
queue = await RdDRollTables.getOmbre();
|
||||||
await this.update({ "data.reve.reve.thanatosused": false });
|
await this.update({ "system.reve.reve.thanatosused": false });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
queue = await RdDRollTables.getQueue();
|
queue = await RdDRollTables.getQueue();
|
||||||
@ -1456,10 +1456,10 @@ export class RdDActor extends Actor {
|
|||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
async cacheTMR() {
|
async cacheTMR() {
|
||||||
await this.update({ 'data.reve.tmrpos.cache': true });
|
await this.update({ 'system.reve.tmrpos.cache': true });
|
||||||
}
|
}
|
||||||
async montreTMR() {
|
async montreTMR() {
|
||||||
await this.update({ 'data.reve.tmrpos.cache': false });
|
await this.update({ 'system.reve.tmrpos.cache': false });
|
||||||
}
|
}
|
||||||
isTMRCache() {
|
isTMRCache() {
|
||||||
return this.system.reve.tmrpos.cache;
|
return this.system.reve.tmrpos.cache;
|
||||||
@ -1517,7 +1517,7 @@ export class RdDActor extends Actor {
|
|||||||
let rencontres = this.getTMRRencontres();
|
let rencontres = this.getTMRRencontres();
|
||||||
let newRencontres = rencontres.filter(it => it.coord != this.getDemiReve());
|
let newRencontres = rencontres.filter(it => it.coord != this.getDemiReve());
|
||||||
if (newRencontres.length != rencontres.length) {
|
if (newRencontres.length != rencontres.length) {
|
||||||
await this.update({ "data.reve.rencontre.list": newRencontres });
|
await this.update({ "system.reve.rencontre.list": newRencontres });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1527,7 +1527,7 @@ export class RdDActor extends Actor {
|
|||||||
let newRencontres = rencontres.filter(it => it.coord != this.getDemiReve());
|
let newRencontres = rencontres.filter(it => it.coord != this.getDemiReve());
|
||||||
if (newRencontres.length == rencontres.length) {
|
if (newRencontres.length == rencontres.length) {
|
||||||
newRencontres.push(currentRencontre);
|
newRencontres.push(currentRencontre);
|
||||||
await this.update({ "data.reve.rencontre.list": newRencontres });
|
await this.update({ "system.reve.rencontre.list": newRencontres });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1794,7 +1794,7 @@ export class RdDActor extends Actor {
|
|||||||
if (!blessure.active) {
|
if (!blessure.active) {
|
||||||
this._supprimerBlessure(blessure);
|
this._supprimerBlessure(blessure);
|
||||||
}
|
}
|
||||||
await this.update({ 'data.blessures': listBlessures });
|
await this.update({ 'system.blessures': listBlessures });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1807,7 +1807,7 @@ export class RdDActor extends Actor {
|
|||||||
blessure.soins_complets = pcomplets;
|
blessure.soins_complets = pcomplets;
|
||||||
blessure.jours = jours;
|
blessure.jours = jours;
|
||||||
blessure.loc = loc;
|
blessure.loc = loc;
|
||||||
await this.update({ 'data.blessures': listBlessures });
|
await this.update({ 'system.blessures': listBlessures });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -1876,7 +1876,7 @@ export class RdDActor extends Actor {
|
|||||||
if (degre == 1) {
|
if (degre == 1) {
|
||||||
ethylisme.jet_moral = false;
|
ethylisme.jet_moral = false;
|
||||||
}
|
}
|
||||||
await this.update({ "data.compteurs.ethylisme": ethylisme });
|
await this.update({ "system.compteurs.ethylisme": ethylisme });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -2404,7 +2404,7 @@ export class RdDActor extends Actor {
|
|||||||
rollData.depenseReve = Number(selectedSort.system.ptreve_reel);
|
rollData.depenseReve = Number(selectedSort.system.ptreve_reel);
|
||||||
|
|
||||||
if (rollData.competence.name.includes('Thanatos')) { // Si Thanatos
|
if (rollData.competence.name.includes('Thanatos')) { // Si Thanatos
|
||||||
await this.update({ "data.reve.reve.thanatosused": true });
|
await this.update({ "system.reve.reve.thanatosused": true });
|
||||||
}
|
}
|
||||||
let reveActuel = this.system.reve.reve.value;
|
let reveActuel = this.system.reve.reve.value;
|
||||||
if (rolled.isSuccess) { // Réussite du sort !
|
if (rolled.isSuccess) { // Réussite du sort !
|
||||||
@ -2437,7 +2437,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reveActuel = Math.max(reveActuel - rollData.depenseReve, 0);
|
reveActuel = Math.max(reveActuel - rollData.depenseReve, 0);
|
||||||
await this.update({ "data.reve.reve.value": reveActuel });
|
await this.update({ "system.reve.reve.value": reveActuel });
|
||||||
|
|
||||||
if (rollData.isSortReserve) {
|
if (rollData.isSortReserve) {
|
||||||
this.currentTMR.maximize(); // Re-display TMR
|
this.currentTMR.maximize(); // Re-display TMR
|
||||||
@ -2736,12 +2736,12 @@ export class RdDActor extends Actor {
|
|||||||
const sust = artData.oeuvre.system.sust * artData.proportions;
|
const sust = artData.oeuvre.system.sust * artData.proportions;
|
||||||
artData.qualiteFinale = Math.min(baseQualite, artData.oeuvre.system.niveau) + artData.rolled.ptQualite;
|
artData.qualiteFinale = Math.min(baseQualite, artData.oeuvre.system.niveau) + artData.rolled.ptQualite;
|
||||||
artData.exotismeFinal = Math.min(Math.min(artData.qualiteFinale, artData.oeuvre.system.exotisme ?? 0), 0);
|
artData.exotismeFinal = Math.min(Math.min(artData.qualiteFinale, artData.oeuvre.system.exotisme ?? 0), 0);
|
||||||
console.log("OEUVRE", artData.art, artData)
|
//console.log("OEUVRE", artData.art, artData)
|
||||||
const platCuisine = {
|
const platCuisine = {
|
||||||
name: artData.oeuvre.name,
|
name: artData.oeuvre.name,
|
||||||
type: 'nourritureboisson',
|
type: 'nourritureboisson',
|
||||||
img: 'systems/foundryvtt-reve-de-dragon/icons/objets/provision_cuite.webp',
|
img: 'systems/foundryvtt-reve-de-dragon/icons/objets/provision_cuite.webp',
|
||||||
data: {
|
system: {
|
||||||
"description": artData.oeuvre.system.description,
|
"description": artData.oeuvre.system.description,
|
||||||
"sust": Math.min(sust, 1),
|
"sust": Math.min(sust, 1),
|
||||||
"qualite": artData.qualiteFinale,
|
"qualite": artData.qualiteFinale,
|
||||||
@ -2898,7 +2898,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
rollData.xpSort = RdDItemSigneDraconique.getXpSortSigneDraconique(rollData.rolled.code, rollData.signe);
|
rollData.xpSort = RdDItemSigneDraconique.getXpSortSigneDraconique(rollData.rolled.code, rollData.signe);
|
||||||
if (rollData.xpSort > 0) {
|
if (rollData.xpSort > 0) {
|
||||||
await this.updateEmbeddedDocuments("Item", [{ _id: compData._id, 'data.xp_sort': Misc.toInt(compData.system.xp_sort) + rollData.xpSort }]);
|
await this.updateEmbeddedDocuments("Item", [{ _id: compData._id, 'system.xp_sort': Misc.toInt(compData.system.xp_sort) + rollData.xpSort }]);
|
||||||
await this.updateExperienceLog("XP Sort", rollData.xpSort, "Signe draconique en " + rollData.competence.name);
|
await this.updateExperienceLog("XP Sort", rollData.xpSort, "Signe draconique en " + rollData.competence.name);
|
||||||
}
|
}
|
||||||
await this.deleteEmbeddedDocuments("Item", [rollData.signe._id]);
|
await this.deleteEmbeddedDocuments("Item", [rollData.signe._id]);
|
||||||
@ -3018,7 +3018,7 @@ export class RdDActor extends Actor {
|
|||||||
async _xpCompetence(xpData) {
|
async _xpCompetence(xpData) {
|
||||||
if (xpData.competence) {
|
if (xpData.competence) {
|
||||||
const newXp = Misc.toInt(xpData.competence.system.xp) + xpData.xpCompetence;
|
const newXp = Misc.toInt(xpData.competence.system.xp) + xpData.xpCompetence;
|
||||||
let update = { _id: xpData.competence._id, 'data.xp': newXp };
|
let update = { _id: xpData.competence._id, 'system.xp': newXp };
|
||||||
await this.updateEmbeddedDocuments('Item', [update]);
|
await this.updateEmbeddedDocuments('Item', [update]);
|
||||||
xpData.checkComp = await this.checkCompetenceXP(xpData.competence.name, undefined, false);
|
xpData.checkComp = await this.checkCompetenceXP(xpData.competence.name, undefined, false);
|
||||||
this.updateExperienceLog("XP", xpData.xp, "XP gagné en " + xpData.competence.name);
|
this.updateExperienceLog("XP", xpData.xp, "XP gagné en " + xpData.competence.name);
|
||||||
@ -3032,7 +3032,7 @@ export class RdDActor extends Actor {
|
|||||||
let selectedCarac = RdDActor._findCaracByName(carac, xpData.caracName);
|
let selectedCarac = RdDActor._findCaracByName(carac, xpData.caracName);
|
||||||
if (!selectedCarac.derivee) {
|
if (!selectedCarac.derivee) {
|
||||||
selectedCarac.xp = Misc.toInt(selectedCarac.xp) + xpData.xpCarac;
|
selectedCarac.xp = Misc.toInt(selectedCarac.xp) + xpData.xpCarac;
|
||||||
await this.update({ "data.carac": carac });
|
await this.update({ "system.carac": carac });
|
||||||
xpData.checkCarac = await this.checkCaracXP(selectedCarac.label, false);
|
xpData.checkCarac = await this.checkCaracXP(selectedCarac.label, false);
|
||||||
this.updateExperienceLog("XP", xpData.xpCarac, "XP gagné en " + xpData.caracName);
|
this.updateExperienceLog("XP", xpData.xpCarac, "XP gagné en " + xpData.caracName);
|
||||||
} else {
|
} else {
|
||||||
@ -3458,7 +3458,7 @@ export class RdDActor extends Actor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
encaissement.endurance = Math.max(encaissement.endurance, -endActuelle);
|
encaissement.endurance = Math.max(encaissement.endurance, -endActuelle);
|
||||||
this.update({ "data.blessures": blessures });
|
this.update({ "system.blessures": blessures });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -3587,7 +3587,7 @@ export class RdDActor extends Actor {
|
|||||||
console.log('RdDActor.optimizeArgent', fortuneTotale, 'nouvelleFortune', nouvelleFortune, 'monnaie_par_valeur',parValeur);
|
console.log('RdDActor.optimizeArgent', fortuneTotale, 'nouvelleFortune', nouvelleFortune, 'monnaie_par_valeur',parValeur);
|
||||||
let updates = [];
|
let updates = [];
|
||||||
for (const [valeur, nombre] of Object.entries(nouvelleFortune)) {
|
for (const [valeur, nombre] of Object.entries(nouvelleFortune)) {
|
||||||
updates.push({ _id: parValeur[valeur].id, 'data.quantite': nombre });
|
updates.push({ _id: parValeur[valeur].id, 'system.quantite': nombre });
|
||||||
}
|
}
|
||||||
await this.updateEmbeddedDocuments('Item', updates);
|
await this.updateEmbeddedDocuments('Item', updates);
|
||||||
}
|
}
|
||||||
@ -3674,7 +3674,7 @@ export class RdDActor extends Actor {
|
|||||||
let monnaie = this.getMonnaie(id);
|
let monnaie = this.getMonnaie(id);
|
||||||
if (monnaie) {
|
if (monnaie) {
|
||||||
const quantite = Math.max(0, monnaie.system.quantite + value);
|
const quantite = Math.max(0, monnaie.system.quantite + value);
|
||||||
await this.updateEmbeddedDocuments('Item', [{ _id: monnaie.id, 'data.quantite': quantite }]);
|
await this.updateEmbeddedDocuments('Item', [{ _id: monnaie.id, 'system.quantite': quantite }]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3724,7 +3724,7 @@ export class RdDActor extends Actor {
|
|||||||
vendeur.deleteEmbeddedDocuments("Item", [itemId])
|
vendeur.deleteEmbeddedDocuments("Item", [itemId])
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vendeur.updateEmbeddedDocuments("Item", [{ _id: itemId, 'data.quantite': resteQuantite }]);
|
vendeur.updateEmbeddedDocuments("Item", [{ _id: itemId, 'system.quantite': resteQuantite }]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (acheteur) {
|
if (acheteur) {
|
||||||
@ -3879,11 +3879,11 @@ export class RdDActor extends Actor {
|
|||||||
//console.log("Ajout acteur : ", actor, this);
|
//console.log("Ajout acteur : ", actor, this);
|
||||||
if (subActor && !subActor.owner) {
|
if (subActor && !subActor.owner) {
|
||||||
if (subActortype == 'vehicule') {
|
if (subActortype == 'vehicule') {
|
||||||
this.pushSubacteur(subActor, this.system.subacteurs.vehicules, 'data.subacteurs.vehicules', 'Ce Véhicule');
|
this.pushSubacteur(subActor, this.system.subacteurs.vehicules, 'system.subacteurs.vehicules', 'Ce Véhicule');
|
||||||
} else if (subActor.type == 'creature') {
|
} else if (subActor.type == 'creature') {
|
||||||
this.pushSubacteur(subActor, this.system.subacteurs.montures, 'data.subacteurs.montures', 'Cette Monture');
|
this.pushSubacteur(subActor, this.system.subacteurs.montures, 'system.subacteurs.montures', 'Cette Monture');
|
||||||
} else if (subActor.type == 'personnage') {
|
} else if (subActor.type == 'personnage') {
|
||||||
this.pushSubacteur(subActor, this.system.subacteurs.suivants, 'data.subacteurs.suivants', 'Ce Suivant');
|
this.pushSubacteur(subActor, this.system.subacteurs.suivants, 'system.subacteurs.suivants', 'Ce Suivant');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ui.notifications.warn("Vous n'avez pas les droits sur l'acteur que vous attachez.")
|
ui.notifications.warn("Vous n'avez pas les droits sur l'acteur que vous attachez.")
|
||||||
@ -3895,9 +3895,9 @@ export class RdDActor extends Actor {
|
|||||||
let newVehicules = this.system.subacteurs.vehicules.filter(function (obj, index, arr) { return obj.id != actorId });
|
let newVehicules = this.system.subacteurs.vehicules.filter(function (obj, index, arr) { return obj.id != actorId });
|
||||||
let newSuivants = this.system.subacteurs.suivants.filter(function (obj, index, arr) { return obj.id != actorId });
|
let newSuivants = this.system.subacteurs.suivants.filter(function (obj, index, arr) { return obj.id != actorId });
|
||||||
let newMontures = this.system.subacteurs.montures.filter(function (obj, index, arr) { return obj.id != actorId });
|
let newMontures = this.system.subacteurs.montures.filter(function (obj, index, arr) { return obj.id != actorId });
|
||||||
await this.update({ 'data.subacteurs.vehicules': newVehicules });
|
await this.update({ 'system.subacteurs.vehicules': newVehicules });
|
||||||
await this.update({ 'data.subacteurs.suivants': newSuivants });
|
await this.update({ 'system.subacteurs.suivants': newSuivants });
|
||||||
await this.update({ 'data.subacteurs.montures': newMontures });
|
await this.update({ 'system.subacteurs.montures': newMontures });
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------------------------------- */
|
/* -------------------------------------------- */
|
||||||
@ -3929,7 +3929,7 @@ export class RdDActor extends Actor {
|
|||||||
guerisonData.list.push("1 Blessure Légère (2 points)");
|
guerisonData.list.push("1 Blessure Légère (2 points)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await this.update({ "data.blessures": blessures });
|
await this.update({ "system.blessures": blessures });
|
||||||
|
|
||||||
let pvManquants = myData.sante.vie.max - myData.sante.vie.value;
|
let pvManquants = myData.sante.vie.max - myData.sante.vie.value;
|
||||||
let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2));
|
let pvSoignees = Math.min(pvManquants, Math.floor(pointsGuerison / 2));
|
||||||
@ -4008,7 +4008,7 @@ export class RdDActor extends Actor {
|
|||||||
let newPotion = {
|
let newPotion = {
|
||||||
name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion',
|
name: `Potion de ${herbeData.system.categorie} (${herbeData.name})`, type: 'potion',
|
||||||
img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp",
|
img: "systems/foundryvtt-reve-de-dragon/icons/objets/fiole_verre.webp",
|
||||||
data: {
|
system: {
|
||||||
quantite: 1, valeur_deniers: 1, encombrement: 0.01,
|
quantite: 1, valeur_deniers: 1, encombrement: 0.01,
|
||||||
categorie: herbeData.system.categorie,
|
categorie: herbeData.system.categorie,
|
||||||
herbe: herbeData.name,
|
herbe: herbeData.name,
|
||||||
|
@ -158,7 +158,6 @@ export class RdDCombatManager extends Combat {
|
|||||||
let armeData = duplicate(arme)
|
let armeData = duplicate(arme)
|
||||||
if (armeData.system.equipe) {
|
if (armeData.system.equipe) {
|
||||||
let compData = competences.find(c => c.name.toLowerCase() == armeData.system.competence.toLowerCase())
|
let compData = competences.find(c => c.name.toLowerCase() == armeData.system.competence.toLowerCase())
|
||||||
console.log("ARME", arme, compData, armeData.system.competence, competences)
|
|
||||||
|
|
||||||
armesEquipe.push(armeData)
|
armesEquipe.push(armeData)
|
||||||
armeData.system.dommagesReels = Number(armeData.system.dommages)
|
armeData.system.dommagesReels = Number(armeData.system.dommages)
|
||||||
|
Loading…
Reference in New Issue
Block a user