Compare commits
	
		
			12 Commits
		
	
	
		
			5d8da860c4
			...
			12.0.43
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 921e470498 | |||
| 0009876a6d | |||
| 54785f0c3a | |||
| df76c4bd78 | |||
| 5f3c678195 | |||
| 89bbe63340 | |||
| 149990e352 | |||
| 3e355784c7 | |||
| b92055d5dd | |||
| 220f8142f5 | |||
| a8bb00ad0b | |||
| 78e30b5503 | 
							
								
								
									
										12
									
								
								changelog.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								changelog.md
									
									
									
									
									
								
							| @@ -1,4 +1,16 @@ | |||||||
| # 12.0 | # 12.0 | ||||||
|  | ## 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 | ## 12.0.39 - Les mains d'Astrobazzarh | ||||||
| - les armes à 1 ou 2 mains fonctionnent dans les liens de jets de dés | - 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 | - commande `/jet` pour poster une demande de jet de dés | ||||||
|   | |||||||
| @@ -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 | ||||||
|   | |||||||
| @@ -557,7 +557,10 @@ export class RdDActor extends RdDBaseActorSang { | |||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|       fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue)); |       fatigue = Math.max(fatigueMin, this._calculRecuperationSegment(fatigue)); | ||||||
|       await this.update({ "system.sante.fatigue.value": 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); | ||||||
|       if (fatigue == 0) { |       if (fatigue == 0) { | ||||||
|         message.content += "Vous êtes complêtement reposé. "; |         message.content += "Vous êtes complêtement reposé. "; | ||||||
|       } |       } | ||||||
| @@ -736,7 +739,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 +770,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 +786,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 +811,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 +825,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 +837,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) }) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -1800,8 +1803,10 @@ export class RdDActor extends RdDBaseActorSang { | |||||||
|     }; |     }; | ||||||
|     RollDataAjustements.calcul(rollData, this); |     RollDataAjustements.calcul(rollData, this); | ||||||
|     await RdDResolutionTable.rollData(rollData); |     await RdDResolutionTable.rollData(rollData); | ||||||
|     this.gererExperience(rollData); |  | ||||||
|     await RdDRollResult.displayRollData(rollData, this) |     await RdDRollResult.displayRollData(rollData, this) | ||||||
|  |  | ||||||
|  |     this.gererExperience(rollData); | ||||||
|  |  | ||||||
|     return rollData.rolled; |     return rollData.rolled; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -2527,7 +2532,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) { | ||||||
| @@ -2644,12 +2648,13 @@ export class RdDActor extends RdDBaseActorSang { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async incDecItemUse(itemId, inc = 1) { |   async incDecItemUse(itemId, shouldIncrease = true) { | ||||||
|  |     if (shouldIncrease) { | ||||||
|       const currentItemUse = this.getFlag(SYSTEM_RDD, 'itemUse'); |       const currentItemUse = this.getFlag(SYSTEM_RDD, 'itemUse'); | ||||||
|       let itemUse = currentItemUse ? foundry.utils.duplicate(currentItemUse) : {}; |       let itemUse = currentItemUse ? foundry.utils.duplicate(currentItemUse) : {}; | ||||||
|     itemUse[itemId] = (itemUse[itemId] ?? 0) + inc; |       itemUse[itemId] = (itemUse[itemId] ?? 0) + 1; | ||||||
|       await this.setFlag(SYSTEM_RDD, 'itemUse', itemUse); |       await this.setFlag(SYSTEM_RDD, 'itemUse', itemUse); | ||||||
|     console.log("ITEM USE INC", inc, itemUse); |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   | |||||||
| @@ -277,14 +277,9 @@ export class RdDBaseActorReve extends RdDBaseActor { | |||||||
|     return dialog |     return dialog | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   createEmptyCallback() { |   createCallbackExperience() { return { action: r => { } } } | ||||||
|     return { |   createCallbackAppelAuMoral() { return { action: r => { } } } | ||||||
|       condition: r => false, |  | ||||||
|       action: r => { } |  | ||||||
|     }; |  | ||||||
|   } |  | ||||||
|   createCallbackExperience() { return this.createEmptyCallback(); } |  | ||||||
|   createCallbackAppelAuMoral() { return this.createEmptyCallback(); } |  | ||||||
|   async _onCloseRollDialog(html) { } |   async _onCloseRollDialog(html) { } | ||||||
|  |  | ||||||
|   async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) { |   async rollCaracCompetence(caracName, compName, diff, options = { title: "" }) { | ||||||
|   | |||||||
| @@ -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) { | ||||||
| @@ -744,7 +747,7 @@ export class RdDBaseActor extends Actor { | |||||||
|   async jetDeMoral() { this.actionImpossible("jet de moral") } |   async jetDeMoral() { this.actionImpossible("jet de moral") } | ||||||
|  |  | ||||||
|   async resetItemUse() { } |   async resetItemUse() { } | ||||||
|   async incDecItemUse(itemId, inc = 1) { } |   async incDecItemUse(itemId, shouldIncrease = true) { } | ||||||
|   getItemUse(itemId) { return 0; } |   getItemUse(itemId) { return 0; } | ||||||
|  |  | ||||||
|   async finDeRound(options = { terminer: false }) { } |   async finDeRound(options = { terminer: false }) { } | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ import { RdDUtility } from "../../rdd-utility.js"; | |||||||
| import { TextRollManager } from "./text-roll-formatter.js"; | import { TextRollManager } from "./text-roll-formatter.js"; | ||||||
|  |  | ||||||
| const REGECP_CARAC = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)" | const REGECP_CARAC = "(?<carac>[A-Za-zÀ-ÖØ-öø-ÿ\\s\\-]+)" | ||||||
| const REGEXP_COMP = "(\\/(?<competence>[A-Za-z0-9À-ÖØ-öø-ÿ -]+))?" | const REGEXP_COMP = "(\\/(?<competence>[A-Za-zÀ-ÖØ-öø-ÿ ]+([1-2]?[A-Za-zÀ-ÖØ-öø-ÿ ]+)?))?" | ||||||
| const REGEXP_DIFF = "(/(?<diff>[\\+\\-]?\\d+(d\\d+)?))?" | const REGEXP_DIFF = "(/(?<diff>[\\+\\-]?\\d+(d\\d+)?))?" | ||||||
| const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF | const REGEXP_ROLL_CARAC_COMP = REGECP_CARAC + REGEXP_COMP + REGEXP_DIFF | ||||||
| const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu') | const XREGEXP_ROLL_CARAC_COMP = XRegExp("@roll\\[" + REGEXP_ROLL_CARAC_COMP + "\\]", 'giu') | ||||||
|   | |||||||
| @@ -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() { | ||||||
|   | |||||||
| @@ -19,11 +19,13 @@ export class RdDItemRace extends RdDItem { | |||||||
|         return false |         return false | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |     if (code == LIST_CARAC_PERSONNAGE.taille.code) { | ||||||
|       const carac = RdDCarac.carac(code) |       const carac = RdDCarac.carac(code) | ||||||
|       if (race.isMax(actor, code, value - 1)) { |       if (race.isMax(actor, code, value - 1)) { | ||||||
|         ui.notifications.warn(`${value} est supérieure au maximum de ${carac.label}`) |         ui.notifications.warn(`${value} est supérieure au maximum de ${carac.label}`) | ||||||
|         return false |         return false | ||||||
|       } |       } | ||||||
|  |     } | ||||||
|     return true |     return true | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -59,7 +61,8 @@ export class RdDItemRace extends RdDItem { | |||||||
|     if (code == LIST_CARAC_PERSONNAGE.force.code) { |     if (code == LIST_CARAC_PERSONNAGE.force.code) { | ||||||
|       return value >= this.getForceMax(actor) |       return value >= this.getForceMax(actor) | ||||||
|     } |     } | ||||||
|     const max = foundry.utils.getProperty(this, path) ?? -1 |     const pathMax = path.replace(".value", ".max"); | ||||||
|  |     const max = foundry.utils.getProperty(this, pathMax) ?? -1 | ||||||
|     return (max > 0 && value >= max) |     return (max > 0 && value >= max) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -265,7 +265,7 @@ export class Misc { | |||||||
|     const subset = elements.filter(options.preFilter) |     const subset = elements.filter(options.preFilter) | ||||||
|       .filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it))?.includes(value)) |       .filter(it => Grammar.toLowerCaseNoAccent(options.mapper(it))?.includes(value)) | ||||||
|       .sort(Misc.ascending(it => options.mapper(it))) |       .sort(Misc.ascending(it => options.mapper(it))) | ||||||
|     if (subset.length == 0) { |     if (subset.length == 0 && options?.onMessage) { | ||||||
|       options.onMessage(`Pas de ${options.description} correspondant à ${value}`); |       options.onMessage(`Pas de ${options.description} correspondant à ${value}`); | ||||||
|     } |     } | ||||||
|     return subset; |     return subset; | ||||||
|   | |||||||
| @@ -743,23 +743,13 @@ export class RdDCombat { | |||||||
|           this.attacker.createCallbackExperience(), |           this.attacker.createCallbackExperience(), | ||||||
|           this.attacker.createCallbackAppelAuMoral(), |           this.attacker.createCallbackAppelAuMoral(), | ||||||
|           { action: r => this.removeChatMessageActionsPasseArme(r.passeArme) }, |           { action: r => this.removeChatMessageActionsPasseArme(r.passeArme) }, | ||||||
|           { action: r => this._increaseItemUse(r, arme) }, |           { action: async r => await this.attacker.incDecItemUse(arme._id, arme && !RdDCombat.isParticuliere(r)) }, | ||||||
|           { action: r => this._onAttaqueNormale(r) }, |           { action: r => this._onAttaque(r) }, | ||||||
|           { action: r => this._onAttaqueParticuliere(r) }, |  | ||||||
|           { action: r => this._onAttaqueEchec(r) }, |  | ||||||
|           { action: r => this._onAttaqueEchecTotal(r) }, |  | ||||||
|         ] |         ] | ||||||
|       }); |       }); | ||||||
|     dialog.render(true); |     dialog.render(true); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   _increaseItemUse(rollData, arme) { |  | ||||||
|     if (!arme || RdDCombat.isParticuliere(rollData)) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     this.attacker.incDecItemUse(arme._id) |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   _prepareAttaque(competence, arme) { |   _prepareAttaque(competence, arme) { | ||||||
|     let rollData = { |     let rollData = { | ||||||
| @@ -790,11 +780,23 @@ export class RdDCombat { | |||||||
|     return rollData; |     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) { |   async _onAttaqueParticuliere(rollData) { | ||||||
|     if (!RdDCombat.isParticuliere(rollData)) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     const isMeleeDiffNegative = (rollData.competence.type == 'competencecreature' || rollData.selectedCarac.label == "Mêlée") && rollData.diffLibre < 0; |     const isMeleeDiffNegative = (rollData.competence.type == 'competencecreature' || rollData.selectedCarac.label == "Mêlée") && rollData.diffLibre < 0; | ||||||
|     // force toujours, sauf empoignade |     // force toujours, sauf empoignade | ||||||
|     // finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum |     // finesse seulement en mélée, pour l'empoignade, ou si la difficulté libre est de -1 minimum | ||||||
| @@ -832,9 +834,6 @@ export class RdDCombat { | |||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async _onAttaqueNormale(attackerRoll) { |   async _onAttaqueNormale(attackerRoll) { | ||||||
|     if (!RdDCombat.isReussite(attackerRoll) || RdDCombat.isParticuliere(attackerRoll)) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll); |     console.log("RdDCombat.onAttaqueNormale >>>", attackerRoll); | ||||||
|  |  | ||||||
|     attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker, this.defender.isEntite()); |     attackerRoll.dmg = RdDBonus.dmg(attackerRoll, this.attacker, this.defender.isEntite()); | ||||||
| @@ -849,7 +848,7 @@ export class RdDCombat { | |||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (this.target) { |     if (this.defender) { | ||||||
|       await this._sendMessageDefense(attackerRoll, defenderRoll); |       await this._sendMessageDefense(attackerRoll, defenderRoll); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -951,9 +950,6 @@ export class RdDCombat { | |||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async _onAttaqueEchecTotal(attackerRoll) { |   async _onAttaqueEchecTotal(attackerRoll) { | ||||||
|     if (!RdDCombat.isEchecTotal(attackerRoll)) { |  | ||||||
|       return |  | ||||||
|     } |  | ||||||
|     const choixEchecTotal = await ChatMessage.create({ |     const choixEchecTotal = await ChatMessage.create({ | ||||||
|       whisper: ChatUtility.getOwners(this.attacker), |       whisper: ChatUtility.getOwners(this.attacker), | ||||||
|       content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.hbs', { |       content: await renderTemplate('systems/foundryvtt-reve-de-dragon/templates/chat-demande-attaque-etotal.hbs', { | ||||||
| @@ -980,26 +976,20 @@ export class RdDCombat { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async _onAttaqueEchec(rollData) { |   async _onAttaqueEchec(attackerRoll) { | ||||||
|     if (!RdDCombat.isEchec(rollData)) { |     console.log("RdDCombat.onAttaqueEchec >>>", attackerRoll); | ||||||
|       return |     await RdDRollResult.displayRollData(attackerRoll, this.attacker, 'chat-resultat-attaque.hbs'); | ||||||
|     } |  | ||||||
|     console.log("RdDCombat.onAttaqueEchec >>>", rollData); |  | ||||||
|     await RdDRollResult.displayRollData(rollData, this.attacker, 'chat-resultat-attaque.hbs'); |  | ||||||
|  |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async choixParticuliere(rollData, choix) { |   async choixParticuliere(rollData, choix) { | ||||||
|     console.log("RdDCombat.choixParticuliere >>>", rollData, choix); |     console.log("RdDCombat.choixParticuliere >>>", rollData, choix); | ||||||
|  |  | ||||||
|     if (choix != "rapidite") { |     await this.attacker.incDecItemUse(rollData.arme.id, choix != "rapidite") | ||||||
|       this.attacker.incDecItemUse(rollData.arme.id); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     this.removeChatMessageActionsPasseArme(rollData.passeArme); |     this.removeChatMessageActionsPasseArme(rollData.passeArme); | ||||||
|     rollData.particuliere = choix; |     rollData.particuliere = choix; | ||||||
|     await this._onAttaqueNormale(rollData); |     await this._onAttaqueNormale(rollData) | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
| @@ -1023,10 +1013,8 @@ export class RdDCombat { | |||||||
|           this.defender.createCallbackExperience(), |           this.defender.createCallbackExperience(), | ||||||
|           this.defender.createCallbackAppelAuMoral(), |           this.defender.createCallbackAppelAuMoral(), | ||||||
|           { action: r => this.removeChatMessageActionsPasseArme(r.passeArme) }, |           { action: r => this.removeChatMessageActionsPasseArme(r.passeArme) }, | ||||||
|           { condition: r => !RdDCombat.isParticuliere(r), action: r => this.defender.incDecItemUse(armeParadeId) }, |           { action: async r => await this.defender.incDecItemUse(armeParadeId, !RdDCombat.isParticuliere(r)) }, | ||||||
|           { condition: RdDCombat.isReussite, action: r => this._onParadeNormale(r) }, |           { action: r => this._onParade(r) }, | ||||||
|           { condition: RdDCombat.isParticuliere, action: r => this._onParadeParticuliere(r) }, |  | ||||||
|           { condition: RdDCombat.isEchec, action: r => this._onParadeEchec(r) }, |  | ||||||
|         ] |         ] | ||||||
|       }); |       }); | ||||||
|     dialog.render(true); |     dialog.render(true); | ||||||
| @@ -1057,8 +1045,19 @@ export class RdDCombat { | |||||||
|     return defenderRoll; |     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) | ||||||
|  |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   _onParadeParticuliere(defenderRoll) { |   async _onParadeParticuliere(defenderRoll) { | ||||||
|     console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll); |     console.log("RdDCombat._onParadeParticuliere >>>", defenderRoll); | ||||||
|     if (!defenderRoll.attackerRoll.isPart) { |     if (!defenderRoll.attackerRoll.isPart) { | ||||||
|       // TODO: attaquant doit jouer résistance et peut être désarmé p132 |       // TODO: attaquant doit jouer résistance et peut être désarmé p132 | ||||||
| @@ -1067,7 +1066,6 @@ export class RdDCombat { | |||||||
|         this.defender) |         this.defender) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async _onParadeNormale(defenderRoll) { |   async _onParadeNormale(defenderRoll) { | ||||||
|     console.log("RdDCombat._onParadeNormale >>>", defenderRoll); |     console.log("RdDCombat._onParadeNormale >>>", defenderRoll); | ||||||
| @@ -1106,11 +1104,9 @@ export class RdDCombat { | |||||||
|         callbacks: [ |         callbacks: [ | ||||||
|           this.defender.createCallbackExperience(), |           this.defender.createCallbackExperience(), | ||||||
|           this.defender.createCallbackAppelAuMoral(), |           this.defender.createCallbackAppelAuMoral(), | ||||||
|           { condition: r => !RdDCombat.isParticuliere(r), action: r => this.defender.incDecItemUse(esquive._id) }, |           { action: async r => await this.defender.incDecItemUse(esquive._id, !RdDCombat.isParticuliere(r)) }, | ||||||
|           { action: r => this.removeChatMessageActionsPasseArme(r.passeArme) }, |           { action: r => this.removeChatMessageActionsPasseArme(r.passeArme) }, | ||||||
|           { condition: RdDCombat.isReussite, action: r => this._onEsquiveNormale(r) }, |           { action: r => this._onEsquive(r) }, | ||||||
|           { condition: RdDCombat.isParticuliere, action: r => this._onEsquiveParticuliere(r) }, |  | ||||||
|           { condition: RdDCombat.isEchec, action: r => this._onEsquiveEchec(r) }, |  | ||||||
|         ] |         ] | ||||||
|       }); |       }); | ||||||
|     dialog.render(true); |     dialog.render(true); | ||||||
| @@ -1138,9 +1134,18 @@ export class RdDCombat { | |||||||
|     return rollData; |     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) | ||||||
|  |   } | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   _onEsquiveParticuliere(rollData) { |   async _onEsquiveParticuliere(defenderRoll) { | ||||||
|     console.log("RdDCombat._onEsquiveParticuliere >>>", rollData); |     console.log("RdDCombat._onEsquiveParticuliere >>>", defenderRoll); | ||||||
|     ChatUtility.createChatWithRollMode( |     ChatUtility.createChatWithRollMode( | ||||||
|       { content: "<strong>Vous pouvez esquiver une deuxième fois!</strong>" }, |       { content: "<strong>Vous pouvez esquiver une deuxième fois!</strong>" }, | ||||||
|       this.defender); |       this.defender); | ||||||
|   | |||||||
| @@ -1,4 +1,3 @@ | |||||||
| import { ChatUtility } from "./chat-utility.js"; |  | ||||||
| import { Misc } from "./misc.js"; | import { Misc } from "./misc.js"; | ||||||
| import { RdDDice } from "./rdd-dice.js"; | import { RdDDice } from "./rdd-dice.js"; | ||||||
| import { ReglesOptionnelles } from "./settings/regles-optionnelles.js"; | import { ReglesOptionnelles } from "./settings/regles-optionnelles.js"; | ||||||
|   | |||||||
| @@ -1,9 +1,9 @@ | |||||||
| { | { | ||||||
|   "id": "foundryvtt-reve-de-dragon", |   "id": "foundryvtt-reve-de-dragon", | ||||||
|   "title": "Rêve de Dragon", |   "title": "Rêve de Dragon", | ||||||
|   "version": "12.0.38", |   "version": "12.0.42", | ||||||
|   "download": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.38/rddsystem.zip", |   "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.38/system.json", |   "manifest": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/releases/download/12.0.42/system.json", | ||||||
|   "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", |   "changelog": "https://www.uberwald.me/gitea/public/foundryvtt-reve-de-dragon/raw/branch/v11/changelog.md", | ||||||
|   "compatibility": { |   "compatibility": { | ||||||
|     "minimum": "11", |     "minimum": "11", | ||||||
|   | |||||||
| @@ -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> | ||||||
|   | |||||||
| @@ -2,19 +2,22 @@ | |||||||
|   <h4 class="rdd-roll-part">{{alias}} réussit une attaque particulière!</strong></h4> |   <h4 class="rdd-roll-part">{{alias}} réussit une attaque particulière!</strong></h4> | ||||||
|   {{#if isForce}} |   {{#if isForce}} | ||||||
|   <br> |   <br> | ||||||
|   <a class="chat-card-button particuliere-attaque" data-mode="force" data-attackerId="{{attackerId}}"> |   <a class="chat-card-button particuliere-attaque" data-mode="force" data-attackerId="{{attackerId}}" | ||||||
|  |     data-defenderTokenId="{{defenderToken.id}}" data-attackerTokenId="{{attackerToken.id}}"> | ||||||
|     Attaquer en Force |     Attaquer en Force | ||||||
|   </a> |   </a> | ||||||
|   {{/if}} |   {{/if}} | ||||||
|   {{#if isRapide}} |   {{#if isRapide}} | ||||||
|   <br> |   <br> | ||||||
|   <a class="chat-card-button particuliere-attaque" data-mode="rapidite" data-attackerId="{{attackerId}}"> |   <a class="chat-card-button particuliere-attaque" data-mode="rapidite" data-attackerId="{{attackerId}}" | ||||||
|  |     data-defenderTokenId="{{defenderToken.id}}" data-attackerTokenId="{{attackerToken.id}}"> | ||||||
|     Attaquer en Rapidité |     Attaquer en Rapidité | ||||||
|   </a> |   </a> | ||||||
|   {{/if}} |   {{/if}} | ||||||
|   {{#if isFinesse}} |   {{#if isFinesse}} | ||||||
|   <br> |   <br> | ||||||
|   <a class="chat-card-button particuliere-attaque" data-mode="finesse" data-attackerId="{{attackerId}}"> |   <a class="chat-card-button particuliere-attaque" data-mode="finesse" data-attackerId="{{attackerId}}" | ||||||
|  |     data-defenderTokenId="{{defenderToken.id}}" data-attackerTokenId="{{attackerToken.id}}"> | ||||||
|     Attaquer en Finesse |     Attaquer en Finesse | ||||||
|   </a> |   </a> | ||||||
|   {{/if}} |   {{/if}} | ||||||
|   | |||||||
| @@ -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}} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user