Correction des armes de défense
This commit is contained in:
@ -81,37 +81,59 @@ export class RdDItemArme extends Item {
|
||||
/* -------------------------------------------- */
|
||||
static getCategorieParade(armeData) {
|
||||
if (armeData.system.categorie_parade) {
|
||||
return armeData.system.categorie_parade;
|
||||
return armeData.system.categorie_parade
|
||||
}
|
||||
// pour compatibilité avec des personnages existants
|
||||
if (armeData.type == ITEM_TYPES.competencecreature || armeData.system.categorie == 'creature') {
|
||||
return armeData.system.categorie_parade || (armeData.system.isparade ? 'armes-naturelles' : '');
|
||||
return armeData.system.categorie_parade || (armeData.system.isparade ? 'armes-naturelles' : '')
|
||||
}
|
||||
if (!armeData.type.match(/arme|competencecreature/)) {
|
||||
return '';
|
||||
return ''
|
||||
}
|
||||
if (armeData.system.competence == undefined) {
|
||||
return ITEM_TYPES.competencecreature;
|
||||
}
|
||||
let compname = armeData.system.competence.toLowerCase();
|
||||
if (compname.match(/^(dague de jet|javelot|fouet|arc|arbalête|fronde|hache de jet|fléau)$/)) return '';
|
||||
if (compname.match(/^(dague de jet|javelot|fouet|arc|arbalête|fronde|hache de jet|fléau)$/)) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (compname.match('hache')) return 'haches';
|
||||
if (compname.match('hast')) return 'hast';
|
||||
if (compname.match('lance')) return 'lances';
|
||||
if (compname.match('bouclier')) return 'boucliers';
|
||||
if (compname.match('masse')) return 'masses';
|
||||
if (compname.match('hache')) return 'haches'
|
||||
if (compname.match('hast')) return 'hast'
|
||||
if (compname.match('lance')) return 'lances'
|
||||
if (compname.match('bouclier')) return 'boucliers'
|
||||
if (compname.match('masse')) return 'masses'
|
||||
if (compname.match('epée') || compname.match('épée')) {
|
||||
if (armeData.name.toLowerCase().match(/(gnome)/))
|
||||
return 'epees-courtes';
|
||||
return 'epees-courtes'
|
||||
if (armeData.name.toLowerCase().match(/((e|é)pée dragone|esparlongue|demi-dragonne)/))
|
||||
return 'epees-longues';
|
||||
return 'epees-lourdes';
|
||||
return 'epees-longues'
|
||||
return 'epees-lourdes'
|
||||
}
|
||||
if (compname.match('dague')) {
|
||||
return 'dagues';
|
||||
return 'dagues'
|
||||
}
|
||||
return 'sans-armes'
|
||||
}
|
||||
|
||||
static defenseArmeParade(armeAttaque, armeParade) {
|
||||
const defCategory = RdDItemArme.getCategorieParade(armeParade)
|
||||
if (defCategory == 'bouclier') {
|
||||
return 'norm'
|
||||
}
|
||||
if (armeAttaque.system.competence.toLowerCase().match(/(fléau)/)) {
|
||||
return ''
|
||||
}
|
||||
if (armeParade.system.tir) {
|
||||
return ''
|
||||
}
|
||||
const attCategory = RdDItemArme.getCategorieParade(armeAttaque)
|
||||
switch (attCategory) {
|
||||
case 'armes-naturelles': case 'sans-armes':
|
||||
return defCategory == 'sans-armes' ? 'norm' : ''
|
||||
default:
|
||||
return RdDItemArme.needParadeSignificative(armeAttaque, armeParade) ? 'sign' : 'norm'
|
||||
}
|
||||
return 'sans-armes';
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -120,8 +142,8 @@ export class RdDItemArme extends Item {
|
||||
return false;
|
||||
}
|
||||
// categories d'armes à la parade (cf. page 115 )
|
||||
let attCategory = RdDItemArme.getCategorieParade(armeAttaque);
|
||||
let defCategory = RdDItemArme.getCategorieParade(armeParade);
|
||||
const attCategory = RdDItemArme.getCategorieParade(armeAttaque)
|
||||
const defCategory = RdDItemArme.getCategorieParade(armeParade)
|
||||
// bouclier et mêmes catégorie: peuvent se parer sans difficulté
|
||||
if (defCategory == 'boucliers') {
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user