Merge pull request 'La loupe d'Astrobazzar' (#748) from VincentVk/foundryvtt-reve-de-dragon:v11 into v11
All checks were successful
Release Creation / build (release) Successful in 1m27s

Reviewed-on: #748
This commit is contained in:
uberwald 2025-02-09 00:30:52 +01:00
commit 89bbe63340
7 changed files with 41 additions and 29 deletions

View File

@ -1,4 +1,8 @@
# 12.0 # 12.0
## 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 ## 12.0.40 - Les mains d'Astrobazzarh
- correction des attaques particulières en combat - 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) - correction de message sur les min/max liés aux modificateurs de races (s'applique uniquement sur la taille)

View File

@ -237,7 +237,11 @@ 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('.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-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.html.find('.competence-stress-augmenter').click(async event =>{
await this.actor.updateCompetenceStress(RdDSheetUtility.getItemId(event))
this.render(true)
}
)
if (this.options.vueDetaillee) { if (this.options.vueDetaillee) {
// On carac change // On carac change

View File

@ -736,7 +736,7 @@ export class RdDActor extends RdDBaseActorSang {
await competence.update({ await competence.update({
"system.xp": toXp, "system.xp": toXp,
"system.niveau": toNiveau, "system.niveau": toNiveau,
}); }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name); await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name);
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name); await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name);
} }
@ -767,7 +767,7 @@ export class RdDActor extends RdDBaseActorSang {
await competence.update({ await competence.update({
"system.xp": newXp, "system.xp": newXp,
"system.niveau": toNiveau, "system.niveau": toNiveau,
}); }, { render: false })
const toXpStress = Math.max(0, fromXpStress - xpUtilise); const toXpStress = Math.max(0, fromXpStress - xpUtilise);
await this.update({ "system.compteurs.experience.value": toXpStress }); await this.update({ "system.compteurs.experience.value": toXpStress });
@ -783,7 +783,7 @@ export class RdDActor extends RdDBaseActorSang {
const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories()); const toNiveau = compValue ?? RdDItemCompetence.getNiveauBase(competence.system.categorie, competence.getCategories());
this.notifyCompetencesTronc(competence, toNiveau); this.notifyCompetencesTronc(competence, toNiveau);
const fromNiveau = competence.system.niveau; const fromNiveau = competence.system.niveau;
await competence.update({ 'system.niveau': toNiveau }); await competence.update({ 'system.niveau': toNiveau }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true); await ExperienceLog.add(this, XP_TOPIC.NIVEAU, fromNiveau, toNiveau, competence.name, true);
} }
} }
@ -808,7 +808,7 @@ export class RdDActor extends RdDBaseActorSang {
if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0; if (isNaN(toXp) || typeof (toXp) != 'number') toXp = 0;
const fromXp = competence.system.xp; const fromXp = competence.system.xp;
this.checkCompetenceXP(idOrName, toXp); this.checkCompetenceXP(idOrName, toXp);
await competence.update({ 'system.xp': toXp }); await competence.update({ 'system.xp': toXp }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true); await ExperienceLog.add(this, XP_TOPIC.XP, fromXp, toXp, competence.name, true);
if (toXp > fromXp) { if (toXp > fromXp) {
RdDUtility.checkThanatosXP(competence) RdDUtility.checkThanatosXP(competence)
@ -822,7 +822,7 @@ export class RdDActor extends RdDBaseActorSang {
if (competence) { if (competence) {
if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0; if (isNaN(toXpSort) || typeof (toXpSort) != 'number') toXpSort = 0;
const fromXpSort = competence.system.xp_sort; const fromXpSort = competence.system.xp_sort;
await competence.update({ 'system.xp_sort': toXpSort }); await competence.update({ 'system.xp_sort': toXpSort }, { render: false })
await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true); await ExperienceLog.add(this, XP_TOPIC.XPSORT, fromXpSort, toXpSort, competence.name, true);
if (toXpSort > fromXpSort) { if (toXpSort > fromXpSort) {
RdDUtility.checkThanatosXP(competence) RdDUtility.checkThanatosXP(competence)
@ -834,7 +834,7 @@ export class RdDActor extends RdDBaseActorSang {
async updateCompetenceArchetype(idOrName, compValue) { async updateCompetenceArchetype(idOrName, compValue) {
let competence = this.getCompetence(idOrName) let competence = this.getCompetence(idOrName)
if (competence) { if (competence) {
await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) }); await competence.update({ 'system.niveau_archetype': Math.max(compValue ?? 0, 0) })
} }
} }
@ -2527,7 +2527,6 @@ export class RdDActor extends RdDBaseActorSang {
}) })
} }
const blessure = this.getItem(blessureId, 'blessure') const blessure = this.getItem(blessureId, 'blessure')
console.log('TODO update blessure', this, blessureId, rollData, rollData.tache);
if (blessure && !blessure.system.premierssoins.done) { if (blessure && !blessure.system.premierssoins.done) {
const tache = rollData.tache; const tache = rollData.tache;
if (rollData.rolled.isETotal) { if (rollData.rolled.isETotal) {

View File

@ -244,16 +244,19 @@ export class RdDBaseActor extends Actor {
async onUpdateActor(update, options, actorId) { } async onUpdateActor(update, options, actorId) { }
async onDeleteItem(item, options, id) { async onDeleteItem(item, options, id) {
if (item.isInventaire()) { if (item.isInventaire()) {
this._removeItemFromConteneur(item) await this._removeItemFromConteneur(item)
} }
} }
_removeItemFromConteneur(item) { async _removeItemFromConteneur(item) {
this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id)) const updates = this.items.filter(it => it.isConteneur() && it.system.contenu.includes(item.id))
.forEach(conteneur => { .map(conteneur => {
const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id); const nouveauContenu = conteneur.system.contenu.filter(id => id != item.id)
conteneur.update({ 'system.contenu': nouveauContenu }); return { _id: conteneur.id, 'system.contenu': nouveauContenu }
}); })
if (updates.length > 0) {
await this.updateEmbeddedDocuments('Item', updates)
}
} }
async onTimeChanging(oldTimestamp, newTimestamp) { async onTimeChanging(oldTimestamp, newTimestamp) {

View File

@ -62,7 +62,6 @@ export class ChatUtility {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
static removeMessages(socketData) { static removeMessages(socketData) {
if (Misc.isFirstConnectedGM()) { if (Misc.isFirstConnectedGM()) {
ChatUtility.onRemoveMessages(socketData); ChatUtility.onRemoveMessages(socketData);
@ -97,7 +96,7 @@ export class ChatUtility {
} }
break break
case "gmroll": case "gmroll":
messageData.whisper = ChatUtility.getOwners(actor) messageData.whisper = actor ? ChatUtility.getOwners(actor) : ChatUtility.getUserAndGMs()
break break
case "selfroll": case "selfroll":
messageData.whisper = [game.user] messageData.whisper = [game.user]
@ -108,7 +107,7 @@ export class ChatUtility {
} }
static getOwners(document) { static getOwners(document) {
return game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) return document ? game.users.filter(it => document.getUserLevel(it) == CONST.DOCUMENT_OWNERSHIP_LEVELS.OWNER) : [game.user]
} }
static getUserAndGMs() { static getUserAndGMs() {

View File

@ -1,15 +1,18 @@
<div> <div>
<ul class="item-list"> <ul class="item-list">
<li class="item flexrow"> <li class="flexrow">
<label class="derivee-label" for="system.compteurs.experience.value">Stress transformé</label> <label class="derivee-label" for="system.compteurs.experience.value">Stress transformé</label>
{{#if options.vueDetaillee}} {{#if options.vueDetaillee}}
<input class="derivee-value" type="number" name="system.compteurs.experience.value" value="{{system.compteurs.experience.value}}" data-dtype="number" size="3"/> <input class="resource-content"
type="text" data-dtype="Number" size="3"
name="system.compteurs.experience.value"
value="{{system.compteurs.experience.value}}"/>
{{else}} {{else}}
<label name="system.compteurs.experience.value">{{system.compteurs.experience.value}}</label> <label name="system.compteurs.experience.value">{{system.compteurs.experience.value}}</label>
{{/if}} {{/if}}
</li> </li>
{{#if options.vueDetaillee}} {{#if options.vueDetaillee}}
<li class="item flexrow"> <li class="flexrow">
<span class="generic-label">Total XP compétences</span> <span class="generic-label">Total XP compétences</span>
<span class="competence-value">{{calc.competenceXPTotal}}</span> <span class="competence-value">{{calc.competenceXPTotal}}</span>
</li> </li>

View File

@ -4,7 +4,7 @@
<hr> <hr>
<div> <div>
{{#if rolled.isSuccess}} {{#if rolled.isSuccess}}
{{alias}} a gagné {{xpSort}} points d'expérience en sorts dans la {{competence.name}}. {{alias}} a gagné {{xpSort}} points d'expérience en sorts en {{competence.name}}.
{{else}} {{else}}
{{alias}} n'a pas pu interpréter le signe draconique. {{alias}} n'a pas pu interpréter le signe draconique.
{{/if}} {{/if}}