/** * Applies an effect to the unit. * * @param effect the effect to apply */ public void applyEffect(Effect effect) { effects.add(effect); attack += effect.attackChange(); baseCountdown += effect.baseCountdownChange(); health += effect.healthChange(); maximumHealth += effect.healthChange(); baseMove += effect.baseMoveChange(); if (effect.untargetable()) { targetable = false; } }
/** Applies all the unit's effects to it. */ public void applyAllEffects() { for (Effect effect : effects) { attack += effect.attackChange(); baseCountdown += effect.baseCountdownChange(); health += effect.healthChange(); maximumHealth += effect.healthChange(); baseMove += effect.baseMoveChange(); if (effect.untargetable()) { targetable = false; } } }