#95 : Utilisation uniquement des armes equipees pour attaque/initiative/combat

This commit is contained in:
sladecraven 2021-01-03 09:58:07 +01:00
parent 55d49e8230
commit f8e35c961a
4 changed files with 65 additions and 25 deletions

View File

@ -287,16 +287,17 @@ export class RdDCombat {
/* -------------------------------------------- */
_filterArmesParade(items, competence) {
let itemsEquipped = items.filter(item => item.equipe == true );
switch (competence.data.categorie) {
case 'tir':
case 'lancer':
return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers')
return items.filter(item => RdDItemArme.getCategorieParade(itemsEquipped) == 'boucliers')
default:
// Le fléau ne peut être paré quau bouclier p115
if (competence.name == "Fléau"){
return items.filter(item => RdDItemArme.getCategorieParade(item) == 'boucliers')
return items.filter(item => RdDItemArme.getCategorieParade(itemsEquipped) == 'boucliers')
}
return items.filter(item => RdDItemArme.getCategorieParade(item));
return items.filter(item => RdDItemArme.getCategorieParade(itemsEquipped));
}
}

View File

@ -259,6 +259,7 @@ export class RdDUtility {
data.data.tetes = this.checkNull(data.itemsByType['tete']);
data.data.taches = this.checkNull(data.itemsByType['tache']);
data.data.monnaie = this.checkNull(data.itemsByType['monnaie']);
data.data.meditations = this.checkNull(data.itemsByType['meditation']);
data.data.objets = data.data.conteneurs.concat(data.data.materiel).concat(data.data.armes).concat(data.data.armures).concat(data.data.munitions).concat(data.data.livres).concat(data.data.potions).concat(data.data.herbes).concat(data.data.ingredients);
}
@ -449,7 +450,10 @@ export class RdDUtility {
static finalizeArmeList( armeList, competenceList, carac ) {
// Gestion des armes 1/2 mains
let arme2mains = []; // Tableau contenant la duplication des armes 1m/2m
let armesEquipe = [];
for (const arme of armeList) {
if (arme.data.equipe) {
armesEquipe.push( arme );
let comp = competenceList.find(c => c.name == arme.data.competence);
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
@ -466,14 +470,13 @@ export class RdDUtility {
let comp = competenceList.find(c => c.name == arme2main.data.competence);
arme2main.data.niveau = comp.data.niveau;
arme2main.data.initiative = RdDUtility.calculInitiative(arme2main.data.niveau, carac[comp.data.defaut_carac].value);
arme2mains.push(arme2main);
} else {
armesEquipe.push(arme2main);
}
}
armeList = armeList.concat(arme2mains); // Merge all cases
armeList = armeList.sort((a, b) => { if ( a.name > b.name) return 1; else return -1; } );
return armeList
}
//armeList = armeList.concat(arme2mains); // Merge all cases
armesEquipe = armesEquipe.sort((a, b) => { if ( a.name > b.name) return 1; else return -1; } );
return armesEquipe
}
/* -------------------------------------------- */

View File

@ -597,6 +597,20 @@
{{/each}}
</ul>
</div>
<div>
<span><strong>Méditations :</strong></span>
<ul class="item-list">
{{#each data.meditations as |meditation key|}}
<li class="item flexrow" data-item-id="{{meditation._id}}" data-attribute="{{key}}">
<span class="meditation-label"><a data-id="{{meditation._id}}">{{meditation.name}} - {{meditation.data.competence}}</a></span>
<div class="item-controls">
<a class="item-control item-edit" title="Editer"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Supprimer"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div>
<div>
<span><strong>Cases Spéciales:</strong></span>
<ul class="item-list">

View File

@ -67,6 +67,28 @@
{{/select}}
</select>
</div>
<div class="form-group">
<label for="xp">Malus</label>
{{#if isGM}}
<select name="data.malus" id="malus" data-dtype="Number">
{{#select item.data.malus}}
<option value="0">0</option>
<option value="-1">-1</option>
<option value="-2">-2</option>
<option value="-3">-3</option>
<option value="-4">-4</option>
<option value="-5">-5</option>
<option value="-6">-6</option>
<option value="-7">-7</option>
<option value="-8">-8</option>
<option value="-9">-9</option>
<option value="-10">-10</option>
{{/select}}
</select>
{{else}}
<label>>{{data.malus}}</label>
{{/if}}
</div>
<span><label>Description : </label></span>
<div class="form-group editor" style="min-height: 400px">
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}