forked from public/foundryvtt-reve-de-dragon
		
	Compare commits
	
		
			7 Commits
		
	
	
		
			111fac2b2d
			...
			427a950954
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 427a950954 | |||
| a7b20bdd35 | |||
| 3b18e0b919 | |||
| ff8a5d7ba3 | |||
| 3aa8c0f0af | |||
| 8d9f09c18c | |||
| 9d654246c2 | 
| @@ -1,4 +1,13 @@ | ||||
| # 12.0 | ||||
| ## 12.0.8 - La quincaillerie d'Astrobazzarh | ||||
| - le propriétaire est indiqué dans les feuilles d'équipements/compétences/... | ||||
| - Ecaille d'efficacité | ||||
|   - l'écaille d'efficacité est prise en compte même si on n'utilise pas le ciblage en combat | ||||
|   - l'écaille d'efficacité est prise en compte pour l'initiative | ||||
| - Corrections | ||||
|   - l'état général est pris en compte pour les initiatives | ||||
|   - le tooltip de l'initiative affiche correctement l'initiative | ||||
|  | ||||
| ## 12.0.7 - La propriété d'Astrobazzarh | ||||
| - correction des opérations faites à la création d'un Item: | ||||
|   - la durée des queues/rencontres/souffles | ||||
|   | ||||
| @@ -318,10 +318,10 @@ export class RdDBaseActorReve extends RdDBaseActor { | ||||
|   } | ||||
|  | ||||
|   /* -------------------------------------------- */ | ||||
|   async rollCompetence(idOrName, options = { tryTarget: true }) { | ||||
|   async rollCompetence(idOrName, options = { tryTarget: true, arme: undefined }) { | ||||
|     RdDEmpoignade.checkEmpoignadeEnCours(this) | ||||
|     const competence = this.getCompetence(idOrName); | ||||
|     let rollData = { carac: this.system.carac, competence: competence } | ||||
|     let rollData = { carac: this.system.carac, competence: competence, arme: options.arme } | ||||
|     if (competence.type == TYPES.competencecreature) { | ||||
|       const arme = RdDItemCompetenceCreature.armeCreature(competence) | ||||
|       if (arme && options.tryTarget && Targets.hasTargets()) { | ||||
| @@ -361,7 +361,7 @@ export class RdDBaseActorReve extends RdDBaseActor { | ||||
|    * @returns  | ||||
|    */ | ||||
|   rollArme(arme, categorieArme = "competence") { | ||||
|     let compToUse = this.$getCompetenceArme(arme, categorieArme) | ||||
|     const compToUse = this.$getCompetenceArme(arme, categorieArme) | ||||
|     if (!RdDItemArme.isArmeUtilisable(arme)) { | ||||
|       ui.notifications.warn(`Arme inutilisable: ${arme.name} a une résistance de 0 ou moins`) | ||||
|       return | ||||
| @@ -375,7 +375,7 @@ export class RdDBaseActorReve extends RdDBaseActor { | ||||
|         title: 'Ne pas utiliser les automatisation de combat', | ||||
|         buttonLabel: "Pas d'automatisation", | ||||
|         onAction: async () => { | ||||
|           this.rollCompetence(compToUse, { tryTarget: false }) | ||||
|           this.rollCompetence(compToUse, { tryTarget: false, arme: arme }) | ||||
|         } | ||||
|       }); | ||||
|       return | ||||
|   | ||||
| @@ -53,7 +53,8 @@ export class RdDItemSheet extends ItemSheet { | ||||
|   } | ||||
|  | ||||
|   get title() { | ||||
|     return `${Misc.typeName('Item', this.item.type)}: ${this.item.name}`; | ||||
|     const owner = (this.item.parent instanceof Actor) ? `(${this.item.parent.name})` : ''; | ||||
|     return `${Misc.typeName('Item', this.item.type)}: ${this.item.name} ${owner}`; | ||||
|   } | ||||
|  | ||||
|   /* -------------------------------------------- */ | ||||
|   | ||||
| @@ -75,6 +75,12 @@ export class RdDCombatManager extends Combat { | ||||
|       } | ||||
|     } | ||||
|   } | ||||
|   static calculAjustementInit(actor, arme) { | ||||
|     const efficacite = (arme?.system.magique) ? arme.system.ecaille_efficacite : 0 | ||||
|     const etatGeneral = actor.getEtatGeneral() ?? 0 | ||||
|     return efficacite + etatGeneral | ||||
|  | ||||
|   } | ||||
|  | ||||
|   /************************************************************************************/ | ||||
|   async rollInitiative(ids, formula = undefined, messageOptions = {}) { | ||||
| @@ -84,12 +90,14 @@ export class RdDCombatManager extends Combat { | ||||
|     // calculate initiative | ||||
|     for (let cId = 0; cId < ids.length; cId++) { | ||||
|       const combatant = this.combatants.get(ids[cId]); | ||||
|       let rollFormula = formula ?? RdDCombatManager.formuleInitiative(2, 10, 0, 0); | ||||
|       const ajustement = RdDCombatManager.calculAjustementInit(combatant.actor, undefined); | ||||
|       let rollFormula = formula ?? RdDCombatManager.formuleInitiative(2, 10, 0, ajustement); | ||||
|  | ||||
|       if (!formula) { | ||||
|         if (combatant.actor.type == 'creature' || combatant.actor.type == 'entite') { | ||||
|           const competence = combatant.actor.items.find(it => RdDItemCompetenceCreature.isCompetenceAttaque(it)) | ||||
|           if (competence) { | ||||
|             rollFormula = RdDCombatManager.formuleInitiative(2, competence.system.carac_value, competence.system.niveau, 0); | ||||
|             rollFormula = RdDCombatManager.formuleInitiative(2, competence.system.carac_value, competence.system.niveau, etatGeneral); | ||||
|           } | ||||
|         } else { | ||||
|           const armeCombat = combatant.actor.itemTypes['arme'].find(it => it.system.equipe) | ||||
| @@ -109,8 +117,9 @@ export class RdDCombatManager extends Combat { | ||||
|           if (competence && competence.system.defaut_carac) { | ||||
|             const carac = combatant.actor.system.carac[competence.system.defaut_carac].value; | ||||
|             const niveau = competence.system.niveau; | ||||
|             const bonusEcaille = (armeCombat?.system.magique) ? armeCombat.system.ecaille_efficacite : 0; | ||||
|             rollFormula = RdDCombatManager.formuleInitiative(2, carac, niveau, bonusEcaille); | ||||
|  | ||||
|             const ajustement = RdDCombatManager.calculAjustementInit(combatant.actor, armeCombat) | ||||
|             rollFormula = RdDCombatManager.formuleInitiative(2, carac, niveau, ajustement); | ||||
|           } else { | ||||
|             ui.notifications.warn(`Votre arme ${armeCombat.name} n'a pas de compétence renseignée`); | ||||
|           } | ||||
| @@ -214,13 +223,16 @@ export class RdDCombatManager extends Combat { | ||||
|  | ||||
|   static $prepareAttaqueArme(infoAttaque) { | ||||
|     const comp = infoAttaque.competences.find(c => c.name == infoAttaque.competence); | ||||
|     const attaque = foundry.utils.duplicate(infoAttaque.arme); | ||||
|     const arme = infoAttaque.arme; | ||||
|     const attaque = foundry.utils.duplicate(arme); | ||||
|     attaque.action = 'attaque'; | ||||
|     attaque.system.competence = infoAttaque.competence; | ||||
|     attaque.system.dommagesReels = infoAttaque.dommagesReel; | ||||
|     attaque.system.infoMain = infoAttaque.infoMain; | ||||
|     attaque.system.niveau = comp.system.niveau; | ||||
|     attaque.system.initiative = RdDCombatManager.calculInitiative(comp.system.niveau, infoAttaque.carac[comp.system.defaut_carac].value); | ||||
|  | ||||
|     const ajustement = (arme?.parent?.getEtatGeneral() ?? 0) + (arme?.system.magique) ? arme.system.ecaille_efficacite : 0; | ||||
|     attaque.system.initiative = RdDCombatManager.calculInitiative(comp.system.niveau, infoAttaque.carac[comp.system.defaut_carac].value, ajustement); | ||||
|     return attaque; | ||||
|   } | ||||
|  | ||||
| @@ -335,7 +347,6 @@ export class RdDCombatManager extends Combat { | ||||
|       ui.notifications.warn(`Le combatant ${combatant.name} n'est pas associé à un acteur, impossible de déterminer ses actions de combat!`) | ||||
|       return []; | ||||
|     } | ||||
|  | ||||
|     let initInfo = ""; | ||||
|     let initOffset = 0; | ||||
|     let caracForInit = 0; | ||||
| @@ -370,9 +381,9 @@ export class RdDCombatManager extends Combat { | ||||
|       initOffset = RdDCombatManager._baseInitOffset(compData.system.categorie, action); | ||||
|     } | ||||
|  | ||||
|     let malus = combatant.actor.getEtatGeneral(); // Prise en compte état général  | ||||
|     // Cas des créatures et entités vs personnages | ||||
|     let rollFormula = RdDCombatManager.formuleInitiative(initOffset, caracForInit, compNiveau, malus); | ||||
|     const ajustement = RdDCombatManager.calculAjustementInit(combatant.actor, action) | ||||
|     let rollFormula = RdDCombatManager.formuleInitiative(initOffset, caracForInit, compNiveau, ajustement); | ||||
|     // Garder la trace de l'arme/compétence utilisée pour l'iniative | ||||
|     combatant.initiativeData = { arme: action } // pour reclasser l'init au round 0 | ||||
|     game.combat.rollInitiative(combatantId, rollFormula, { initInfo: initInfo }); | ||||
| @@ -787,7 +798,7 @@ export class RdDCombat { | ||||
|   /* -------------------------------------------- */ | ||||
|   _prepareAttaque(competence, arme) { | ||||
|     let rollData = { | ||||
|       passeArme: randomID(16), | ||||
|       passeArme: foundry.utils.randomID(16), | ||||
|       mortalite: arme?.system.mortalite, | ||||
|       competence: competence, | ||||
|       surprise: this.attacker.getSurprise(true), | ||||
|   | ||||
| @@ -427,7 +427,7 @@ export class RdDEmpoignade { | ||||
|       name: "Empoignade en cours de " + attacker.name + ' sur ' + defender.name, | ||||
|       type: 'empoignade', | ||||
|       img: "systems/foundryvtt-reve-de-dragon/icons/entites/possession2.webp", | ||||
|       system: { description: "", empoignadeid: randomID(16), compteempoigne: 0, empoigneurid: attacker.id, empoigneid: defender.id, ptsemp: 0, empoigneurname: attacker.name, empoignename: defender.name } | ||||
|       system: { description: "", empoignadeid: foundry.utils.randomID(16), compteempoigne: 0, empoigneurid: attacker.id, empoigneid: defender.id, ptsemp: 0, empoigneurname: attacker.name, empoignename: defender.name } | ||||
|     }, | ||||
|       { | ||||
|         temporary: true | ||||
|   | ||||
| @@ -230,7 +230,7 @@ export class RdDPossession { | ||||
|       system: { | ||||
|         description: "", typepossession: attacker.name, | ||||
|         possede: false, | ||||
|         possessionid: randomID(16), | ||||
|         possessionid: foundry.utils.randomID(16), | ||||
|         entite: { actorid: attacker.id }, | ||||
|         victime: { actorid: defender.id }, | ||||
|         compteur: 0 | ||||
|   | ||||
| @@ -769,7 +769,7 @@ export class RdDUtility { | ||||
|   /* -------------------------------------------- */ | ||||
|   static createMonnaie(name, cout, img = "", enc = 0.01) { | ||||
|     let piece = { | ||||
|       name: name, type: 'monnaie', img: img, _id: randomID(16), | ||||
|       name: name, type: 'monnaie', img: img, _id: foundry.utils.randomID(16), | ||||
|       dasystemta: { | ||||
|         quantite: 0, | ||||
|         cout: cout, | ||||
|   | ||||
| @@ -111,7 +111,7 @@ export const referenceAjustements = { | ||||
|     isVisible: (rollData, actor) => rollData.arme?.system.magique && Number(rollData.arme?.system.ecaille_efficacite) > 0, | ||||
|     isUsed: (rollData, actor) => rollData.arme?.system.magique && Number(rollData.arme?.system.ecaille_efficacite) > 0, | ||||
|     getLabel: (rollData, actor) => "Ecaille d'Efficacité: ", | ||||
|     getValue: (rollData, actor) => Math.max(Number(rollData.arme?.system.ecaille_efficacite), 0), | ||||
|     getValue: (rollData, actor) => rollData.arme?.system.magique ? Math.max(Number(rollData.arme?.system.ecaille_efficacite), 0) : 0, | ||||
|   }, | ||||
|   finesse: { | ||||
|     isUsed: (rollData, actor) => RdDBonus.isDefenseAttaqueFinesse(rollData), | ||||
|   | ||||
| @@ -1374,7 +1374,7 @@ table.table-nombres-astraux tr:hover { | ||||
|   flex-direction: column; | ||||
|   position: absolute; | ||||
|   top: 4.6rem; | ||||
|   right: 3.5rem; | ||||
|   left: -19rem; | ||||
| } | ||||
| .token-hud-ext.soins { | ||||
|   flex-direction: column; | ||||
|   | ||||
| @@ -25,7 +25,7 @@ | ||||
|     <span class="competence-value">{{plusMoins arme.system.niveau}}</span> | ||||
|     <span class="competence-value">{{plusMoins arme.system.dommagesReels}}</span> | ||||
|     <span class="competence-value"></span> | ||||
|     <span class="initiative-value arme-initiative"><a data-tooltip="{{arme.name}}: initiative {{plusMoins arme.system.initiative}}">{{arme.system.initiative}}</a></span> | ||||
|     <span class="initiative-value arme-initiative"><a data-tooltip="{{arme.name}}: initiative {{arme.system.initiative}}">{{arme.system.initiative}}</a></span> | ||||
|   </li> | ||||
|   {{/each}} | ||||
|   {{#each esquives as |esq key|}} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user