forked from public/foundryvtt-reve-de-dragon
		
	Merge branch 'v1.4-fix-182' into 'v1.4'
Fix xp des compétences tronc #182 See merge request LeRatierBretonnien/foundryvtt-reve-de-dragon!194
This commit is contained in:
		| @@ -153,8 +153,8 @@ export class RdDItemCompetence extends Item { | |||||||
|       list => list.map(name => RdDItemCompetence.findCompetence(competences, name)) |       list => list.map(name => RdDItemCompetence.findCompetence(competences, name)) | ||||||
|           // calcul du coût xp jusqu'au niveau 0 maximum |           // calcul du coût xp jusqu'au niveau 0 maximum | ||||||
|           .map(it => RdDItemCompetence.computeDeltaXP(it?.data.base ?? -11, Math.min(it?.data.niveau ?? -11, 0))) |           .map(it => RdDItemCompetence.computeDeltaXP(it?.data.base ?? -11, Math.min(it?.data.niveau ?? -11, 0))) | ||||||
|         .sort(Misc.descending(x => x)) |           .sort(Misc.ascending())  | ||||||
|         .splice(0, 1) // ignorer le coût xp le plus élevé |           .splice(0, list.length-1) // prendre toutes les valeurs sauf l'une des plus élevées | ||||||
|           .reduce(Misc.sum(), 0) |           .reduce(Misc.sum(), 0) | ||||||
|     ).reduce(Misc.sum(), 0); |     ).reduce(Misc.sum(), 0); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -22,11 +22,11 @@ export class Misc { | |||||||
|     return (a, b) => a + b; |     return (a, b) => a + b; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   static ascending(orderFunction) { |   static ascending(orderFunction = x=>x) { | ||||||
|     return (a, b) => Misc.sortingBy(orderFunction(a), orderFunction(b)); |     return (a, b) => Misc.sortingBy(orderFunction(a), orderFunction(b)); | ||||||
|   }   |   }   | ||||||
|  |  | ||||||
|   static descending(orderFunction) { |   static descending(orderFunction = x=>x) { | ||||||
|     return (a, b) => Misc.sortingBy(orderFunction(b), orderFunction(a)); |     return (a, b) => Misc.sortingBy(orderFunction(b), orderFunction(a)); | ||||||
|   }   |   }   | ||||||
|  |  | ||||||
|   | |||||||
| @@ -219,14 +219,15 @@ export class RdDRoll extends Dialog { | |||||||
|       this.rollData.dmg.mortalite = event.currentTarget.checked ? "non-mortel" : "mortel"; |       this.rollData.dmg.mortalite = event.currentTarget.checked ? "non-mortel" : "mortel"; | ||||||
|       this.updateRollResult(); |       this.updateRollResult(); | ||||||
|     }); |     }); | ||||||
|     html.find('#tactique-combat').change((event) => { |  | ||||||
|       this.rollData.tactique = event.currentTarget.value; |  | ||||||
|       this.updateRollResult(); |  | ||||||
|     }); |  | ||||||
|     html.find('.cuisine-proportions').change((event) => { |     html.find('.cuisine-proportions').change((event) => { | ||||||
|       this.rollData.proportions = Number(event.currentTarget.value); |       this.rollData.proportions = Number(event.currentTarget.value); | ||||||
|       this.updateRollResult(); |       this.updateRollResult(); | ||||||
|     }); |     }); | ||||||
|  |     html.find('.select-by-name').change((event) => { | ||||||
|  |       const attribute = event.currentTarget.attributes['name'].value; | ||||||
|  |       this.rollData[attribute] = event.currentTarget.value; | ||||||
|  |       this.updateRollResult(); | ||||||
|  |     }); | ||||||
|     html.find('.checkbox-by-name').change((event) => { |     html.find('.checkbox-by-name').change((event) => { | ||||||
|       const attribute = event.currentTarget.attributes['name'].value; |       const attribute = event.currentTarget.attributes['name'].value; | ||||||
|       this.rollData[attribute] = event.currentTarget.checked; |       this.rollData[attribute] = event.currentTarget.checked; | ||||||
|   | |||||||
| @@ -50,7 +50,7 @@ | |||||||
|     {{else}} |     {{else}} | ||||||
|     <span class="tooltip"> |     <span class="tooltip"> | ||||||
|       <label>Tactique:</label> |       <label>Tactique:</label> | ||||||
|         <select name="tactique-combat" id="tactique-combat" data-dtype="String" {{#unless use.conditions}}disabled{{/unless}}> |         <select class="select-by-name" name="tactique" id="tactique-combat" data-dtype="String" {{#unless use.conditions}}disabled{{/unless}}> | ||||||
|           <option value="Attaque normale">Attaque normale</option> |           <option value="Attaque normale">Attaque normale</option> | ||||||
|           <option value="charge">Charge</option> |           <option value="charge">Charge</option> | ||||||
|           <option value="feinte">Feinte</option> |           <option value="feinte">Feinte</option> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user