Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
da1719a336 |
53
changelog.md
53
changelog.md
@ -1,53 +1,9 @@
|
||||
# 12.0
|
||||
|
||||
## 120.0.47
|
||||
|
||||
- Correction sur les mise à jour en cascade -
|
||||
- Correction sur le force rendering après un changement de competence
|
||||
|
||||
## 12.0.46 - Le double demi d'Astrobazzarh
|
||||
- correction des raffraîchissement lors du sommeil qui empêchait de dormir
|
||||
plusieurs heures
|
||||
- Si la fatigue n'est pas utilisée, les rounds dans les TMR font perdre de l'endurance (au lieu d'en gagner)
|
||||
- les TMRs se ferment correctement quand la fatigue maximale est dépassée
|
||||
- le message de lancement de sort en réserve donne la description du sort
|
||||
- suppression de double-messages lors de la fermeture des TMR
|
||||
|
||||
## 12.0.45 - Les errements d'Astrobazzarh, encore
|
||||
|
||||
- La difficulté des méditations n'augmente plus en cas de réussite et d'échec normal
|
||||
- Renommage du Bouton pour révéler/masquer le demi-rêve
|
||||
|
||||
## 12.0.44 - Les errements d'Astrobazzarh, suite
|
||||
|
||||
- on peut de nouveau dormir et se réveiller reposé
|
||||
- les possessions utilisent maintenant correctement le rêve actuel
|
||||
- les sorts variables ne causent plus de soucis de voie pour le lancement de sorts
|
||||
- les acteurs ayant un sort avec un coût de rêve entier ne sont plus considérés
|
||||
comme pouvant avoir un rêve variable
|
||||
|
||||
## 12.0.42 - Les errements d'Astrobazzarh
|
||||
|
||||
- Correction de différentes automatisations de combat incorrectes
|
||||
- Correction des jets `@roll[vue/-2]` qui tentaient de chercher une compétence -2 (à cause des armes à 1/2 mains)
|
||||
|
||||
## 12.0.41 - La loupe d'Astrobazzarh
|
||||
|
||||
- On peut de nouveau effectuer des tirages cachés
|
||||
- Le stress transformé est bien diminué lorsqu'on met le stress dans une compétence
|
||||
|
||||
## 12.0.40 - Les mains d'Astrobazzarh
|
||||
|
||||
- correction des attaques particulières en combat
|
||||
- correction de message sur les min/max liés aux modificateurs de races (s'applique uniquement sur la taille)
|
||||
|
||||
## 12.0.39 - Les mains d'Astrobazzarh
|
||||
|
||||
- les armes à 1 ou 2 mains fonctionnent dans les liens de jets de dés
|
||||
- commande `/jet` pour poster une demande de jet de dés
|
||||
|
||||
## 12.0.38 - Les prévisions d'Astrobazzarh
|
||||
|
||||
- Correction de modifications de personnages qui ne s'affichaient pas:
|
||||
- changements d'endurance/vie/fatigue, transformé, ...
|
||||
- Migration des compétences "Ecriture" en "Écriture" dans les tâches, livres, oeuvres et méditations
|
||||
@ -57,14 +13,12 @@
|
||||
- utilisation de l'extension hbs pour tous les fichiers handlebars
|
||||
|
||||
## 12.0.37 - Les enchantements d'Astrobazzarh
|
||||
|
||||
- les potions ont un état, seules les potions liquides sont enchantables
|
||||
- les lancements de sorts du jour sont conservés jusqu'à chateau dormant
|
||||
- lorsqu'un joueur souhaite enchanter une potion, les sorts d'enchantements/purification/permanence doivent avoir été lancés auparavant
|
||||
- on peut enchanter des gemmes exactement comme des potions
|
||||
|
||||
## 12.0.36 - L'alchimie d'Astrobazzarh
|
||||
|
||||
- Nouveautés
|
||||
- ajout d'un bouton pour enchanter les potions
|
||||
- standardisation des boutons d'actions sur les items
|
||||
@ -79,11 +33,9 @@
|
||||
- Corrections de descriptions pour proposer les jet de dés
|
||||
|
||||
## 12.0.35 - La Solution d'Astrobazzarh
|
||||
|
||||
- Fix problème d'initialisation des feuilles d'items
|
||||
|
||||
## 12.0.34 - la tête d'Astrobazzarh
|
||||
|
||||
- support de liens "jets de dés"
|
||||
- on peut ajouter des liens "jet de dés" dans les journaux, descriptions, notes, maladresses, ...
|
||||
- avec la syntaxe `@roll[...]` on peut ajouter le lien vers:
|
||||
@ -98,26 +50,21 @@
|
||||
- gestion des blocs secrets dans les descriptions
|
||||
|
||||
## 12.0.33 - la vieillesse d'Astrobazzarh
|
||||
|
||||
- retour de l'expérience pour les joueurs
|
||||
- suppression du message "Pas de caractéristique" sur les jets d'odorat-goût
|
||||
|
||||
## 12.0.32 - les rêveries d'Astrobazzarh
|
||||
|
||||
- Ajout des Items Race pour gérer les ajustements liés aux races
|
||||
|
||||
## 12.0.31 - le mausolée d'Astrobazzarh
|
||||
|
||||
- Correction: les automatisation de combat jouer-MJ fonctionnentde nouveau
|
||||
|
||||
## 12.0.30 - le cauchemar d'Astrobazzarh
|
||||
|
||||
- calcul automatique du niveau des entités selon leur rêve
|
||||
- la description des créatures venimeuses contient un lien vers leur venin
|
||||
- Correction: les messages de combats ne marchaient plus (Changement combiné Foundry + rêve de Dragon)
|
||||
|
||||
## 12.0.29 - L'indexation d'Astrobazzarh
|
||||
|
||||
- les liens dans la descriptions des sorts pointent vers les sorts du compendium
|
||||
- la description du chrasme contient le lien vers son venin plutôt qu'un tableau
|
||||
|
||||
|
@ -237,11 +237,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
|
||||
this.html.find('.carac-xp-augmenter').click(async event => await this.actor.updateCaracXPAuto(event.currentTarget.name.replace("augmenter.", "")))
|
||||
this.html.find('.competence-xp-augmenter').click(async event => await this.actor.updateCompetenceXPAuto(RdDSheetUtility.getItemId(event)))
|
||||
this.html.find('.competence-stress-augmenter').click(async event =>{
|
||||
await this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event))
|
||||
this.render(true)
|
||||
}
|
||||
)
|
||||
this.html.find('.competence-stress-augmenter').click(async event => await this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event)))
|
||||
|
||||
if (this.options.vueDetaillee) {
|
||||
// On carac change
|
||||
|
187
module/actor.js
187
module/actor.js
@ -243,7 +243,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
await this.resetInfoSommeil()
|
||||
ChatMessage.create(message);
|
||||
setTimeout(() => this.sheet.render(), 20)
|
||||
this.sheet.render(true);
|
||||
}
|
||||
|
||||
async _recuperationSante(message) {
|
||||
@ -279,32 +279,28 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
/* -------------------------------------------- */
|
||||
async dormirChateauDormant() {
|
||||
if (!ReglesOptionnelles.isUsing("chateau-dormant-gardien") || !this.system.sommeil || this.system.sommeil.nouveaujour) {
|
||||
await this.$dormirChateauDormant();
|
||||
setTimeout(() => this.sheet.render(), 20)
|
||||
}
|
||||
}
|
||||
const message = {
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: ""
|
||||
};
|
||||
|
||||
async $dormirChateauDormant() {
|
||||
const message = {
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: ""
|
||||
};
|
||||
|
||||
await this._recuperationSante(message);
|
||||
await this._recupereMoralChateauDormant(message);
|
||||
await this._recupereChance();
|
||||
await this.transformerStress();
|
||||
await this.retourSeuilDeReve(message);
|
||||
await this.setBonusPotionSoin(0);
|
||||
await this.retourSust(message);
|
||||
await this.$perteReveEnchantementsChateauDormants();
|
||||
await this.$suppressionLancementsSort();
|
||||
await RdDCoeur.applyCoeurChateauDormant(this, message);
|
||||
if (message.content != "") {
|
||||
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
|
||||
ChatMessage.create(message);
|
||||
await this._recuperationSante(message)
|
||||
await this._recupereMoralChateauDormant(message)
|
||||
await this._recupereChance()
|
||||
await this.transformerStress()
|
||||
await this.retourSeuilDeReve(message)
|
||||
await this.setBonusPotionSoin(0)
|
||||
await this.retourSust(message)
|
||||
await this.$perteReveEnchantementsChateauDormants()
|
||||
await this.$suppressionLancementsSort()
|
||||
await RdDCoeur.applyCoeurChateauDormant(this, message)
|
||||
if (message.content != "") {
|
||||
message.content = `A la fin Chateau Dormant, ${message.content}<br>Un nouveau jour se lève`;
|
||||
ChatMessage.create(message);
|
||||
}
|
||||
await this.resetInfoSommeil();
|
||||
this.sheet.render(true);
|
||||
}
|
||||
await this.resetInfoSommeil();
|
||||
}
|
||||
|
||||
async resetInfoSommeil() {
|
||||
@ -446,9 +442,10 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
message.content += 'Vous ne trouvez pas le sommeil';
|
||||
}
|
||||
else {
|
||||
let dormi = await this.$dormirDesHeures(message, heures, options);
|
||||
if (dormi.jetsReve.length > 0) {
|
||||
message.content += `Vous récupérez ${dormi.jetsReve.map(it => it < 0 ? '0 (réveil)' : it).reduce(Misc.joining("+"))} Points de rêve. `;
|
||||
let jetsReve = [];
|
||||
let dormi = await this.dormirDesHeures(jetsReve, message, heures, options);
|
||||
if (jetsReve.length > 0) {
|
||||
message.content += `Vous récupérez ${jetsReve.map(it => it < 0 ? '0 (réveil)' : it).reduce(Misc.joining("+"))} Points de rêve. `;
|
||||
}
|
||||
if (dormi.etat == 'eveil') {
|
||||
await this.reveilReveDeDragon(message, dormi.heures);
|
||||
@ -461,9 +458,11 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
ChatMessage.create(message);
|
||||
}
|
||||
if (options.chateauDormant) {
|
||||
await this.$dormirChateauDormant();
|
||||
await this.dormirChateauDormant();
|
||||
}
|
||||
else {
|
||||
this.sheet.render(true);
|
||||
}
|
||||
setTimeout(() => this.sheet.render(), 20)
|
||||
}
|
||||
|
||||
async reveilReveDeDragon(message, heures) {
|
||||
@ -473,18 +472,18 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
}
|
||||
|
||||
async $dormirDesHeures(message, heures, options) {
|
||||
const dormi = { heures: 0, etat: 'dort', jetsReve: [] };
|
||||
async dormirDesHeures(jetsReve, message, heures, options) {
|
||||
const dormi = { heures: 0, etat: 'dort' };
|
||||
for (; dormi.heures < heures && dormi.etat == 'dort'; dormi.heures++) {
|
||||
await this.$recupererEthylisme(message);
|
||||
await this._recupererEthylisme(message);
|
||||
if (options.grisReve) {
|
||||
await this.$recupererFatigue(message);
|
||||
await this.recupererFatigue(message);
|
||||
}
|
||||
else if (!this.system.sommeil?.insomnie) {
|
||||
await this.$recupererFatigue(message);
|
||||
await this.$jetRecuperationReve(dormi, message);
|
||||
await this.recupererFatigue(message);
|
||||
dormi.etat = await this.jetRecuperationReve(jetsReve, message);
|
||||
if (dormi.etat == 'dort' && EffetsDraconiques.isDonDoubleReve(this)) {
|
||||
dormi.etat = await this.$jetRecuperationReve(dormi, message);
|
||||
dormi.etat = await this.jetRecuperationReve(jetsReve, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -492,36 +491,35 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $jetRecuperationReve(dormi, message) {
|
||||
async jetRecuperationReve(jetsReve, message) {
|
||||
if (this.getReveActuel() < this.system.reve.seuil.value) {
|
||||
const reve = await RdDDice.rollTotal("1dr")
|
||||
let reve = await RdDDice.rollTotal("1dr");
|
||||
if (reve >= 7) {
|
||||
// Rêve de Dragon !
|
||||
message.content += `Vous faites un <strong>Rêve de Dragon</strong> de ${reve} Points de rêve qui vous réveille! `;
|
||||
await this.combattreReveDeDragon(reve);
|
||||
dormi.jetsReve.push(-1);
|
||||
dormi.etat = 'eveil'
|
||||
return
|
||||
jetsReve.push(-1);
|
||||
return 'eveil';
|
||||
}
|
||||
else {
|
||||
if (!ReglesOptionnelles.isUsing("recuperation-reve")) {
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getOwners(this),
|
||||
content: `Pas de récupération de rêve (${reve} points ignorés)`
|
||||
})
|
||||
dormi.jetsReve.push(0)
|
||||
});
|
||||
jetsReve.push(0);
|
||||
}
|
||||
else {
|
||||
await this.reveActuelIncDec(reve)
|
||||
dormi.jetsReve.push(reve)
|
||||
await this.reveActuelIncDec(reve);
|
||||
jetsReve.push(reve);
|
||||
}
|
||||
}
|
||||
}
|
||||
dormi.etat = 'dort'
|
||||
return 'dort';
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $recupererEthylisme(message) {
|
||||
async _recupererEthylisme(message) {
|
||||
if (!ReglesOptionnelles.isUsing("recuperation-ethylisme")) { return; }
|
||||
let value = Math.min(Number.parseInt(this.system.compteurs.ethylisme.value) + 1, 1);
|
||||
if (value <= 0) {
|
||||
@ -543,6 +541,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
max = Math.floor(max / 2);
|
||||
}
|
||||
const manquant = max - this.system.sante.endurance.value;
|
||||
|
||||
if (manquant > 0) {
|
||||
await this.santeIncDec("endurance", manquant);
|
||||
message.content += `Vous récuperez ${manquant} points d'endurance. `;
|
||||
@ -550,15 +549,15 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $recupererFatigue(message) {
|
||||
async recupererFatigue(message) {
|
||||
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
|
||||
let fatigue = this.system.sante.fatigue.value
|
||||
const fatigueMin = this.getFatigueMin()
|
||||
let fatigue = this.system.sante.fatigue.value;
|
||||
const fatigueMin = this.getFatigueMin();
|
||||
if (fatigue <= fatigueMin) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue))
|
||||
await this.update({ 'system.sante.fatigue.value': fatigue });
|
||||
fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue));
|
||||
await this.update({ "system.sante.fatigue.value": fatigue });
|
||||
if (fatigue == 0) {
|
||||
message.content += "Vous êtes complêtement reposé. ";
|
||||
}
|
||||
@ -668,23 +667,19 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (!RdDItemRace.checkRacialMax(this, caracName, to)) {
|
||||
return
|
||||
}
|
||||
let updates = {};
|
||||
if (caracName == LIST_CARAC_PERSONNAGE.reve.code) {
|
||||
if (to > Misc.toInt(this.system.reve.seuil.value)) {
|
||||
updates[`system.reve.seuil.value`] = to; // SFA : Direct and packed changes
|
||||
//this.setPointsDeSeuil(to);
|
||||
}
|
||||
this.setPointsDeSeuil(to);
|
||||
}
|
||||
}
|
||||
if (caracName == LIST_CARAC_PERSONNAGE.chance.code) {
|
||||
if (to > Misc.toInt(this.system.compteurs.chance.value)) {
|
||||
updates[`system.compteurs.chance.value`] = to; // SFA : Direct and packed changes
|
||||
//this.setPointsDeChance(to);
|
||||
this.setPointsDeChance(to);
|
||||
}
|
||||
}
|
||||
let selectedCarac = this.findCaracByName(caracName);
|
||||
const from = selectedCarac.value
|
||||
updates[`system.carac.${caracName}.value`] = to;
|
||||
await this.update(updates);
|
||||
await this.update({ [`system.carac.${caracName}.value`]: to });
|
||||
await ExperienceLog.add(this, XP_TOPIC.CARAC, from, to, caracName);
|
||||
}
|
||||
|
||||
@ -741,7 +736,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
await competence.update({
|
||||
"system.xp": toXp,
|
||||
"system.niveau": toNiveau,
|
||||
}, { render: false })
|
||||
});
|
||||
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name);
|
||||
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name);
|
||||
}
|
||||
@ -772,7 +767,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
await competence.update({
|
||||
"system.xp": newXp,
|
||||
"system.niveau": toNiveau,
|
||||
}, { render: false })
|
||||
});
|
||||
const toXpStress = Math.max(0, fromXpStress - xpUtilise);
|
||||
await this.update({ "system.compteurs.experience.value": toXpStress });
|
||||
|
||||
@ -788,7 +783,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories());
|
||||
this.notifyCompetencesTronc(competence, toNiveau);
|
||||
const fromNiveau = competence.system.niveau;
|
||||
await competence.update({ 'system.niveau': toNiveau }, { render: true })
|
||||
await competence.update({ 'system.niveau': toNiveau });
|
||||
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true);
|
||||
}
|
||||
}
|
||||
@ -813,7 +808,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0;
|
||||
const fromXp = competence.system.xp;
|
||||
this.checkCompetenceXP(idOrName, toXp);
|
||||
await competence.update({ 'system.xp': toXp }, { render: false })
|
||||
await competence.update({ 'system.xp': toXp });
|
||||
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true);
|
||||
if (toXp > fromXp) {
|
||||
RdDUtility.checkThanatosXP(competence)
|
||||
@ -827,7 +822,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (competence) {
|
||||
if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0;
|
||||
const fromXpSort = competence.system.xp_sort;
|
||||
await competence.update({ 'system.xp_sort': toXpSort }, { render: false })
|
||||
await competence.update({ 'system.xp_sort': toXpSort });
|
||||
await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true);
|
||||
if (toXpSort > fromXpSort) {
|
||||
RdDUtility.checkThanatosXP(competence)
|
||||
@ -839,7 +834,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
async updateCompetenceArchetype(idOrName, compValue) {
|
||||
let competence = this.getCompetence(idOrName)
|
||||
if (competence) {
|
||||
await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) })
|
||||
await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1052,10 +1047,20 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async deleteRencontreTMRAtPosition() {
|
||||
const rencontreIds = this.itemTypes[ITEM_TYPES.rencontre].filter(this.filterRencontreTMRDemiReve()).map(it => it.id)
|
||||
if (rencontreIds.length > 0) {
|
||||
await this.deleteEmbeddedDocuments('Item', rencontreIds)
|
||||
}
|
||||
}
|
||||
|
||||
getRencontreTMREnAttente() {
|
||||
return this.itemTypes[ITEM_TYPES.rencontre].find(this.filterRencontreTMRDemiReve())
|
||||
}
|
||||
|
||||
filterRencontreTMRDemiReve() {
|
||||
const position = this.getDemiReve()
|
||||
return this.itemTypes[ITEM_TYPES.rencontre].find(it => it.system.coord == position)
|
||||
return it => it.system.coord == position
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1555,7 +1560,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
if (!rollData.rolled.isPart ||
|
||||
rollData.finalLevel >= 0 ||
|
||||
game.settings.get("core", "rollMode") == 'selfroll' ||
|
||||
!Misc.hasConnectedGM()) {
|
||||
!Misc.hasConnectedGM()) {
|
||||
return
|
||||
}
|
||||
hideChatMessage = hideChatMessage == 'hide' || (Misc.isRollModeHiddenToPlayer() && !game.user.isGM)
|
||||
@ -1579,7 +1584,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _appliquerAppelMoral(rollData) {
|
||||
if (!rollData.use.moral || game.settings.get("core", "rollMode") == 'selfroll') {
|
||||
if (!rollData.use.moral || game.settings.get("core", "rollMode") == 'selfroll'){
|
||||
return
|
||||
}
|
||||
if (rollData.rolled.isEchec ||
|
||||
@ -1795,10 +1800,8 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
};
|
||||
RollDataAjustements.calcul(rollData, this);
|
||||
await RdDResolutionTable.rollData(rollData);
|
||||
await RdDRollResult.displayRollData(rollData, this)
|
||||
|
||||
this.gererExperience(rollData);
|
||||
|
||||
await RdDRollResult.displayRollData(rollData, this)
|
||||
return rollData.rolled;
|
||||
}
|
||||
|
||||
@ -1866,7 +1869,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
competence: competence,
|
||||
show: { title: options?.title ?? '' }
|
||||
},
|
||||
// TODO:
|
||||
// TODO:
|
||||
callbacks: [{ action: r => this.$onRollCompetence(r, options) }]
|
||||
});
|
||||
}
|
||||
@ -1879,7 +1882,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
compData.system.defaut_carac = tacheData.system.carac; // Patch !
|
||||
|
||||
await this.openRollDialog({
|
||||
name: 'jet-competence',
|
||||
name: 'jet-competence',
|
||||
label: 'Jet de Tâche ' + tacheData.name,
|
||||
template: 'systems/foundryvtt-reve-de-dragon/templates/dialog-roll-competence.hbs',
|
||||
rollData: {
|
||||
@ -1942,9 +1945,9 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
await this.openRollDialog({
|
||||
name: `jet-${artData.art}`,
|
||||
name: `jet-${artData.art}`,
|
||||
label: `${artData.verbe} ${oeuvre.name}`,
|
||||
template: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${oeuvre.type}.hbs`,
|
||||
template: `systems/foundryvtt-reve-de-dragon/templates/dialog-roll-${oeuvre.type}.hbs`,
|
||||
rollData: artData,
|
||||
callbacks: [{ action: callbackAction }],
|
||||
})
|
||||
@ -2113,6 +2116,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
label: "Jet de méditation",
|
||||
callbacks: [
|
||||
this.createCallbackExperience(),
|
||||
{ condition: r => r.rolled.isEPart, action: r => this._meditationEPart(r) },
|
||||
{ action: r => this._meditationResult(r) }
|
||||
]
|
||||
});
|
||||
@ -2121,16 +2125,21 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _meditationResult(meditationRoll) {
|
||||
this.santeIncDec("fatigue", 2);
|
||||
|
||||
if (meditationRoll.rolled.isSuccess) {
|
||||
await this.createEmbeddedDocuments("Item", [RdDItemSigneDraconique.prepareSigneDraconiqueMeditation(meditationRoll.meditation, meditationRoll.rolled)]);
|
||||
}
|
||||
if (meditationRoll.rolled.isEPart){
|
||||
await this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'system.malus': meditationRoll.meditation.system.malus - 1 }]);
|
||||
}
|
||||
await this.santeIncDec("fatigue", 2);
|
||||
|
||||
await RdDRollResult.displayRollData(meditationRoll, this.name, 'chat-resultat-meditation.hbs');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_meditationEPart(meditationRoll) {
|
||||
this.updateEmbeddedDocuments('Item', [{ _id: meditationRoll.meditation._id, 'system.malus': meditationRoll.meditation.system.malus - 1 }]);
|
||||
}
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_getSignesDraconiques(coord) {
|
||||
const type = TMRUtility.getTMRType(coord);
|
||||
@ -2518,6 +2527,7 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
})
|
||||
}
|
||||
const blessure = this.getItem(blessureId, 'blessure')
|
||||
console.log('TODO update blessure', this, blessureId, rollData, rollData.tache);
|
||||
if (blessure && !blessure.system.premierssoins.done) {
|
||||
const tache = rollData.tache;
|
||||
if (rollData.rolled.isETotal) {
|
||||
@ -2634,13 +2644,12 @@ export class RdDActor extends RdDBaseActorSang {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async incDecItemUse(itemId, shouldIncrease = true) {
|
||||
if (shouldIncrease) {
|
||||
const currentItemUse = this.getFlag(SYSTEM_RDD, 'itemUse');
|
||||
let itemUse = currentItemUse ? foundry.utils.duplicate(currentItemUse) : {};
|
||||
itemUse[itemId] = (itemUse[itemId] ?? 0) + 1;
|
||||
await this.setFlag(SYSTEM_RDD, 'itemUse', itemUse);
|
||||
}
|
||||
async incDecItemUse(itemId, inc = 1) {
|
||||
const currentItemUse = this.getFlag(SYSTEM_RDD, 'itemUse');
|
||||
let itemUse = currentItemUse ? foundry.utils.duplicate(currentItemUse) : {};
|
||||
itemUse[itemId] = (itemUse[itemId] ?? 0) + inc;
|
||||
await this.setFlag(SYSTEM_RDD, 'itemUse', itemUse);
|
||||
console.log("ITEM USE INC", inc, itemUse);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -277,9 +277,14 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
return dialog
|
||||
}
|
||||
|
||||
createCallbackExperience() { return { action: r => { } } }
|
||||
createCallbackAppelAuMoral() { return { action: r => { } } }
|
||||
|
||||
createEmptyCallback() {
|
||||
return {
|
||||
condition: r => false,
|
||||
action: r => { }
|
||||
};
|
||||
}
|
||||
createCallbackExperience() { return this.createEmptyCallback(); }
|
||||
createCallbackAppelAuMoral() { return this.createEmptyCallback(); }
|
||||
async _onCloseRollDialog(html) { }
|
||||
|
||||
async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) {
|
||||
|
@ -39,12 +39,7 @@ export class RdDBaseActorSang extends RdDBaseActorReve {
|
||||
return 0;
|
||||
}
|
||||
|
||||
isCumulFatigueCauseSommeil(cumulFatigue){
|
||||
return ReglesOptionnelles.isUsing("appliquer-fatigue")
|
||||
? (this.getFatigueRestante() <= cumulFatigue)
|
||||
: (this.getEnduranceActuelle() <= cumulFatigue)
|
||||
}
|
||||
getFatigueRestante() {return this.getFatigueMax() - this.getFatigueActuelle() }
|
||||
getFatigueRestante() { return this.getFatigueMax() - this.getFatigueActuelle() }
|
||||
getFatigueMin() { return this.system.sante.endurance.max - this.system.sante.endurance.value }
|
||||
|
||||
malusFatigue() {
|
||||
|
@ -244,19 +244,16 @@ export class RdDBaseActor extends Actor {
|
||||
async onUpdateActor(update, options, actorId) { }
|
||||
async onDeleteItem(item, options, id) {
|
||||
if (item.isInventaire()) {
|
||||
await this._removeItemFromConteneur(item)
|
||||
this._removeItemFromConteneur(item)
|
||||
}
|
||||
}
|
||||
|
||||
async _removeItemFromConteneur(item) {
|
||||
const updates = this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
|
||||
.map(conteneur => {
|
||||
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id)
|
||||
return { _id: conteneur.id, 'system.contenu': nouveauContenu }
|
||||
})
|
||||
if (updates.length > 0) {
|
||||
await this.updateEmbeddedDocuments('Item', updates)
|
||||
}
|
||||
_removeItemFromConteneur(item) {
|
||||
this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
|
||||
.forEach(conteneur => {
|
||||
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id);
|
||||
conteneur.update({ 'system.contenu': nouveauContenu });
|
||||
});
|
||||
}
|
||||
|
||||
async onTimeChanging(oldTimestamp, newTimestamp) {
|
||||
@ -747,7 +744,7 @@ export class RdDBaseActor extends Actor {
|
||||
async jetDeMoral() { this.actionImpossible("jet de moral") }
|
||||
|
||||
async resetItemUse() { }
|
||||
async incDecItemUse(itemId, shouldIncrease = true) { }
|
||||
async incDecItemUse(itemId, inc = 1) { }
|
||||
getItemUse(itemId) { return 0; }
|
||||
|
||||
async finDeRound(options = { terminer: false }) { }
|
||||
|
3
module/applications/sheets/_module.mjs
Normal file
3
module/applications/sheets/_module.mjs
Normal file
@ -0,0 +1,3 @@
|
||||
export { default as RdDItemSheet} from "./common-item-sheet.mjs"
|
||||
export { default as RdDMonnaieSheet } from "./monnaie-sheet.mjs"
|
||||
export { default as RdDMunitionSheet } from "./munition-sheet.mjs"
|
200
module/applications/sheets/common-item-sheet.mjs
Normal file
200
module/applications/sheets/common-item-sheet.mjs
Normal file
@ -0,0 +1,200 @@
|
||||
const { HandlebarsApplicationMixin } = foundry.applications.api
|
||||
import { SYSTEM_RDD } from "../../constants.js"
|
||||
import { Misc } from "../../misc.js"
|
||||
|
||||
export default class RdDItemSheet extends HandlebarsApplicationMixin(foundry.applications.sheets.ItemSheetV2) {
|
||||
|
||||
static register(sheetClass) {
|
||||
const itemType = sheetClass.ITEM_TYPE
|
||||
Items.registerSheet(SYSTEM_RDD, sheetClass, {
|
||||
label: Misc.typeName('Item', itemType),
|
||||
types: [itemType],
|
||||
makeDefault: true
|
||||
})
|
||||
}
|
||||
|
||||
static get ITEM_TYPE() { return undefined }
|
||||
/**
|
||||
* Different sheet modes.
|
||||
* @enum {number}
|
||||
*/
|
||||
static SHEET_MODES = { EDIT: 0, PLAY: 1 }
|
||||
|
||||
constructor(options = {}) {
|
||||
super(options)
|
||||
this.#dragDrop = this.#createDragDropHandlers()
|
||||
}
|
||||
|
||||
#dragDrop
|
||||
_sheetMode = this.constructor.SHEET_MODES.PLAY
|
||||
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["fvtt-rdd", "item"],
|
||||
position: {
|
||||
width: 600,
|
||||
height: "auto",
|
||||
},
|
||||
form: {
|
||||
submitOnChange: true,
|
||||
},
|
||||
window: {
|
||||
resizable: true,
|
||||
},
|
||||
dragDrop: [{ dragSelector: "[data-drag]", dropSelector: null }],
|
||||
actions: {
|
||||
toggleSheet: RdDItemSheet.#onToggleSheet,
|
||||
editImage: RdDItemSheet.#onEditImage,
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the sheet currently in 'Play' mode?
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isPlayMode() {
|
||||
return this._sheetMode === this.constructor.SHEET_MODES.PLAY
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the sheet currently in 'Edit' mode?
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isEditMode() {
|
||||
return this._sheetMode === this.constructor.SHEET_MODES.EDIT
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = {
|
||||
fields: this.document.schema.fields,
|
||||
systemFields: this.document.system.schema.fields,
|
||||
item: this.document,
|
||||
system: this.document.system,
|
||||
source: this.document.toObject(),
|
||||
isEditMode: this.isEditMode,
|
||||
isPlayMode: this.isPlayMode,
|
||||
isEditable: this.isEditable,
|
||||
}
|
||||
return context
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_onRender(context, options) {
|
||||
this.#dragDrop.forEach((d) => d.bind(this.element))
|
||||
}
|
||||
|
||||
// #region Drag-and-Drop Workflow
|
||||
/**
|
||||
* Create drag-and-drop workflow handlers for this Application
|
||||
* @returns {DragDrop[]} An array of DragDrop handlers
|
||||
* @private
|
||||
*/
|
||||
#createDragDropHandlers() {
|
||||
return this.options.dragDrop.map((d) => {
|
||||
d.permissions = {
|
||||
dragstart: this._canDragStart.bind(this),
|
||||
drop: this._canDragDrop.bind(this),
|
||||
}
|
||||
d.callbacks = {
|
||||
dragstart: this._onDragStart.bind(this),
|
||||
dragover: this._onDragOver.bind(this),
|
||||
drop: this._onDrop.bind(this),
|
||||
}
|
||||
return new DragDrop(d)
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Define whether a user is able to begin a dragstart workflow for a given drag selector
|
||||
* @param {string} selector The candidate HTML selector for dragging
|
||||
* @returns {boolean} Can the current user drag this selector?
|
||||
* @protected
|
||||
*/
|
||||
_canDragStart(selector) {
|
||||
return this.isEditable
|
||||
}
|
||||
|
||||
/**
|
||||
* Define whether a user is able to conclude a drag-and-drop workflow for a given drop selector
|
||||
* @param {string} selector The candidate HTML selector for the drop target
|
||||
* @returns {boolean} Can the current user drop on this selector?
|
||||
* @protected
|
||||
*/
|
||||
_canDragDrop(selector) {
|
||||
return this.isEditable && this.document.isOwner
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback actions which occur at the beginning of a drag start workflow.
|
||||
* @param {DragEvent} event The originating DragEvent
|
||||
* @protected
|
||||
*/
|
||||
_onDragStart(event) {
|
||||
const el = event.currentTarget
|
||||
if ("link" in event.target.dataset) return
|
||||
|
||||
// Extract the data you need
|
||||
let dragData = null
|
||||
|
||||
if (!dragData) return
|
||||
|
||||
// Set data transfer
|
||||
event.dataTransfer.setData("text/plain", JSON.stringify(dragData))
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback actions which occur when a dragged element is over a drop target.
|
||||
* @param {DragEvent} event The originating DragEvent
|
||||
* @protected
|
||||
*/
|
||||
_onDragOver(event) { }
|
||||
|
||||
/**
|
||||
* Callback actions which occur when a dragged element is dropped on a target.
|
||||
* @param {DragEvent} event The originating DragEvent
|
||||
* @protected
|
||||
*/
|
||||
async _onDrop(event) { }
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Actions
|
||||
/**
|
||||
* Handle toggling between Edit and Play mode.
|
||||
* @param {Event} event The initiating click event.
|
||||
* @param {HTMLElement} target The current target of the event listener.
|
||||
*/
|
||||
static #onToggleSheet(event, target) {
|
||||
const modes = this.constructor.SHEET_MODES
|
||||
this._sheetMode = this.isEditMode ? modes.PLAY : modes.EDIT
|
||||
this.render()
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle changing a Document's image.
|
||||
*
|
||||
* @this RdDItemSheet
|
||||
* @param {PointerEvent} event The originating click event
|
||||
* @param {HTMLElement} target The capturing HTML element which defined a [data-action]
|
||||
* @returns {Promise}
|
||||
* @private
|
||||
*/
|
||||
static async #onEditImage(event, target) {
|
||||
const attr = target.dataset.edit
|
||||
const current = foundry.utils.getProperty(this.document, attr)
|
||||
const { img } = this.document.constructor.getDefaultArtwork?.(this.document.toObject()) ?? {}
|
||||
const fp = new FilePicker({
|
||||
current,
|
||||
type: "image",
|
||||
redirectToRoot: img ? [img] : [],
|
||||
callback: (path) => {
|
||||
this.document.update({ [attr]: path })
|
||||
},
|
||||
top: this.position.top + 40,
|
||||
left: this.position.left + 10,
|
||||
})
|
||||
return fp.browse()
|
||||
}
|
||||
// #endregion
|
||||
}
|
35
module/applications/sheets/monnaie-sheet.mjs
Normal file
35
module/applications/sheets/monnaie-sheet.mjs
Normal file
@ -0,0 +1,35 @@
|
||||
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
|
||||
import { ITEM_TYPES } from "../../constants.js";
|
||||
import RdDItemSheet from "./common-item-sheet.mjs";
|
||||
|
||||
export default class RdDMonnaieSheet extends RdDItemSheet {
|
||||
/** @override */
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.monnaie }
|
||||
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["fvtt-rdd", "item", "monnaie"],
|
||||
position: {
|
||||
width: 600,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["monnaie-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/item/monnaie.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
return Object.assign(context,
|
||||
await TEMPLATE_DESCRIPTION.prepareContext(this.item),
|
||||
await TEMPLATE_INVENTAIRE.prepareContext(this.item)
|
||||
)
|
||||
}
|
||||
}
|
35
module/applications/sheets/munition-sheet.mjs
Normal file
35
module/applications/sheets/munition-sheet.mjs
Normal file
@ -0,0 +1,35 @@
|
||||
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../../common/_module.mjs";
|
||||
import { ITEM_TYPES } from "../../constants.js";
|
||||
import RdDItemSheet from "./common-item-sheet.mjs";
|
||||
|
||||
export default class RdDMunitionSheet extends RdDItemSheet {
|
||||
/** @override */
|
||||
static get ITEM_TYPE() { return ITEM_TYPES.munition }
|
||||
|
||||
/** @override */
|
||||
static DEFAULT_OPTIONS = {
|
||||
classes: ["fvtt-rdd", "item", "munition"],
|
||||
position: {
|
||||
width: 600,
|
||||
},
|
||||
window: {
|
||||
contentClasses: ["munition-content"],
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
static PARTS = {
|
||||
main: {
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/item/munition.hbs",
|
||||
},
|
||||
}
|
||||
|
||||
/** @override */
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
return Object.assign(context,
|
||||
await TEMPLATE_DESCRIPTION.prepareContext(this.item),
|
||||
await TEMPLATE_INVENTAIRE.prepareContext(this.item)
|
||||
)
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ import { RdDUtility } from "../../rdd-utility.js";
|
||||
import { TextRollManager } from "./text-roll-formatter.js";
|
||||
|
||||
const REGECP_CARAC = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)"
|
||||
const REGEXP_COMP = "(\\/(?<competence>[A-Za-zÀ-ÖØ-öø-ÿ ]+([1-2]?[A-Za-zÀ-ÖØ-öø-ÿ ]+)?))?"
|
||||
const REGEXP_COMP = "(\\/(?<competence>[A-Za-z0-9À-ÖØ-öø-ÿ -]+))?"
|
||||
const REGEXP_DIFF = "(/(?<diff>[\\+\\-]?\\d+(d\\d+)?))?"
|
||||
const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF
|
||||
const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu')
|
||||
|
@ -62,6 +62,7 @@ export class ChatUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
static removeMessages(socketData) {
|
||||
if (Misc.isFirstConnectedGM()) {
|
||||
ChatUtility.onRemoveMessages(socketData);
|
||||
@ -96,7 +97,7 @@ export class ChatUtility {
|
||||
}
|
||||
break
|
||||
case "gmroll":
|
||||
messageData.whisper = actor ? ChatUtility.getOwners(actor) : ChatUtility.getUserAndGMs()
|
||||
messageData.whisper = ChatUtility.getOwners(actor)
|
||||
break
|
||||
case "selfroll":
|
||||
messageData.whisper = [game.user]
|
||||
@ -107,7 +108,7 @@ export class ChatUtility {
|
||||
}
|
||||
|
||||
static getOwners(document) {
|
||||
return document ? game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) : [game.user]
|
||||
return game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER)
|
||||
}
|
||||
|
||||
static getUserAndGMs() {
|
||||
@ -198,7 +199,7 @@ export class ChatUtility {
|
||||
static async onCreateChatMessage(chatMessage, options, id) {
|
||||
if (chatMessage.isAuthor) {
|
||||
await chatMessage.setFlag(SYSTEM_RDD, 'rdd-timestamp', game.system.rdd.calendrier.getTimestamp());
|
||||
await chatMessage.update({ content: await RdDTextEditor.enrichHTML(chatMessage.content, undefined, { showLink: false }) })
|
||||
await chatMessage.update({ content: await RdDTextEditor.enrichHTML(chatMessage.content, undefined, {showLink:false}) })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
7
module/common/_module.mjs
Normal file
7
module/common/_module.mjs
Normal file
@ -0,0 +1,7 @@
|
||||
import { CommonDescription } from "./description.mjs";
|
||||
import { CommonInventaire } from "./inventaire.mjs";
|
||||
|
||||
export const TEMPLATE_DESCRIPTION = new CommonDescription()
|
||||
export const TEMPLATE_INVENTAIRE = new CommonInventaire()
|
||||
|
||||
|
8
module/common/common-template.mjs
Normal file
8
module/common/common-template.mjs
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* class describing common methods implemented by template parts,
|
||||
* used for sheet/models/documents
|
||||
*/
|
||||
export default class CommonTemplate {
|
||||
fields() { }
|
||||
async prepareContext(item) { }
|
||||
}
|
22
module/common/description.mjs
Normal file
22
module/common/description.mjs
Normal file
@ -0,0 +1,22 @@
|
||||
import { RdDTextEditor } from "../apps/rdd-text-roll-editor.js"
|
||||
import CommonTemplate from "./common-template.mjs"
|
||||
import { HTMLSTRING } from "./field-types.mjs"
|
||||
|
||||
const fields = foundry.data.fields
|
||||
|
||||
export class CommonDescription extends CommonTemplate {
|
||||
fields() {
|
||||
return {
|
||||
description: new fields.HTMLField({ ...HTMLSTRING }),
|
||||
descriptionmj: new fields.HTMLField({ gmOnly: true, ...HTMLSTRING })
|
||||
}
|
||||
}
|
||||
|
||||
async prepareContext(item) {
|
||||
return {
|
||||
description: await RdDTextEditor.enrichHTML(item.system.description, item),
|
||||
descriptionmj: await RdDTextEditor.enrichHTML(item.system.descriptionmj, item),
|
||||
}
|
||||
}
|
||||
|
||||
}
|
9
module/common/field-types.mjs
Normal file
9
module/common/field-types.mjs
Normal file
@ -0,0 +1,9 @@
|
||||
export const INTEGER = { required: true, nullable: false, min: 0, integer: true }
|
||||
export const DECIMAL = { required: true, nullable: false, min: 0, integer: false } /* TODO: validation de nombre décimales?*/
|
||||
export const INTEGER_SIGNED = { required: true, nullable: false, integer: true }
|
||||
export const DECIMAL_SIGNED = { required: true, nullable: false, integer: false }
|
||||
export const STRING = { required: true, nullable: false, blank: true, trim: true }
|
||||
export const HTMLSTRING = { initial: "", required: true, nullable: false, blank: true, trim: false, textSearch: true }
|
||||
|
||||
export const MODEL_ARRAY = { initial: [], required: true, nullable: false }
|
||||
|
28
module/common/inventaire.mjs
Normal file
28
module/common/inventaire.mjs
Normal file
@ -0,0 +1,28 @@
|
||||
import CommonTemplate from "./common-template.mjs"
|
||||
import { RARETES } from "../item/raretes.js"
|
||||
import { DECIMAL, INTEGER, INTEGER_SIGNED, MODEL_ARRAY, STRING } from "./field-types.mjs"
|
||||
|
||||
const fields = foundry.data.fields
|
||||
|
||||
export class CommonInventaire extends CommonTemplate {
|
||||
fields() {
|
||||
return {
|
||||
encombrement: new fields.NumberField({ label: "Encombrement", initial: 0, ...INTEGER }),
|
||||
quantite: new fields.NumberField({ label: "Quantité", initial: 1, ...INTEGER }),
|
||||
qualite: new fields.NumberField({ label: "Qualité", initial: 0, ...INTEGER_SIGNED }),
|
||||
cout: new fields.NumberField({ label: "Coût", initial: 0.0, ...DECIMAL }),
|
||||
environnement: new fields.ArrayField(
|
||||
new fields.SchemaField({
|
||||
milieu: new fields.StringField({ label: "Milieu", initial: "", ...STRING }),
|
||||
rarete: new fields.StringField({
|
||||
label: "Rareté", initial: RARETES[0].code, ...STRING,
|
||||
validate: (value, options) => RARETES.find(it => it.code == value)
|
||||
}),
|
||||
frequence: new fields.NumberField({ label: "Fréquence", initial: RARETES[0].frequence, ...INTEGER }),
|
||||
}),
|
||||
{ label: "Environnement", ...MODEL_ARRAY }),
|
||||
}
|
||||
}
|
||||
async prepareContext(item) {
|
||||
}
|
||||
}
|
2
module/documents/_module.mjs
Normal file
2
module/documents/_module.mjs
Normal file
@ -0,0 +1,2 @@
|
||||
export { default as RdDModelMonnaie } from "./monnaie.mjs"
|
||||
export { default as RdDModelMunition } from "./munition.mjs"
|
7
module/documents/monnaie.mjs
Normal file
7
module/documents/monnaie.mjs
Normal file
@ -0,0 +1,7 @@
|
||||
import { RdDItem } from "../item.js";
|
||||
|
||||
export default class RdDItemMonnaie extends RdDItem {
|
||||
static get defaultIcon() {
|
||||
return 'systems/foundryvtt-reve-de-dragon/icons/objets/piece_etain_poisson.webp'
|
||||
}
|
||||
}
|
7
module/documents/munition.mjs
Normal file
7
module/documents/munition.mjs
Normal file
@ -0,0 +1,7 @@
|
||||
import { RdDItem } from "../item.js";
|
||||
|
||||
export default class RdDItemMunition extends RdDItem {
|
||||
static get defaultIcon() {
|
||||
return 'systems/foundryvtt-reve-de-dragon/icons/objets/fleche.webp'
|
||||
}
|
||||
}
|
@ -123,10 +123,10 @@ export class RdDItemArme extends Item {
|
||||
if (defCategory == 'bouclier') {
|
||||
return 'norm'
|
||||
}
|
||||
if (armeAttaque?.system?.competence?.toLowerCase().match(/(fléau)/)) {
|
||||
if (armeAttaque.system.competence.toLowerCase().match(/(fléau)/)) {
|
||||
return ''
|
||||
}
|
||||
if (armeParade.system?.tir) {
|
||||
if (armeParade.system.tir) {
|
||||
return ''
|
||||
}
|
||||
const attCategory = RdDItemArme.getCategorieParade(armeAttaque)
|
||||
|
@ -14,12 +14,11 @@ import { RdDItem } from "./item.js";
|
||||
import { FLEUVE_COORD, TMRUtility } from "./tmr-utility.js";
|
||||
import { RdDTextEditor } from "./apps/rdd-text-roll-editor.js";
|
||||
import { ItemAction } from "./item/item-actions.js";
|
||||
import { RdDItemGemme } from "./item/gemme.js";
|
||||
|
||||
/**
|
||||
* Extend the basic ItemSheet for RdD specific items
|
||||
*/
|
||||
export class RdDItemSheet extends ItemSheet {
|
||||
export class RdDItemSheetV1 extends ItemSheet {
|
||||
|
||||
static get ITEM_TYPE() {
|
||||
return undefined
|
||||
@ -43,7 +42,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: [SYSTEM_RDD, "sheet", "item"],
|
||||
template: RdDItemSheet.defaultTemplate(RdDItemSheet.ITEM_TYPE),
|
||||
template: RdDItemSheetV1.defaultTemplate(RdDItemSheetV1.ITEM_TYPE),
|
||||
width: 550,
|
||||
height: 550
|
||||
}, { inplace: false });
|
||||
@ -51,7 +50,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
get template() {
|
||||
return RdDItemSheet.defaultTemplate(this.item.type);
|
||||
return RdDItemSheetV1.defaultTemplate(this.item.type);
|
||||
}
|
||||
|
||||
get title() {
|
||||
@ -264,7 +263,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
_updateObject(event, formData) {
|
||||
switch (this.item.type) {
|
||||
case ITEM_TYPES.sort:
|
||||
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheet._listCaseTmr(
|
||||
formData['system.bonuscase'] = RdDItemSort.bonuscasesToString(RdDItemSheetV1._listCaseTmr(
|
||||
formData.caseTmrCoord,
|
||||
formData.caseTmrBonus,
|
||||
formData.caseTmrAdd
|
||||
@ -314,7 +313,7 @@ export class RdDItemSheet extends ItemSheet {
|
||||
|
||||
async _onDrop(event) {
|
||||
// Try to extract the dragData
|
||||
let dragData = RdDItemSheet.$extractDragData(event);
|
||||
let dragData = RdDItemSheetV1.$extractDragData(event);
|
||||
if (!dragData) return false;
|
||||
const allowed = Hooks.call("dropActorSheetData", this.actor, this, dragData);
|
||||
if (allowed === false) return false;
|
||||
|
@ -56,10 +56,6 @@ export class RdDItemSort extends Item {
|
||||
return voies.map(voie => RdDItemCompetence.getVoieDraconic(competencesDraconic, voie))
|
||||
}
|
||||
|
||||
static getBestDraconicSort(competencesDraconic, sort) {
|
||||
return RdDItemSort.getDraconicsSort(competencesDraconic, sort).sort(Misc.descending(it => it.system.niveau)).find(it=>true)
|
||||
}
|
||||
|
||||
static getOrdreCode(code) {
|
||||
return (VOIES_DRACONIC.find(it => it.code == code)?.ordre ?? '?')
|
||||
}
|
||||
@ -96,7 +92,7 @@ export class RdDItemSort extends Item {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static isCoutVariable(sort) {
|
||||
return sort && !Number.isInteger(sort.system.ptreve) && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
|
||||
return sort && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -1,14 +1,14 @@
|
||||
import { HtmlUtility } from "../html-utility.js";
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { RdDRaretes } from "./raretes.js";
|
||||
|
||||
const TYPE_ITEMS_NATURELS = ["faune", "herbe", "plante", "ingredient"];
|
||||
|
||||
export class RdDItemInventaireSheet extends RdDItemSheet {
|
||||
export class RdDItemInventaireSheet extends RdDItemSheetV1 {
|
||||
|
||||
static get defaultOptions() {
|
||||
return foundry.utils.mergeObject(RdDItemSheet.defaultOptions, {
|
||||
return foundry.utils.mergeObject(RdDItemSheetV1.defaultOptions, {
|
||||
tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "informations" }]
|
||||
}, { inplace: false })
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
|
||||
export class RdDBlessureItemSheet extends RdDItemSheet {
|
||||
export class RdDBlessureItemSheet extends RdDItemSheetV1 {
|
||||
|
||||
static get ITEM_TYPE() { return "blessure" };
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { RdDRencontre } from "./rencontre.js";
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
|
||||
export class RdDRencontreItemSheet extends RdDItemSheet {
|
||||
export class RdDRencontreItemSheet extends RdDItemSheetV1 {
|
||||
|
||||
static get ITEM_TYPE() { return "rencontre" };
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
|
||||
export class RdDServiceItemSheet extends RdDItemSheet {
|
||||
export class RdDServiceItemSheet extends RdDItemSheetV1 {
|
||||
|
||||
static get ITEM_TYPE() { return "service" };
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
import { RdDItemSheet } from "../item-sheet.js";
|
||||
import { RdDItemSheetV1 } from "../item-sheet.js";
|
||||
import { RdDItemSigneDraconique } from "./signedraconique.js";
|
||||
import { TMRUtility } from "../tmr-utility.js";
|
||||
|
||||
/**
|
||||
* Item sheet pour signes draconiques
|
||||
* @extends {RdDItemSheet}
|
||||
* @extends {RdDItemSheetV1}
|
||||
*/
|
||||
export class RdDSigneDraconiqueItemSheet extends RdDItemSheet {
|
||||
export class RdDSigneDraconiqueItemSheet extends RdDItemSheetV1 {
|
||||
|
||||
static get ITEM_TYPE() { return "signedraconique" }
|
||||
|
||||
|
@ -265,7 +265,7 @@ export class Misc {
|
||||
const subset = elements.filter(options.preFilter)
|
||||
.filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it))?.includes(value))
|
||||
.sort(Misc.ascending(it => options.mapper(it)))
|
||||
if (subset.length == 0 && options?.onMessage) {
|
||||
if (subset.length == 0) {
|
||||
options.onMessage(`Pas de ${options.description} correspondant à ${value}`);
|
||||
}
|
||||
return subset;
|
||||
|
2
module/models/_module.mjs
Normal file
2
module/models/_module.mjs
Normal file
@ -0,0 +1,2 @@
|
||||
export { default as RdDModelMonnaie } from "./monnaie.mjs"
|
||||
export { default as RdDModelMunition } from "./munition.mjs"
|
10
module/models/monnaie.mjs
Normal file
10
module/models/monnaie.mjs
Normal file
@ -0,0 +1,10 @@
|
||||
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../common/_module.mjs";
|
||||
|
||||
export default class RdDModelMonnaie extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
return Object.assign({},
|
||||
TEMPLATE_DESCRIPTION.fields(),
|
||||
TEMPLATE_INVENTAIRE.fields()
|
||||
)
|
||||
}
|
||||
}
|
10
module/models/munition.mjs
Normal file
10
module/models/munition.mjs
Normal file
@ -0,0 +1,10 @@
|
||||
import { TEMPLATE_DESCRIPTION, TEMPLATE_INVENTAIRE } from "../common/_module.mjs";
|
||||
|
||||
export default class RdDModelMunition extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
return Object.assign({},
|
||||
TEMPLATE_DESCRIPTION.fields(),
|
||||
TEMPLATE_INVENTAIRE.fields()
|
||||
)
|
||||
}
|
||||
}
|
@ -743,13 +743,23 @@ export class RdDCombat {
|
||||
this.attacker.createCallbackExperience(),
|
||||
this.attacker.createCallbackAppelAuMoral(),
|
||||
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
|
||||
{ action: async r => await this.attacker.incDecItemUse(arme._id, arme && !RdDCombat.isParticuliere(r)) },
|
||||
{ action: r => this._onAttaque(r) },
|
||||
{ action: r => this._increaseItemUse(r, arme) },
|
||||
{ action: r => this._onAttaqueNormale(r) },
|
||||
{ action: r => this._onAttaqueParticuliere(r) },
|
||||
{ action: r => this._onAttaqueEchec(r) },
|
||||
{ action: r => this._onAttaqueEchecTotal(r) },
|
||||
]
|
||||
});
|
||||
dialog.render(true);
|
||||
}
|
||||
|
||||
_increaseItemUse(rollData, arme) {
|
||||
if (!arme || RdDCombat.isParticuliere(rollData)) {
|
||||
return
|
||||
}
|
||||
this.attacker.incDecItemUse(arme._id)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_prepareAttaque(competence, arme) {
|
||||
let rollData = {
|
||||
@ -766,7 +776,7 @@ export class RdDCombat {
|
||||
|
||||
if (this.attacker.isCreatureEntite()) {
|
||||
RdDItemCompetenceCreature.setRollDataCreature(rollData);
|
||||
}
|
||||
}
|
||||
else if (arme) {
|
||||
// Usual competence
|
||||
rollData.arme = RdDItemArme.armeUneOuDeuxMains(arme, RdDItemCompetence.isArmeUneMain(competence));
|
||||
@ -780,23 +790,11 @@ export class RdDCombat {
|
||||
return rollData;
|
||||
}
|
||||
|
||||
async _onAttaque(attackerRoll) {
|
||||
if (RdDCombat.isParticuliere(attackerRoll)) {
|
||||
return await this._onAttaqueParticuliere(attackerRoll)
|
||||
}
|
||||
if (RdDCombat.isReussite(attackerRoll)) {
|
||||
return await this._onAttaqueNormale(attackerRoll)
|
||||
}
|
||||
// if (RdDCombat.isParticuliere(attackerRoll) && attackerRoll.particuliere == undefined) {
|
||||
// return
|
||||
// }
|
||||
if (RdDCombat.isEchecTotal(attackerRoll)) {
|
||||
return await this._onAttaqueEchecTotal(attackerRoll)
|
||||
}
|
||||
return await this._onAttaqueEchec(attackerRoll)
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async _onAttaqueParticuliere(rollData) {
|
||||
if (!RdDCombat.isParticuliere(rollData)) {
|
||||
return
|
||||
}
|
||||
const isMeleeDiffNegative = (rollData.competence.type == 'competencecreature' || rollData.selectedCarac.label == "Mêlée") && rollData.diffLibre < 0;
|
||||
// force toujours, sauf empoignade
|
||||
// finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum
|
||||
@ -834,6 +832,9 @@ export class RdDCombat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onAttaqueNormale(attackerRoll) {
|
||||
if (!RdDCombat.isReussite(attackerRoll) || RdDCombat.isParticuliere(attackerRoll)) {
|
||||
return
|
||||
}
|
||||
console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll);
|
||||
|
||||
attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker, this.defender.isEntite());
|
||||
@ -848,7 +849,7 @@ export class RdDCombat {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.defender) {
|
||||
if (this.target) {
|
||||
await this._sendMessageDefense(attackerRoll, defenderRoll);
|
||||
}
|
||||
}
|
||||
@ -950,6 +951,9 @@ export class RdDCombat {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onAttaqueEchecTotal(attackerRoll) {
|
||||
if (!RdDCombat.isEchecTotal(attackerRoll)) {
|
||||
return
|
||||
}
|
||||
const choixEchecTotal = await ChatMessage.create({
|
||||
whisper: ChatUtility.getOwners(this.attacker),
|
||||
content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.hbs', {
|
||||
@ -976,20 +980,26 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onAttaqueEchec(attackerRoll) {
|
||||
console.log("RdDCombat.onAttaqueEchec >>>", attackerRoll);
|
||||
await RdDRollResult.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.hbs');
|
||||
async _onAttaqueEchec(rollData) {
|
||||
if (!RdDCombat.isEchec(rollData)) {
|
||||
return
|
||||
}
|
||||
console.log("RdDCombat.onAttaqueEchec >>>", rollData);
|
||||
await RdDRollResult.displayRollData(rollData, this.attacker, 'chat-resultat-attaque.hbs');
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async choixParticuliere(rollData, choix) {
|
||||
console.log("RdDCombat.choixParticuliere >>>", rollData, choix);
|
||||
|
||||
await this.attacker.incDecItemUse(rollData.arme.id, choix != "rapidite")
|
||||
if (choix != "rapidite") {
|
||||
this.attacker.incDecItemUse(rollData.arme.id);
|
||||
}
|
||||
|
||||
this.removeChatMessageActionsPasseArme(rollData.passeArme);
|
||||
rollData.particuliere = choix;
|
||||
await this._onAttaqueNormale(rollData)
|
||||
await this._onAttaqueNormale(rollData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1013,8 +1023,10 @@ export class RdDCombat {
|
||||
this.defender.createCallbackExperience(),
|
||||
this.defender.createCallbackAppelAuMoral(),
|
||||
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
|
||||
{ action: async r => await this.defender.incDecItemUse(armeParadeId, !RdDCombat.isParticuliere(r)) },
|
||||
{ action: r => this._onParade(r) },
|
||||
{ condition: r => !RdDCombat.isParticuliere(r), action: r => this.defender.incDecItemUse(armeParadeId) },
|
||||
{ condition: RdDCombat.isReussite, action: r => this._onParadeNormale(r) },
|
||||
{ condition: RdDCombat.isParticuliere, action: r => this._onParadeParticuliere(r) },
|
||||
{ condition: RdDCombat.isEchec, action: r => this._onParadeEchec(r) },
|
||||
]
|
||||
});
|
||||
dialog.render(true);
|
||||
@ -1045,19 +1057,8 @@ export class RdDCombat {
|
||||
return defenderRoll;
|
||||
}
|
||||
|
||||
|
||||
async _onParade(defenderRoll) {
|
||||
if (RdDCombat.isParticuliere(defenderRoll)) {
|
||||
return await this._onParadeParticuliere(defenderRoll)
|
||||
}
|
||||
if (RdDCombat.isReussite(defenderRoll)) {
|
||||
return await this._onParadeNormale(defenderRoll)
|
||||
}
|
||||
await this._onParadeEchec(defenderRoll)
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onParadeParticuliere(defenderRoll) {
|
||||
_onParadeParticuliere(defenderRoll) {
|
||||
console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll);
|
||||
if (!defenderRoll.attackerRoll.isPart) {
|
||||
// TODO: attaquant doit jouer résistance et peut être désarmé p132
|
||||
@ -1066,6 +1067,7 @@ export class RdDCombat {
|
||||
this.defender)
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async _onParadeNormale(defenderRoll) {
|
||||
console.log("RdDCombat._onParadeNormale >>>", defenderRoll);
|
||||
@ -1104,9 +1106,11 @@ export class RdDCombat {
|
||||
callbacks: [
|
||||
this.defender.createCallbackExperience(),
|
||||
this.defender.createCallbackAppelAuMoral(),
|
||||
{ action: async r => await this.defender.incDecItemUse(esquive._id, !RdDCombat.isParticuliere(r)) },
|
||||
{ condition: r => !RdDCombat.isParticuliere(r), action: r => this.defender.incDecItemUse(esquive._id) },
|
||||
{ action: r => this.removeChatMessageActionsPasseArme(r.passeArme) },
|
||||
{ action: r => this._onEsquive(r) },
|
||||
{ condition: RdDCombat.isReussite, action: r => this._onEsquiveNormale(r) },
|
||||
{ condition: RdDCombat.isParticuliere, action: r => this._onEsquiveParticuliere(r) },
|
||||
{ condition: RdDCombat.isEchec, action: r => this._onEsquiveEchec(r) },
|
||||
]
|
||||
});
|
||||
dialog.render(true);
|
||||
@ -1134,18 +1138,9 @@ export class RdDCombat {
|
||||
return rollData;
|
||||
}
|
||||
|
||||
async _onEsquive(defenderRoll) {
|
||||
if (RdDCombat.isParticuliere(defenderRoll)) {
|
||||
return await this._onEsquiveParticuliere(defenderRoll)
|
||||
}
|
||||
if (RdDCombat.isReussite(defenderRoll)) {
|
||||
return await this._onEsquiveNormale(defenderRoll)
|
||||
}
|
||||
return await this._onEsquiveEchec(defenderRoll)
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async _onEsquiveParticuliere(defenderRoll) {
|
||||
console.log("RdDCombat._onEsquiveParticuliere >>>", defenderRoll);
|
||||
_onEsquiveParticuliere(rollData) {
|
||||
console.log("RdDCombat._onEsquiveParticuliere >>>", rollData);
|
||||
ChatUtility.createChatWithRollMode(
|
||||
{ content: "<strong>Vous pouvez esquiver une deuxième fois!</strong>" },
|
||||
this.defender);
|
||||
|
@ -54,7 +54,7 @@ import { RdDItemSouffle } from "./item/souffle.js"
|
||||
|
||||
import { RdDRencontre } from "./item/rencontre.js"
|
||||
|
||||
import { RdDItemSheet } from "./item-sheet.js"
|
||||
import { RdDItemSheetV1 } from "./item-sheet.js"
|
||||
import { RdDBlessureItemSheet } from "./item/sheet-blessure.js"
|
||||
import { RdDServiceItemSheet } from "./item/sheet-service.js"
|
||||
import { RdDRencontreItemSheet } from "./item/sheet-rencontre.js"
|
||||
@ -80,6 +80,10 @@ import { RdDItemPotion } from "./item/potion.js"
|
||||
import { RdDItemGemme } from "./item/gemme.js"
|
||||
import { RdDGemmeItemSheet } from "./item/sheet-gemme.js"
|
||||
|
||||
import * as models from "./models/_module.mjs"
|
||||
import * as items from "./documents/_module.mjs"
|
||||
import * as sheets from "./applications/sheets/_module.mjs"
|
||||
|
||||
/**
|
||||
* RdD system
|
||||
* Author: LeRatierBretonnien
|
||||
@ -100,6 +104,8 @@ export class SystemReveDeDragon {
|
||||
this.RdDHotbar = RdDHotbar
|
||||
this.RdDStatBlockParser = RdDStatBlockParser
|
||||
this.itemClasses = {
|
||||
monnaie: items.RdDModelMonnaie,
|
||||
munition: items.RdDModelMunition,
|
||||
armure: RdDItemArmure,
|
||||
blessure: RdDItemBlessure,
|
||||
gemme: RdDItemGemme,
|
||||
@ -129,6 +135,9 @@ export class SystemReveDeDragon {
|
||||
/* -------------------------------------------- */
|
||||
onInit() {
|
||||
game.system.rdd = this
|
||||
|
||||
globalThis.RdD = game.system
|
||||
|
||||
this.AppAstrologie = AppAstrologie
|
||||
|
||||
console.log(`Initializing Reve de Dragon System Settings`)
|
||||
@ -175,6 +184,10 @@ export class SystemReveDeDragon {
|
||||
console.log(`Initializing Reve de Dragon Documents`)
|
||||
CONFIG.Actor.documentClass = RdDBaseActor
|
||||
CONFIG.Item.documentClass = RdDItem
|
||||
CONFIG.Item.dataModels = {
|
||||
monnaie: models.RdDModelMonnaie,
|
||||
munition: models.RdDModelMunition,
|
||||
}
|
||||
CONFIG.RDD = {
|
||||
resolutionTable: RdDResolutionTable.resolutionTable,
|
||||
carac_array: RdDUtility.getCaracArray(),
|
||||
@ -195,12 +208,15 @@ export class SystemReveDeDragon {
|
||||
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemInventaireSheet, {
|
||||
types: [
|
||||
"objet", "arme", "armure", "livre", "munition",
|
||||
"monnaie", "nourritureboisson",
|
||||
"objet", "arme", "armure", "livre", "nourritureboisson",
|
||||
],
|
||||
makeDefault: true
|
||||
})
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheet, {
|
||||
|
||||
sheets.RdDItemSheet.register(sheets.RdDMonnaieSheet)
|
||||
sheets.RdDItemSheet.register(sheets.RdDMunitionSheet)
|
||||
|
||||
Items.registerSheet(SYSTEM_RDD, RdDItemSheetV1, {
|
||||
types: [
|
||||
"competence", "competencecreature",
|
||||
"recettealchimique", "musique", "chant", "danse", "jeu", "race",
|
||||
@ -211,18 +227,18 @@ export class SystemReveDeDragon {
|
||||
],
|
||||
makeDefault: true
|
||||
})
|
||||
|
||||
RdDItemSheet.register(RdDBlessureItemSheet)
|
||||
RdDItemSheet.register(RdDConteneurItemSheet)
|
||||
RdDItemSheet.register(RdDFauneItemSheet)
|
||||
RdDItemSheet.register(RdDGemmeItemSheet)
|
||||
RdDItemSheet.register(RdDHerbeItemSheet)
|
||||
RdDItemSheet.register(RdDIngredientItemSheet)
|
||||
RdDItemSheet.register(RdDPlanteItemSheet)
|
||||
RdDItemSheet.register(RdDPotionItemSheet)
|
||||
RdDItemSheet.register(RdDRencontreItemSheet)
|
||||
RdDItemSheet.register(RdDServiceItemSheet)
|
||||
RdDItemSheet.register(RdDSigneDraconiqueItemSheet)
|
||||
|
||||
RdDItemSheetV1.register(RdDBlessureItemSheet)
|
||||
RdDItemSheetV1.register(RdDConteneurItemSheet)
|
||||
RdDItemSheetV1.register(RdDFauneItemSheet)
|
||||
RdDItemSheetV1.register(RdDGemmeItemSheet)
|
||||
RdDItemSheetV1.register(RdDHerbeItemSheet)
|
||||
RdDItemSheetV1.register(RdDIngredientItemSheet)
|
||||
RdDItemSheetV1.register(RdDPlanteItemSheet)
|
||||
RdDItemSheetV1.register(RdDPotionItemSheet)
|
||||
RdDItemSheetV1.register(RdDRencontreItemSheet)
|
||||
RdDItemSheetV1.register(RdDServiceItemSheet)
|
||||
RdDItemSheetV1.register(RdDSigneDraconiqueItemSheet)
|
||||
RdDJournalSheet.register()
|
||||
|
||||
// préparation des différents modules
|
||||
|
@ -104,8 +104,8 @@ export class RdDPossession {
|
||||
rollData.selectedCarac = carac.reve
|
||||
}
|
||||
else {
|
||||
rollData.selectedCarac = rollingActor.system.carac.reve
|
||||
rollData.forceCarac = { 'reve-actuel': { label: "Rêve Actuel", value: rollingActor.getReveActuel() } }
|
||||
rollData.selectedCarac = rollData.forceCarac['reve-actuel']
|
||||
rollData.competence.system.defaut_carac = 'reve-actuel'
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { ChatUtility } from "./chat-utility.js";
|
||||
import { Misc } from "./misc.js";
|
||||
import { RdDDice } from "./rdd-dice.js";
|
||||
import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
||||
|
@ -279,7 +279,7 @@ export class RdDRoll extends Dialog {
|
||||
|
||||
async setSelectedSort(sort) {
|
||||
this.rollData.selectedSort = sort; // Update the selectedCarac
|
||||
this.rollData.competence = RdDItemSort.getBestDraconicSort(this.rollData.draconicList, sort)
|
||||
this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.system.draconic);
|
||||
this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord);
|
||||
this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7);
|
||||
RdDItemSort.setCoutReveReel(sort);
|
||||
|
@ -15,6 +15,7 @@ import { ReglesOptionnelles } from "./settings/regles-optionnelles.js";
|
||||
import { RdDDice } from "./rdd-dice.js";
|
||||
import { STATUSES } from "./settings/status-effects.js";
|
||||
import { RdDRencontre } from "./item/rencontre.js";
|
||||
import { RdDTimestamp } from "./time/rdd-timestamp.js";
|
||||
import { ITEM_TYPES } from "./constants.js";
|
||||
import { Misc } from "./misc.js";
|
||||
|
||||
@ -82,7 +83,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
this.subdialog = undefined
|
||||
this.displaySize = undefined
|
||||
if (!this.viewOnly && !game.user.isGM) {
|
||||
this.$tellToGM(this.actor.name + " monte dans les terres médianes (" + tmrData.mode + ")");
|
||||
this._tellToGM(this.actor.name + " monte dans les terres médianes (" + tmrData.mode + ")");
|
||||
}
|
||||
this.callbacksOnAnimate = [];
|
||||
const displaySize = TMR_DISPLAY_SIZE.clamp(game.settings.get(SYSTEM_RDD, TMR_DISPLAY_SIZE.code) ?? TMR_DISPLAY_SIZE.def);
|
||||
@ -138,7 +139,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
this.cumulFatigue += this.fatigueParCase;
|
||||
|
||||
// Le reste...
|
||||
this.$updateValuesDisplay();
|
||||
this.updateValuesDisplay();
|
||||
}
|
||||
|
||||
lancerUnSort() {
|
||||
@ -189,7 +190,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
forceTMRContinueAction() {
|
||||
ui.notifications.warn('Vous devez finir votre action avant de continuer dans les TMR');
|
||||
this.bringSubDialogToTop();
|
||||
return false
|
||||
return;
|
||||
}
|
||||
|
||||
setTMRPendingAction(dialog) {
|
||||
@ -296,7 +297,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
const coordOrig = this._getCoordActor();
|
||||
const coordTarget = TMRUtility.deplacement(coordOrig, move);
|
||||
await this._deplacerDemiReve(coordTarget, 'normal');
|
||||
await this.$checkQuitterTMR();
|
||||
this.checkQuitterTMR();
|
||||
}
|
||||
|
||||
calculCoutMonteeTMR() {
|
||||
@ -304,7 +305,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $updateValuesDisplay() {
|
||||
async updateValuesDisplay() {
|
||||
if (this.viewOnly || !this.rendered) {
|
||||
return;
|
||||
}
|
||||
@ -335,30 +336,22 @@ export class RdDTMRDialog extends Dialog {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async close() {
|
||||
await this.$forceClose(this.actor.name + " a quitté les terres médianes")
|
||||
}
|
||||
|
||||
async $forceClose(message) {
|
||||
if (this.subdialog) {
|
||||
this.forceTMRContinueAction()
|
||||
return false
|
||||
return this.forceTMRContinueAction()
|
||||
}
|
||||
this.descenteTMR = true;
|
||||
if (this.actor.tmrApp) {
|
||||
this.actor.tmrApp = undefined; // Cleanup reference
|
||||
if (!this.viewOnly) {
|
||||
await this.actor.setEffect(STATUSES.StatusDemiReve, false);
|
||||
this.$tellToUserAndGM(message)
|
||||
await this.actor.setEffect(STATUSES.StatusDemiReve, false)
|
||||
this._tellToGM(this.actor.name + " a quitté les terres médianes");
|
||||
}
|
||||
const appliquerFatigue = ReglesOptionnelles.isUsing("appliquer-fatigue");
|
||||
await this.actor.santeIncDec(
|
||||
appliquerFatigue ? "fatigue" : "endurance",
|
||||
(appliquerFatigue ? 1 : -1) * this.cumulFatigue);
|
||||
await this.actor.santeIncDec((ReglesOptionnelles.isUsing("appliquer-fatigue") ? "fatigue" : "endurance"),
|
||||
this.cumulFatigue)
|
||||
}
|
||||
this.pixiTMR.close();
|
||||
this.pixiTMR = undefined
|
||||
await super.close();
|
||||
return true
|
||||
this.pixiTMR.close()
|
||||
this.pixiTMR = undefined
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -370,53 +363,48 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
switch (action) {
|
||||
case 'derober':
|
||||
await this.$derober()
|
||||
this.restoreTMRAfterAction()
|
||||
return
|
||||
await this.derober();
|
||||
this.restoreTMRAfterAction();
|
||||
return;
|
||||
case 'refouler':
|
||||
await this.$refouler()
|
||||
break
|
||||
await this.refouler();
|
||||
break;
|
||||
case 'maitriser':
|
||||
await this.$maitriserRencontre()
|
||||
break
|
||||
await this.maitriserRencontre();
|
||||
break;
|
||||
case 'ignorer':
|
||||
await this.$ignorerRencontre()
|
||||
break
|
||||
await this.ignorerRencontre();
|
||||
break;
|
||||
}
|
||||
await this.postRencontre(tmr);
|
||||
this.restoreTMRAfterAction();
|
||||
}
|
||||
|
||||
async $derober() {
|
||||
if (this.currentRencontre) {
|
||||
console.log("-> derober", this.currentRencontre);
|
||||
await this.actor.addTMRRencontre(this.currentRencontre);
|
||||
this.$forceClose(`${this.actor.name} s'est dérobé face à la rencontre ${this.currentRencontre.name}, et quitte les TMR.`)
|
||||
}
|
||||
async derober() {
|
||||
console.log("-> derober", this.currentRencontre);
|
||||
await this.actor.addTMRRencontre(this.currentRencontre);
|
||||
this._tellToGM(this.actor.name + " s'est dérobé et quitte les TMR.");
|
||||
this.close();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $refouler() {
|
||||
if (this.currentRencontre) {
|
||||
console.log("-> refouler", this.currentRencontre);
|
||||
await this.actor.ajouterRefoulement(this.currentRencontre.system.refoulement, `${this.currentRencontre.system.genre == 'f' ? 'une' : 'un'} ${this.currentRencontre.name}`);
|
||||
await this.$deleteRencontreTMRAtPosition()
|
||||
this.updateTokens();
|
||||
this.$updateValuesDisplay();
|
||||
this.$nettoyerRencontre();
|
||||
}
|
||||
async refouler() {
|
||||
console.log("-> refouler", this.currentRencontre);
|
||||
await this.actor.ajouterRefoulement(this.currentRencontre.system.refoulement, `${this.currentRencontre.system.genre == 'f' ? 'une' : 'un'} ${this.currentRencontre.name}`);
|
||||
await this.actor.deleteRencontreTMRAtPosition()
|
||||
this.updateTokens();
|
||||
this.updateValuesDisplay();
|
||||
this.nettoyerRencontre();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $ignorerRencontre() {
|
||||
if (this.currentRencontre) {
|
||||
console.log("-> ignorer", this.currentRencontre);
|
||||
this.$tellToGM(this.actor.name + " a ignoré: " + this.currentRencontre.name);
|
||||
await this.$deleteRencontreTMRAtPosition()
|
||||
this.updateTokens();
|
||||
this.$updateValuesDisplay();
|
||||
this.$nettoyerRencontre();
|
||||
}
|
||||
async ignorerRencontre() {
|
||||
console.log("-> ignorer", this.currentRencontre);
|
||||
this._tellToGM(this.actor.name + " a ignoré: " + this.currentRencontre.name);
|
||||
await this.actor.deleteRencontreTMRAtPosition()
|
||||
this.updateTokens();
|
||||
this.updateValuesDisplay();
|
||||
this.nettoyerRencontre();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -433,29 +421,41 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $checkQuitterTMR() {
|
||||
const reason = this.actor.isDead()
|
||||
? "est mort"
|
||||
: this.actor.isCumulFatigueCauseSommeil(this.cumulFatigue)
|
||||
? "s'écroule de fatigue"
|
||||
: (this.actor.getReveActuel() == 0)
|
||||
? "tombe à 0 Points de Rêve"
|
||||
: undefined
|
||||
if (reason) {
|
||||
if (!this.actor.isDead()) {
|
||||
await this.$refouler()
|
||||
}
|
||||
this.$forceClose(`${this.actor.name} ${reason} et quitte les Terres médianes !`)
|
||||
return true
|
||||
checkQuitterTMR() {
|
||||
if (this.actor.isDead()) {
|
||||
this._tellToGM("Vous êtes mort : vous quittez les Terres médianes !");
|
||||
this.close();
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
|
||||
if (ReglesOptionnelles.isUsing("appliquer-fatigue")
|
||||
? (this.actor.getFatigueRestante() <= this.cumulFatigue)
|
||||
: (this.actor.getEnduranceActuelle() <= this.cumulFatigue)
|
||||
) {
|
||||
this._tellToGM("Vous vous écroulez de fatigue : vous quittez les Terres médianes !");
|
||||
this.quitterLesTMRInconscient();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.actor.getReveActuel() == 0) {
|
||||
this._tellToGM("Vos Points de Rêve sont à 0 : vous quittez les Terres médianes !");
|
||||
this.quitterLesTMRInconscient();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $maitriserRencontre() {
|
||||
async quitterLesTMRInconscient() {
|
||||
await this.refouler();
|
||||
this.close();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async maitriserRencontre() {
|
||||
console.log("-> maitriser", this.currentRencontre);
|
||||
|
||||
await this.$deleteRencontreTMRAtPosition();
|
||||
await this.actor.deleteRencontreTMRAtPosition()
|
||||
this.updateTokens();
|
||||
|
||||
let rencontreData = {
|
||||
@ -470,21 +470,11 @@ export class RdDTMRDialog extends Dialog {
|
||||
tmr: TMRUtility.getTMR(this._getCoordActor())
|
||||
}
|
||||
|
||||
await this.$tentativeMaitrise(rencontreData);
|
||||
}
|
||||
|
||||
async $deleteRencontreTMRAtPosition() {
|
||||
const position = this.actor.getDemiReve()
|
||||
const rencontreIds = this.actor.itemTypes[ITEM_TYPES.rencontre]
|
||||
.filter(it => it.system.coord == position)
|
||||
.map(it => it.id)
|
||||
if (rencontreIds.length > 0) {
|
||||
await this.actor.deleteEmbeddedDocuments('Item', rencontreIds)
|
||||
}
|
||||
await this._tentativeMaitrise(rencontreData);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async $tentativeMaitrise(rencData) {
|
||||
async _tentativeMaitrise(rencData) {
|
||||
this.rencontreState = 'normal';
|
||||
|
||||
rencData.reve = this.actor.getReveActuel();
|
||||
@ -493,7 +483,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
RollDataAjustements.calcul(rencData, this.actor);
|
||||
|
||||
rencData.rolled = rencData.presentCite
|
||||
? this.$rollPresentCite(rencData)
|
||||
? this._rollPresentCite(rencData)
|
||||
: await RdDResolutionTable.roll(rencData.reve, RollDataAjustements.sum(rencData.ajustements));
|
||||
|
||||
const result = rencData.rolled.isSuccess
|
||||
@ -503,41 +493,38 @@ export class RdDTMRDialog extends Dialog {
|
||||
await RdDRencontre.appliquer(result.effets, this, rencData);
|
||||
|
||||
rencData.poesie = { extrait: result.poesie, reference: result.reference };
|
||||
rencData.message = this.$formatMessageRencontre(rencData, result.message);
|
||||
rencData.message = this.formatMessageRencontre(rencData, result.message);
|
||||
|
||||
ChatMessage.create({
|
||||
whisper: ChatUtility.getOwners(this.actor),
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-rencontre-tmr.hbs`, rencData)
|
||||
});
|
||||
|
||||
this.$updateValuesDisplay();
|
||||
if (await this.$checkQuitterTMR()) {
|
||||
this.updateValuesDisplay();
|
||||
if (this.checkQuitterTMR()) {
|
||||
return;
|
||||
}
|
||||
if (this.rencontreState == 'persistant') {
|
||||
this.$nouvelleTentativeMaitrise(rencData);
|
||||
this._nouvelleTentativeMaitrise(rencData);
|
||||
}
|
||||
else if (!this.isRencontreDeplacement()) {
|
||||
this.$nettoyerRencontre();
|
||||
this.nettoyerRencontre();
|
||||
}
|
||||
}
|
||||
|
||||
$nouvelleTentativeMaitrise(rencData) {
|
||||
_nouvelleTentativeMaitrise(rencData) {
|
||||
setTimeout(() => {
|
||||
/**
|
||||
* TODO: remplacer par une boucle while(this.currentRencontre) ?
|
||||
* ajouter un moyen d'attendre la saisie de l'utilisateur (jet obligatoire)?
|
||||
*/
|
||||
// TODO: remplacer par une boucle while(this.currentRencontre) ?
|
||||
rencData.nbRounds++;
|
||||
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
|
||||
this.cumulFatigue += this.fatigueParCase;
|
||||
}
|
||||
this.$tentativeMaitrise(rencData);
|
||||
this.$deleteTmrMessages(rencData.actor, rencData.nbRounds);
|
||||
this._tentativeMaitrise(rencData);
|
||||
this._deleteTmrMessages(rencData.actor, rencData.nbRounds);
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
$formatMessageRencontre(rencData, template) {
|
||||
formatMessageRencontre(rencData, template) {
|
||||
let messageDuree = ''
|
||||
if (rencData.nbRounds > 1) {
|
||||
if (rencData.rolled.isSuccess) {
|
||||
@ -556,7 +543,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
$rollPresentCite(rencData) {
|
||||
_rollPresentCite(rencData) {
|
||||
let rolled = RdDResolutionTable.computeChances(rencData.reve, 0);
|
||||
foundry.utils.mergeObject(rolled, { caracValue: rencData.reve, finalLevel: 0, roll: rolled.score });
|
||||
RdDResolutionTable.succesRequis(rolled);
|
||||
@ -564,7 +551,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
$deleteTmrMessages(actor, nbRounds = -1) {
|
||||
_deleteTmrMessages(actor, nbRounds = -1) {
|
||||
setTimeout(() => {
|
||||
if (nbRounds < 0) {
|
||||
ChatUtility.removeChatMessageContaining(`<h4 data-categorie="tmr" data-actor-id="${actor._id}"`);
|
||||
@ -583,7 +570,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
$tellToGM(message) {
|
||||
_tellToGM(message) {
|
||||
ChatMessage.create({
|
||||
user: game.user.id,
|
||||
content: message,
|
||||
@ -592,7 +579,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
$tellToUserAndGM(message) {
|
||||
_tellToUserAndGM(message) {
|
||||
ChatMessage.create({
|
||||
user: game.user.id,
|
||||
content: message,
|
||||
@ -614,7 +601,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
if (this.currentRencontre) {
|
||||
if (this.rencontresExistantes.find(it => it.id == this.currentRencontre.id)) {
|
||||
// rencontre en attente suite à dérobade
|
||||
await this.$maitriserRencontre();
|
||||
await this.maitriserRencontre();
|
||||
}
|
||||
else {
|
||||
const dialog = new RdDTMRRencontreDialog(this.actor, this.currentRencontre, tmr);
|
||||
@ -661,7 +648,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
tmr: tmr,
|
||||
presentCite: presentCite
|
||||
};
|
||||
await this.$tentativeMaitrise(rencontreData);
|
||||
await this._tentativeMaitrise(rencontreData);
|
||||
this.postRencontre(tmr);
|
||||
}
|
||||
|
||||
@ -740,7 +727,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
content: await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-resultat-maitrise-tmr.hbs`, rollData)
|
||||
});
|
||||
if (rollData.rolled.isEchec) {
|
||||
await this.$forceClose(`n'a pas maîtrisé la case ${rollData.tmr.label} et quitte les terres médianes`)
|
||||
await this.close();
|
||||
}
|
||||
await this.souffleSiEchecTotal(rollData);
|
||||
}
|
||||
@ -795,7 +782,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
onConqueteReussie: r => EffetsDraconiques.fermetureCites.onVisiteSupprimer(r.actor, tmr, (casetmr) => this.removeToken(tmr, casetmr)),
|
||||
onConqueteEchec: r => {
|
||||
this.souffleSiEchecTotal(rollData);
|
||||
this.$forceClose(`${this.actor.name} n'a pas maîtrisé la ${tmr.label}, et quitte les TMR.`)
|
||||
this.close()
|
||||
},
|
||||
canClose: false
|
||||
});
|
||||
@ -810,7 +797,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
onConqueteReussie: r => EffetsDraconiques.periple.onVisiteSupprimer(r.actor, tmr, (casetmr) => this.removeToken(tmr, casetmr)),
|
||||
onConqueteEchec: r => {
|
||||
this.souffleSiEchecTotal(rollData);
|
||||
this.$forceClose(`${this.actor.name} n'a pas purifié la ${tmr.label}, et quitte les TMR.`)
|
||||
this.close()
|
||||
},
|
||||
canClose: false
|
||||
});
|
||||
@ -824,7 +811,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
difficulte: -7,
|
||||
action: 'Conquérir',
|
||||
onConqueteReussie: r => EffetsDraconiques.conquete.onVisiteSupprimer(r.actor, tmr, (casetmr) => this.removeToken(tmr, casetmr)),
|
||||
onConqueteEchec: r => this.$forceClose(`${this.actor.name} n'a pas conquis la case ${tmr.label}, et quitte les TMR.`),
|
||||
onConqueteEchec: r => this.close(),
|
||||
canClose: false
|
||||
});
|
||||
}
|
||||
@ -935,15 +922,19 @@ export class RdDTMRDialog extends Dialog {
|
||||
/* -------------------------------------------- */
|
||||
async processSortReserve(sortReserve) {
|
||||
await this.actor.deleteEmbeddedDocuments('Item', [sortReserve.id]);
|
||||
console.log("declencheSortEnReserve", sortReserve)
|
||||
const sort = sortReserve.system.sortid ? this.actor.items.get(sortReserve.system.sortid) : undefined
|
||||
const message = await renderTemplate(`systems/foundryvtt-reve-de-dragon/templates/chat-lancement-sortreserve.hbs`,
|
||||
{ sortReserve, sort })
|
||||
await this.$forceClose(message)
|
||||
console.log("declencheSortEnReserve", sortReserve);
|
||||
const heureCible = RdDTimestamp.definition(sortReserve.system.heurecible).label;
|
||||
this._tellToUserAndGM(`Vous avez déclenché
|
||||
${sortReserve.system.echectotal ? "<strong>l'échec total!</strong>" : "le sort"}
|
||||
en réserve <strong>${sortReserve.name}</strong>
|
||||
avec ${sortReserve.system.ptreve} points de Rêve
|
||||
en ${sortReserve.system.coord} (${TMRUtility.getTMRLabel(sortReserve.system.coord)}).
|
||||
L'heure ciblée est ${heureCible}`);
|
||||
this.close();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
$nettoyerRencontre() {
|
||||
nettoyerRencontre() {
|
||||
// Suppression des dessins des zones possibles
|
||||
this.currentRencontre?.graphics?.forEach(graphic => this.pixiTMR.removeGraphic(graphic))
|
||||
// Nettoyage de la structureet de l'état
|
||||
@ -1030,7 +1021,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
console.log("STATUS :", this.rencontreState, this.currentRencontre);
|
||||
}
|
||||
|
||||
await this.$checkQuitterTMR();
|
||||
this.checkQuitterTMR();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -1063,13 +1054,13 @@ export class RdDTMRDialog extends Dialog {
|
||||
*/
|
||||
this.notifierResonanceSigneDraconique(targetCoord);
|
||||
await this.actor.rollUnSort(targetCoord);
|
||||
this.$nettoyerRencontre();
|
||||
this.nettoyerRencontre();
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
externalRefresh() {
|
||||
this.createPixiSprites();
|
||||
this.$updateValuesDisplay();
|
||||
this.updateValuesDisplay();
|
||||
this.updateTokens();
|
||||
console.log("TMR REFRESHED !!!");
|
||||
}
|
||||
@ -1080,7 +1071,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
return this.forceTMRContinueAction()
|
||||
}
|
||||
if (this.currentRencontre != 'normal') {
|
||||
this.$nettoyerRencontre();
|
||||
this.nettoyerRencontre();
|
||||
}
|
||||
let tmr = TMRUtility.getTMR(targetCoord);
|
||||
// Gestion cases spéciales type Trou noir, etc
|
||||
@ -1092,7 +1083,7 @@ export class RdDTMRDialog extends Dialog {
|
||||
if (ReglesOptionnelles.isUsing("appliquer-fatigue")) {
|
||||
this.cumulFatigue += this.fatigueParCase;
|
||||
}
|
||||
this.$updateValuesDisplay();
|
||||
this.updateValuesDisplay();
|
||||
this.actor.notifyRefreshTMR();
|
||||
|
||||
if (deplacementType == 'normal') { // Pas de rencontres après un saut de type passeur/changeur/...
|
||||
|
@ -318,7 +318,6 @@ export class RdDUtility {
|
||||
// gestion des dates et heures
|
||||
Handlebars.registerHelper('timestamp-imgSigneHeure', (heure) => { return new Handlebars.SafeString(RdDTimestamp.imgSigneHeure(heure)) });
|
||||
Handlebars.registerHelper('timestamp-imgSigne', (heure) => { return new Handlebars.SafeString(RdDTimestamp.imgSigne(heure)) });
|
||||
Handlebars.registerHelper('timestamp-definition', (heure) => RdDTimestamp.definition(heure))
|
||||
Handlebars.registerHelper('timestamp-extract', timestamp => new RdDTimestamp(timestamp).toCalendrier());
|
||||
Handlebars.registerHelper('timestamp-formulesDuree', () => RdDTimestamp.formulesDuree());
|
||||
Handlebars.registerHelper('timestamp-formulesPeriode', () => RdDTimestamp.formulesPeriode());
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"scripts": {
|
||||
"build": "npx vite build",
|
||||
"run": "npx vite serve",
|
||||
"packCompendiumsToDist": "node ./tools/packCompendiumsToDist.mjs",
|
||||
"packCompendiumsToPublic": "node ./tools/packCompendiumsToPublic.mjs",
|
||||
"unpackCompendiumsFromPublic": "node ./tools/unpackCompendiumsFromPublic.mjs"
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"id": "foundryvtt-reve-de-dragon",
|
||||
"title": "Rêve de Dragon",
|
||||
"version": "12.0.44",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.44/rddsystem.zip",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.44/system.json",
|
||||
"version": "12.0.38",
|
||||
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.38/rddsystem.zip",
|
||||
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.38/system.json",
|
||||
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
|
||||
"compatibility": {
|
||||
"minimum": "11",
|
||||
|
@ -742,9 +742,6 @@
|
||||
"objet": {
|
||||
"templates": ["description", "equipement", "inventaire"]
|
||||
},
|
||||
"monnaie": {
|
||||
"templates": ["description", "inventaire"]
|
||||
},
|
||||
"gemme": {
|
||||
"templates": ["description", "enchantable", "inventaire", "temporel"],
|
||||
"type": "",
|
||||
@ -753,9 +750,6 @@
|
||||
"inertie": 0,
|
||||
"enchantabilite": 0
|
||||
},
|
||||
"munition": {
|
||||
"templates": ["description", "inventaire"]
|
||||
},
|
||||
"nourritureboisson": {
|
||||
"templates": ["description", "inventaire", "comestible"],
|
||||
"cuisinier": "",
|
||||
|
@ -4,7 +4,8 @@
|
||||
<a class="chat-card-button forcer-tmr-aleatoire" data-tooltip="Ré-insérer aléatoirement le demi-rêve, et masquer la position au joueur">Ré-insertion aléatoire</a>
|
||||
</span>
|
||||
<span>
|
||||
<a class="chat-card-button afficher-tmr" data-tooltip="{{#if hautreve.cacheTMR}}Révéler la position du demi-rêve au joueur{{else}}Cacher la position du demi-rêve au joueur{{/if}}">{{#if hautreve.cacheTMR}}Révéler le demi-rêve{{else}}Cacher le demi-rêve{{/if}}</a>
|
||||
<a class="chat-card-button afficher-tmr"
|
||||
data-tooltip="{{#if hautreve.cacheTMR}}Montrer la position du demi-rêve au joueur{{else}}Cacher la position du demi-rêve au joueur{{/if}}">{{#if hautreve.cacheTMR}}Montrer les TMR{{else}}Cacher les TMR{{/if}}</a>
|
||||
</span>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
@ -1,18 +1,15 @@
|
||||
<div>
|
||||
<ul class="item-list">
|
||||
<li class="flexrow">
|
||||
<li class="item flexrow">
|
||||
<label class="derivee-label" for="system.compteurs.experience.value">Stress transformé</label>
|
||||
{{#if options.vueDetaillee}}
|
||||
<input class="resource-content"
|
||||
type="text" data-dtype="Number" size="3"
|
||||
name="system.compteurs.experience.value"
|
||||
value="{{system.compteurs.experience.value}}"/>
|
||||
<input class="derivee-value" type="number" name="system.compteurs.experience.value" value="{{system.compteurs.experience.value}}" data-dtype="number" size="3"/>
|
||||
{{else}}
|
||||
<label name="system.compteurs.experience.value">{{system.compteurs.experience.value}}</label>
|
||||
{{/if}}
|
||||
</li>
|
||||
{{#if options.vueDetaillee}}
|
||||
<li class="flexrow">
|
||||
<li class="item flexrow">
|
||||
<span class="generic-label">Total XP compétences</span>
|
||||
<span class="competence-value">{{calc.competenceXPTotal}}</span>
|
||||
</li>
|
||||
|
@ -2,22 +2,19 @@
|
||||
<h4 class="rdd-roll-part">{{alias}} réussit une attaque particulière!</strong></h4>
|
||||
{{#if isForce}}
|
||||
<br>
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="force" data-attackerId="{{attackerId}}"
|
||||
data-defenderTokenId="{{defenderToken.id}}" data-attackerTokenId="{{attackerToken.id}}">
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="force" data-attackerId="{{attackerId}}">
|
||||
Attaquer en Force
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if isRapide}}
|
||||
<br>
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="rapidite" data-attackerId="{{attackerId}}"
|
||||
data-defenderTokenId="{{defenderToken.id}}" data-attackerTokenId="{{attackerToken.id}}">
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="rapidite" data-attackerId="{{attackerId}}">
|
||||
Attaquer en Rapidité
|
||||
</a>
|
||||
{{/if}}
|
||||
{{#if isFinesse}}
|
||||
<br>
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="finesse" data-attackerId="{{attackerId}}"
|
||||
data-defenderTokenId="{{defenderToken.id}}" data-attackerTokenId="{{attackerToken.id}}">
|
||||
<a class="chat-card-button particuliere-attaque" data-mode="finesse" data-attackerId="{{attackerId}}">
|
||||
Attaquer en Finesse
|
||||
</a>
|
||||
{{/if}}
|
||||
|
@ -1,15 +0,0 @@
|
||||
<img class="chat-icon" src="{{sortReserve.img}}" data-tooltip="{{sortReserve.name}}"/>
|
||||
<p> Vous avez déclenché
|
||||
{{#if sortReserve.system.echectotal}}<strong>l'échec total</strong>{{else}}le sort{{/if}}
|
||||
en réserve
|
||||
<strong>{{sortReserve.name}}</strong>
|
||||
avec {{sortReserve.system.ptreve}} points de Rêve
|
||||
en {{sortReserve.system.coord}} ({{caseTmr-label sortReserve.system.coord}}).
|
||||
L'heure ciblée est {{sortReserve.system.heurecible}}
|
||||
{{timestamp-imgSigneHeure sortReserve.system.heurecible}}
|
||||
</p>
|
||||
{{#if sort}}
|
||||
<div class="poesie-extrait poesie-overflow">
|
||||
{{{sort.system.description}}}
|
||||
</div>
|
||||
{{/if}}
|
@ -4,7 +4,7 @@
|
||||
<hr>
|
||||
<div>
|
||||
{{#if rolled.isSuccess}}
|
||||
{{alias}} a gagné {{xpSort}} points d'expérience en sorts en {{competence.name}}.
|
||||
{{alias}} a gagné {{xpSort}} points d'expérience en sorts dans la {{competence.name}}.
|
||||
{{else}}
|
||||
{{alias}} n'a pas pu interpréter le signe draconique.
|
||||
{{/if}}
|
||||
|
14
templates/item/monnaie.hbs
Normal file
14
templates/item/monnaie.hbs
Normal file
@ -0,0 +1,14 @@
|
||||
<form class="{{cssClass}}" autocomplete="off">
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.hbs"}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
<a class="item" data-tab="informations">Informations</a>
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.hbs"}}
|
||||
</nav>
|
||||
<section class="sheet-body">
|
||||
<div class="tab items flexcol" data-group="primary" data-tab="informations">
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.hbs"}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.hbs"}}
|
||||
</div>
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.hbs"}}
|
||||
</section>
|
||||
</form>
|
14
templates/item/munition.hbs
Normal file
14
templates/item/munition.hbs
Normal file
@ -0,0 +1,14 @@
|
||||
<form class="{{cssClass}}" autocomplete="off">
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/header-item.hbs"}}
|
||||
<nav class="sheet-tabs tabs" data-group="primary">
|
||||
<a class="item" data-tab="informations">Informations</a>
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-tab-environnement.hbs"}}
|
||||
</nav>
|
||||
<section class="sheet-body">
|
||||
<div class="tab items flexcol" data-group="primary" data-tab="informations">
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-inventaire.hbs"}}
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/partial-item-description.hbs"}}
|
||||
</div>
|
||||
{{>"systems/foundryvtt-reve-de-dragon/templates/item/partial-environnement.hbs"}}
|
||||
</section>
|
||||
</form>
|
Loading…
x
Reference in New Issue
Block a user