Merge pull request #314 from Jonpot/patch-5
Fix health bar filtering in dealDamage function
This commit is contained in:
@@ -194,14 +194,18 @@ function dealDamage({ target, damageType, amount, actionContext }) {
|
|||||||
let healthBars = getPropertiesOfType(target._id, 'attribute');
|
let healthBars = getPropertiesOfType(target._id, 'attribute');
|
||||||
|
|
||||||
// Keep only the healthbars that can take damage/healing
|
// Keep only the healthbars that can take damage/healing
|
||||||
remove(healthBars, (bar) =>
|
healthBars = healthBars.filter((bar) => {
|
||||||
bar.attributeType !== 'healthBar' ||
|
if (bar.attributeType !== 'healthBar' || bar.inactive || bar.removed || bar.overridden) {
|
||||||
bar.inactive ||
|
return false;
|
||||||
bar.removed ||
|
}
|
||||||
bar.overridden ||
|
if (damageType === 'healing' && bar.healthBarNoHealing) {
|
||||||
(amount >= 0 && bar.healthBarNoDamage) ||
|
return false;
|
||||||
(amount < 0 && bar.healthBarNoHealing)
|
}
|
||||||
);
|
if (damageType !== 'healing' && amount >= 0 && bar.healthBarNoDamage) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
// Sort healthbars by damage/healing order or tree order as a fallback
|
// Sort healthbars by damage/healing order or tree order as a fallback
|
||||||
healthBars.sort((a, b) => {
|
healthBars.sort((a, b) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user