Filtrage des armes de tir&lancer
Pas disponibles pour une parade
This commit is contained in:
parent
260cce4de5
commit
ce6680d5e8
@ -203,8 +203,7 @@ export class RdDCombat {
|
||||
let content = "<strong>" + this.defender.name + "</strong> doit se défendre :<span class='chat-card-button-area'>";
|
||||
|
||||
// parades
|
||||
let filterArmesParade = this._getFilterArmesParade(rollData.competence.data.categorie);
|
||||
for (const arme of this.defender.data.items.filter(filterArmesParade)) {
|
||||
for (const arme of this._filterArmesParade(this.defender.data.items, rollData.competence.data.categorie)) {
|
||||
content += "<br><a class='chat-card-button' id='parer-button' data-attackerId='" + this.attackerId + "' data-defenderTokenId='" + this.defenderTokenId + "' data-armeid='" + arme._id + "'>Parer avec " + arme.name + "</a>";
|
||||
}
|
||||
|
||||
@ -240,13 +239,22 @@ export class RdDCombat {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
_getFilterArmesParade(categorie) {
|
||||
_filterArmesParade(items, categorie) {
|
||||
switch (categorie) {
|
||||
case 'tir':
|
||||
case 'lancer':
|
||||
return arme => arme.type == "arme" && arme.data.competence.toLowerCase().match("bouclier");
|
||||
return items.filter(item => item.data.competence.toLowerCase().match("bouclier"));
|
||||
default:
|
||||
return arme => (arme.type == "arme" && RdDItemCompetence.isCompetenceMelee(arme.data.competence)) || (arme.type == "competencecreature" && arme.data.isparade)
|
||||
return items.filter(item => {
|
||||
if (item.type == 'competencecreature') {
|
||||
return item.data.isparade;
|
||||
}
|
||||
if (item.type == 'arme') {
|
||||
const comp = this.defender.getCompetence(item.data.competence);
|
||||
return comp && comp.data.categorie == 'melee';
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user