Skip to content

Commit

Permalink
Fixing up damage calcs for HKAs
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Guinchard committed Feb 11, 2023
1 parent b303c7f commit 28d45c8
Showing 1 changed file with 47 additions and 2 deletions.
49 changes: 47 additions & 2 deletions src/decorators/powers/HandKillingAttack.js
Expand Up @@ -20,6 +20,31 @@ import {KILLING_DAMAGE} from '../../lib/DieRoller';

const DC_BASE_COST = 5;

const DAMAGE_AFFECTING_ADVANATGES = [
'AOE',
'ARMORPIERCING',
'AVAD',
'AUTOFIRE',
'CHARGES',
'CONSTANT',
'CUMULATIVE',
'DAMAGEOVERTIME',
'DOESBODY',
'DOESKB',
'DOUBLEKB',
'INCREASEDSTUNMULTIPLIER',
'MEGASCALE',
'PENETRATING',
'STICKY',
'TIMELIMIT',
'TRANSDIMENSIONAL',
'TRIGGER',
'UNCONTROLLED',
'UAA',
'VARIABLEADVANTAGE',
'VARIABLESFX',
];

export default class HandKillingAttack extends CharacterTrait {
constructor(characterTrait) {
super(characterTrait.trait, characterTrait.listKey, characterTrait.getCharacter);
Expand Down Expand Up @@ -145,11 +170,31 @@ export default class HandKillingAttack extends CharacterTrait {
total += this._totalAdvantages(modifier);
}
} else {
let decorated = modifierDecorator.decorate(modifiers, this.characterTrait.trait);
if (this._affectsDamageCalc(modifiers)) {
let decorated = modifierDecorator.decorate(modifiers, this.characterTrait.trait);

total += decorated.cost() > 0 ? decorated.cost() : 0;
total += decorated.cost() > 0 ? decorated.cost() : 0;
}
}

return total;
}

_affectsDamageCalc(modifiers) {
if (DAMAGE_AFFECTING_ADVANATGES.includes(modifiers.xmlid)) {
if (modifiers.xmlid === 'CHARGES') {
if (modifiers.hasOwnProperty('adder')) {
if (Array.isArray(modifiers.adder)) {
return modifiers.adder.includes('BOOSTABLE');
} else {
return modifiers.adder.xmlid === 'BOOSTABLE';
}
}
}

return true;
}

return false;
}
}

0 comments on commit 28d45c8

Please sign in to comment.