#92 Armes à 2 mains gérées dans le HUD
This commit is contained in:
parent
dc57058465
commit
65d5b1c45e
@ -443,21 +443,30 @@ export class RdDUtility {
|
|||||||
let comp = competenceList.find(c => c.name == arme.data.competence);
|
let comp = competenceList.find(c => c.name == arme.data.competence);
|
||||||
arme.data.initiative = RdDUtility.calculInitiative(arme.data.niveau, carac[comp.data.defaut_carac].value);
|
arme.data.initiative = RdDUtility.calculInitiative(arme.data.niveau, carac[comp.data.defaut_carac].value);
|
||||||
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
|
// Dupliquer les armes pouvant être à 1 main et 2 mains en patchant la compétence
|
||||||
if (arme.data.unemain && arme.data.deuxmains) {
|
if (arme.data.unemain && !arme.data.deuxmains ) {
|
||||||
|
arme.data.mainInfo = "(1m)";
|
||||||
|
} else if ( !arme.data.unemain && arme.data.deuxmains ) {
|
||||||
|
arme.data.mainInfo = "(2m)";
|
||||||
|
} else if (arme.data.unemain && arme.data.deuxmains) {
|
||||||
|
arme.data.mainInfo = "(1m)";
|
||||||
let arme2main = duplicate(arme);
|
let arme2main = duplicate(arme);
|
||||||
|
arme2main.data.mainInfo = "(2m)";
|
||||||
arme2main.data.dommages = arme2main.data.dommages.split("/")[1]; // Existence temporaire uniquement dans la liste des armes, donc OK
|
arme2main.data.dommages = arme2main.data.dommages.split("/")[1]; // Existence temporaire uniquement dans la liste des armes, donc OK
|
||||||
arme2main.data.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace !
|
arme2main.data.competence = arme2main.data.competence.replace(" 1 main", " 2 mains"); // Replace !
|
||||||
let comp = competenceList.find(c => c.name == arme2main.data.competence);
|
let comp = competenceList.find(c => c.name == arme2main.data.competence);
|
||||||
arme2main.data.niveau = comp.data.niveau;
|
arme2main.data.niveau = comp.data.niveau;
|
||||||
arme2main.data.initiative = RdDUtility.calculInitiative(arme2main.data.niveau, carac[comp.data.defaut_carac].value);
|
arme2main.data.initiative = RdDUtility.calculInitiative(arme2main.data.niveau, carac[comp.data.defaut_carac].value);
|
||||||
arme2mains.push(arme2main);
|
arme2mains.push(arme2main);
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
armeList = armeList.concat(arme2mains); // Merge all cases
|
armeList = armeList.concat(arme2mains); // Merge all cases
|
||||||
armeList = armeList.sort((a, b) => { if ( a.name > b.name) return 1; else return -1; } );
|
armeList = armeList.sort((a, b) => { if ( a.name > b.name) return 1; else return -1; } );
|
||||||
return armeList
|
return armeList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------------------------------- */
|
||||||
static calculInitiative(niveau, caracValue) {
|
static calculInitiative(niveau, caracValue) {
|
||||||
let base = niveau + Math.floor(caracValue/2);
|
let base = niveau + Math.floor(caracValue/2);
|
||||||
return "1d6" + (base >= 0 ? "+" : "") + base;
|
return "1d6" + (base >= 0 ? "+" : "") + base;
|
||||||
@ -816,6 +825,7 @@ export class RdDUtility {
|
|||||||
// Recupération des items 'arme'
|
// Recupération des items 'arme'
|
||||||
let itemsByType = RdDUtility.buildItemsClassification( combatant.actor.data.items );
|
let itemsByType = RdDUtility.buildItemsClassification( combatant.actor.data.items );
|
||||||
armesList = itemsByType['arme'];
|
armesList = itemsByType['arme'];
|
||||||
|
armesList = this.finalizeArmeList( armesList, itemsByType['competence'], actor.data.data.carac );
|
||||||
// Force corps à corps et Draconic
|
// Force corps à corps et Draconic
|
||||||
let cc = RdDUtility.findCompetence( combatant.actor.data.items, "Corps à corps");
|
let cc = RdDUtility.findCompetence( combatant.actor.data.items, "Corps à corps");
|
||||||
armesList.push( { name: "Corps à corps", data: { niveau: cc.data.niveau, description: "", force: 6, competence: "Corps à corps", dommages: combatant.actor.data.data.attributs.plusdom.value } } );
|
armesList.push( { name: "Corps à corps", data: { niveau: cc.data.niveau, description: "", force: 6, competence: "Corps à corps", dommages: combatant.actor.data.data.attributs.plusdom.value } } );
|
||||||
|
@ -210,3 +210,8 @@
|
|||||||
{"_id":"iCvphbPdxUcfqetd","name":"Aumônière","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"conteneur","data":{"description":"<p>Comme une bourse, mais sous forme d'une coque en cuir rigide.</p>","capacite":0.25,"encombrement":0,"equipe":false,"qualite":0,"cout":0.2,"contenu":[]},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/aumoniere.webp","effects":[]}
|
{"_id":"iCvphbPdxUcfqetd","name":"Aumônière","permission":{"default":0,"jOzRscDxoXZWpGS6":3},"type":"conteneur","data":{"description":"<p>Comme une bourse, mais sous forme d'une coque en cuir rigide.</p>","capacite":0.25,"encombrement":0,"equipe":false,"qualite":0,"cout":0.2,"contenu":[]},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/aumoniere.webp","effects":[]}
|
||||||
{"_id":"iGHudg5kBOfYWgwV","name":"Arc","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"<p>Nie jusqu'à 2 points d'armure.</p>\n<p>Rechargement 1/2 round (s'il tire en début de round, il pourra recharger durant le reste du round pour tirer de nouveau au début du round suivant).</p>","quantite":1,"encombrement":1,"equipe":false,"dommages":"2","force":"0","resistance":0,"competence":"Arc","cout":10,"portee_courte":10,"portee_moyenne":20,"portee_extreme":50,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arc.webp","effects":[]}
|
{"_id":"iGHudg5kBOfYWgwV","name":"Arc","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"<p>Nie jusqu'à 2 points d'armure.</p>\n<p>Rechargement 1/2 round (s'il tire en début de round, il pourra recharger durant le reste du round pour tirer de nouveau au début du round suivant).</p>","quantite":1,"encombrement":1,"equipe":false,"dommages":"2","force":"0","resistance":0,"competence":"Arc","cout":10,"portee_courte":10,"portee_moyenne":20,"portee_extreme":50,"penetration":2,"rapide":false,"deuxmains":false,"unemain":false},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/arc.webp","effects":[]}
|
||||||
{"_id":"1Dc4KzZageae7lhI","name":"Balles de jongleur","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":4,"encombrement":0.1,"equipe":false,"resistance":0,"qualite":0,"cout":0.32},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/balle_jongleur.webp","effects":[]}
|
{"_id":"1Dc4KzZageae7lhI","name":"Balles de jongleur","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"objet","data":{"description":"","quantite":4,"encombrement":0.1,"equipe":false,"resistance":0,"qualite":0,"cout":0.32},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/objets/balle_jongleur.webp","effects":[]}
|
||||||
|
{"_id":"U6qli6TPbzj8tUdH","name":"Arme d’hast","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":4,"equipe":false,"dommages":"4","force":"12","resistance":8,"competence":"Dague","cout":10,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":false,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/hast.webp","effects":[]}
|
||||||
|
{"_id":"cFnFQrQIPgyZRWdo","name":"Épée sorde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"<p>C’est une épée plus courte que la dragonne, mais plus <em>large</em>. Elle peut s’utiliser à une ou deux mains. Sa grande solidité en fait l’épée de prédilection des gardes et des soldats.</p>\n<p>C’est probablement à elle que le <em>Guerrier Sorde</em> doit son nom (à moins que ce ne soit l’inverse).</p>","quantite":1,"encombrement":2,"equipe":false,"dommages":"3/4","force":"12/11","resistance":15,"competence":"Epée à 1 main","cout":20,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_sord.webp","effects":[]}
|
||||||
|
{"_id":"KmfftnkUsPQD6fV0","name":"Épée bâtarde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"<p>Comme son nom l’indique, c’est une <em>bâtarde </em>de l'épée longue et de l'épée sorde, à la fois longue et large, pouvant s’utiliser à une ou deux mains.</p>","quantite":1,"encombrement":3,"equipe":false,"dommages":"4/5","force":"13/12","resistance":14,"competence":"Epée à 1 main","cout":30,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/epee_batarde.webp","effects":[]}
|
||||||
|
{"_id":"9jbjDpbddL2Ep09s","name":"Hache de bataille","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":2,"equipe":false,"dommages":"3/4","force":"12/11","resistance":8,"competence":"Hache à 1 main","cout":15,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/hache_bataille.webp","effects":[]}
|
||||||
|
{"_id":"7xFe41JZIVNMLv1U","name":"Masse lourde","permission":{"default":0,"rYShh2P1DNavdoBD":3},"type":"arme","data":{"description":"","quantite":1,"encombrement":3,"equipe":false,"dommages":"3/4","force":"12/11","resistance":10,"competence":"Masse à 1 main","cout":4,"portee_courte":0,"portee_moyenne":0,"portee_extreme":0,"rapide":false,"deuxmains":true,"unemain":true,"penetration":null},"flags":{},"img":"systems/foundryvtt-reve-de-dragon/icons/armes_armures/masse_lourde.webp","effects":[]}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{{#unless arme.data.initOnly}}
|
{{#unless arme.data.initOnly}}
|
||||||
<div class="control-icon tokenhudicon rdd-attaque" title="{{arme.name}}">
|
<div class="control-icon tokenhudicon rdd-attaque" title="{{arme.name}}">
|
||||||
<label class="rdd-hud-menu" data-combatant-id="{{../combatant._id}}"
|
<label class="rdd-hud-menu" data-combatant-id="{{../combatant._id}}"
|
||||||
data-arme-id="{{arme.index}}"></i>C:{{arme.name}}</label>
|
data-arme-id="{{arme.index}}"></i>C:{{arme.name}} {{arme.data.mainInfo}}</label>
|
||||||
</div>
|
</div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{{#each armes as |arme key|}}
|
{{#each armes as |arme key|}}
|
||||||
<div class="control-icon tokenhudicon" title="{{arme.name}}">
|
<div class="control-icon tokenhudicon" title="{{arme.name}}">
|
||||||
<label class="rdd-hud-menu" data-combatant-id="{{../combatant._id}}"
|
<label class="rdd-hud-menu" data-combatant-id="{{../combatant._id}}"
|
||||||
data-arme-id="{{arme.index}}">I:{{arme.name}}</label>
|
data-arme-id="{{arme.index}}">I:{{arme.name}} {{arme.data.mainInfo}}</label>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user