Compare commits

...

7 Commits

Author SHA1 Message Date
9fa8a2e6f3 Merge pull request '12.0.44 - Les errements d'Astrobazzarh, suite' (#753) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: #753
2025-03-05 08:24:13 +01:00
da7f87fd45 Changelog 12.0.44 2025-03-04 23:06:39 +01:00
6aba92900c Fix erreurs sorts variables
- correction de la sélection de la voie de draconique pour
  sort à voie variable
- en cas de sort avec un coût en rêve numérique, ce n'est pas variable
2025-03-04 23:01:04 +01:00
4939e5564e Fix possessions 2025-03-04 22:46:28 +01:00
40be65a94e Merge pull request 'v11 - sommeil' (#752) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
Reviewed-on: #752
2025-03-04 22:11:00 +01:00
633638a9ab Fix récupération sommeil
Les différentsq updates pouvaient ne pas être visibles lors du sommeil

En forçant un render 20ms après la fin des actions qui impliquent un
sommeil, les mises à jour sont correctes
2025-03-04 22:04:52 +01:00
88a3464eed Add command to run debug server 2025-03-04 21:32:21 +01:00
7 changed files with 48 additions and 39 deletions

View File

@ -1,4 +1,11 @@
# 12.0
## 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)

View File

@ -243,7 +243,7 @@ export class RdDActor extends RdDBaseActorSang {
}
await this.resetInfoSommeil()
ChatMessage.create(message);
this.sheet.render(true);
setTimeout(() => this.sheet.render(), 20)
}
async _recuperationSante(message) {
@ -299,7 +299,7 @@ export class RdDActor extends RdDBaseActorSang {
ChatMessage.create(message);
}
await this.resetInfoSommeil();
this.sheet.render(true);
setTimeout(() => this.sheet.render(), 20)
}
}
@ -442,10 +442,9 @@ export class RdDActor extends RdDBaseActorSang {
message.content += 'Vous ne trouvez pas le sommeil';
}
else {
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. `;
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. `;
}
if (dormi.etat == 'eveil') {
await this.reveilReveDeDragon(message, dormi.heures);
@ -461,7 +460,7 @@ export class RdDActor extends RdDBaseActorSang {
await this.dormirChateauDormant();
}
else {
this.sheet.render(true);
setTimeout(() => this.sheet.render(), 20)
}
}
@ -472,18 +471,18 @@ export class RdDActor extends RdDBaseActorSang {
}
}
async dormirDesHeures(jetsReve, message, heures, options) {
const dormi = { heures: 0, etat: 'dort' };
async $dormirDesHeures(message, heures, options) {
const dormi = { heures: 0, etat: 'dort', jetsReve: [] };
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);
dormi.etat = await this.jetRecuperationReve(jetsReve, message);
await this.$recupererFatigue(message);
await this.$jetRecuperationReve(dormi, message);
if (dormi.etat == 'dort' && EffetsDraconiques.isDonDoubleReve(this)) {
dormi.etat = await this.jetRecuperationReve(jetsReve, message);
dormi.etat = await this.$jetRecuperationReve(dormi, message);
}
}
}
@ -491,35 +490,36 @@ export class RdDActor extends RdDBaseActorSang {
}
/* -------------------------------------------- */
async jetRecuperationReve(jetsReve, message) {
async $jetRecuperationReve(dormi, message) {
if (this.getReveActuel() < this.system.reve.seuil.value) {
let reve = await RdDDice.rollTotal("1dr");
const 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);
jetsReve.push(-1);
return 'eveil';
dormi.jetsReve.push(-1);
dormi.etat = 'eveil'
return
}
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)`
});
jetsReve.push(0);
})
dormi.jetsReve.push(0)
}
else {
await this.reveActuelIncDec(reve);
jetsReve.push(reve);
await this.reveActuelIncDec(reve)
dormi.jetsReve.push(reve)
}
}
}
return 'dort';
dormi.etat = '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) {
@ -549,18 +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));
setTimeout( // On attend un peu pour que le message de récupération de r
async () => {
await this.update({ 'system.sante.fatigue.value': fatigue });
}, 200);
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é. ";
}

View File

@ -56,6 +56,10 @@ 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 ?? '?')
}
@ -92,7 +96,7 @@ export class RdDItemSort extends Item {
/* -------------------------------------------- */
static isCoutVariable(sort) {
return sort && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
return sort && !Number.isInteger(sort.system.ptreve) && (sort.system.ptreve.toLowerCase() == "variable" || sort.system.ptreve.indexOf("+") >= 0);
}
/* -------------------------------------------- */

View File

@ -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'
}
}

View File

@ -279,7 +279,7 @@ export class RdDRoll extends Dialog {
async setSelectedSort(sort) {
this.rollData.selectedSort = sort; // Update the selectedCarac
this.rollData.competence = RdDItemCompetence.getVoieDraconic(this.rollData.draconicList, sort.system.draconic);
this.rollData.competence = RdDItemSort.getBestDraconicSort(this.rollData.draconicList, sort)
this.rollData.bonus = RdDItemSort.getCaseBonus(sort, this.rollData.tmr.coord);
this.rollData.diffLibre = RdDItemSort.getDifficulte(sort, -7);
RdDItemSort.setCoutReveReel(sort);

View File

@ -1,6 +1,7 @@
{
"scripts": {
"build": "npx vite build",
"run": "npx vite serve",
"packCompendiumsToDist": "node ./tools/packCompendiumsToDist.mjs",
"packCompendiumsToPublic": "node ./tools/packCompendiumsToPublic.mjs",
"unpackCompendiumsFromPublic": "node ./tools/unpackCompendiumsFromPublic.mjs"

View File

@ -1,9 +1,9 @@
{
"id": "foundryvtt-reve-de-dragon",
"title": "Rêve de Dragon",
"version": "12.0.42",
"download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.42/rddsystem.zip",
"manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.42/system.json",
"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",
"changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md",
"compatibility": {
"minimum": "11",