Amélioration export voies draconiques
This commit is contained in:
		| @@ -1602,7 +1602,7 @@ export class RdDActor extends RdDBaseActorSang { | |||||||
|   computeDraconicAndSortIndex(sortList) { |   computeDraconicAndSortIndex(sortList) { | ||||||
|     let draconicList = this.getDraconicList(); |     let draconicList = this.getDraconicList(); | ||||||
|     for (let sort of sortList) { |     for (let sort of sortList) { | ||||||
|       let draconicsSort = this.getDraconicsSort(draconicList, sort).map(it => it.name); |       let draconicsSort = RdDItemSort.getDraconicsSort(draconicList, sort).map(it => it.name); | ||||||
|       for (let index = 0; index < draconicList.length && sort.system.listIndex == undefined; index++) { |       for (let index = 0; index < draconicList.length && sort.system.listIndex == undefined; index++) { | ||||||
|         if (draconicsSort.includes(draconicList[index].name)) { |         if (draconicsSort.includes(draconicList[index].name)) { | ||||||
|           sort.system.listIndex = index; |           sort.system.listIndex = index; | ||||||
| @@ -1612,19 +1612,6 @@ export class RdDActor extends RdDBaseActorSang { | |||||||
|     return draconicList; |     return draconicList; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |  | ||||||
|   getDraconicsSort(draconicList, sort) { |  | ||||||
|     //console.log(draconicList, bestDraconic, draconic, voie); |  | ||||||
|     switch (Grammar.toLowerCaseNoAccent(sort.name)) { |  | ||||||
|       case "lecture d'aura": |  | ||||||
|       case "detection d'aura": |  | ||||||
|         return draconicList; |  | ||||||
|       case "annulation de magie": |  | ||||||
|         return draconicList.filter(it => !RdDItemCompetence.isThanatos(it)); |  | ||||||
|     } |  | ||||||
|     return [RdDItemCompetence.getVoieDraconic(draconicList, sort.system.draconic)]; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   async rollUnSort(coord) { |   async rollUnSort(coord) { | ||||||
|     RdDEmpoignade.checkEmpoignadeEnCours(this) |     RdDEmpoignade.checkEmpoignadeEnCours(this) | ||||||
|   | |||||||
| @@ -115,6 +115,7 @@ export class Mapping { | |||||||
|   static prepareArmes(actor) { |   static prepareArmes(actor) { | ||||||
|     return actor.items.filter(it => it.type == ITEM_TYPES.arme) |     return actor.items.filter(it => it.type == ITEM_TYPES.arme) | ||||||
|       .map(arme => { |       .map(arme => { | ||||||
|  |         // TODO: gestion armes 1 ou 2 mains | ||||||
|         const compToUse = RdDItemArme.getCompetenceArme(arme, 'competence'); |         const compToUse = RdDItemArme.getCompetenceArme(arme, 'competence'); | ||||||
|         const comp = actor.getCompetence(compToUse); |         const comp = actor.getCompetence(compToUse); | ||||||
|         const bonusDom = Mapping.calculBonusDom(comp, actor) |         const bonusDom = Mapping.calculBonusDom(comp, actor) | ||||||
| @@ -183,7 +184,7 @@ export class Mapping { | |||||||
|   static prepareSorts(actor) { |   static prepareSorts(actor) { | ||||||
|     return actor.itemTypes[ITEM_TYPES.sort].map(it => { |     return actor.itemTypes[ITEM_TYPES.sort].map(it => { | ||||||
|       return { |       return { | ||||||
|         voie: it.system.voie, |         voie: RdDItemSort.getCodeDraconic(it), | ||||||
|         description: Mapping.descriptionSort(it), |         description: Mapping.descriptionSort(it), | ||||||
|         bonus: Mapping.bonusCase(it) |         bonus: Mapping.bonusCase(it) | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -1,10 +1,43 @@ | |||||||
|  | import { Grammar } from "./grammar.js"; | ||||||
|  | import { RdDItemCompetence } from "./item-competence.js"; | ||||||
| import { ITEM_TYPES } from "./item.js"; | import { ITEM_TYPES } from "./item.js"; | ||||||
| import { Misc } from "./misc.js"; | import { Misc } from "./misc.js"; | ||||||
| import { TMRUtility } from "./tmr-utility.js"; | import { TMRUtility } from "./tmr-utility.js"; | ||||||
|  |  | ||||||
|  | const VOIES_DRACONIC = [ | ||||||
|  |   { code: 'O', label: "Voie d'Oniros", short: 'Oniros'}, | ||||||
|  |   { code: 'H', label: "Voie d'Hypnos" , short:'Hypnos' }, | ||||||
|  |   { code: 'N', label: "Voie de Narcos", short: 'Narcos' }, | ||||||
|  |   { code: 'T', label: "Voie de Thanatos", short:'Thanatos' }, | ||||||
|  |   { code: 'O/H/N/T', label: "Oniros/Hypnos/Narcos/Thanatos", short:'Oniros/Hypnos/Narcos/Thanatos' }, | ||||||
|  |   { code: 'O/H/N', label: "Oniros/Hypnos/Narcos" } | ||||||
|  | ] | ||||||
|  |  | ||||||
| /* -------------------------------------------- */ | /* -------------------------------------------- */ | ||||||
| export class RdDItemSort extends Item { | export class RdDItemSort extends Item { | ||||||
|  |  | ||||||
|  |   static getDraconicsSort(draconicList, sort) { | ||||||
|  |     switch (Grammar.toLowerCaseNoAccent(sort.name)) { | ||||||
|  |       case "lecture d'aura": | ||||||
|  |       case "detection d'aura": | ||||||
|  |         return draconicList; | ||||||
|  |       case "annulation de magie": | ||||||
|  |         return draconicList.filter(it => !RdDItemCompetence.isThanatos(it)); | ||||||
|  |     } | ||||||
|  |     return [RdDItemCompetence.getVoieDraconic(draconicList, sort.system.draconic)]; | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   static getCodeDraconic(sort) { | ||||||
|  |     switch (Grammar.toLowerCaseNoAccent(sort.name)) { | ||||||
|  |       case "lecture d'aura": | ||||||
|  |       case "detection d'aura": | ||||||
|  |         return 'O/H/N/T' | ||||||
|  |       case "annulation de magie": | ||||||
|  |         return 'O/H/N' | ||||||
|  |     } | ||||||
|  |     const voie = VOIES_DRACONIC.find(it => it.label.includes(sort.system.draconic)) | ||||||
|  |     return voie?.code ?? sort.system.draconic | ||||||
|  |   } | ||||||
|   /* -------------------------------------------- */ |   /* -------------------------------------------- */ | ||||||
|   static isDifficulteVariable(sort) { |   static isDifficulteVariable(sort) { | ||||||
|     return sort && (sort.system.difficulte.toLowerCase() == "variable"); |     return sort && (sort.system.difficulte.toLowerCase() == "variable"); | ||||||
|   | |||||||
| @@ -3,3 +3,5 @@ | |||||||
|   <option value="{{competence.name}}">{{competence.name}}</option> |   <option value="{{competence.name}}">{{competence.name}}</option> | ||||||
|   {{/if}} |   {{/if}} | ||||||
| {{/each}} | {{/each}} | ||||||
|  | <option value="O/H/N/T">Oniros/Hypnos/Narcos/Thanatos</option> | ||||||
|  | <option value="O/H/N">Oniros/Hypnos/Narcos</option> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user