//take damage of each type of effect applied to the creature, as well as add/apply buffs public override void doEffects() { int i = 0; Object curr = effects.getItem(i); while (curr != null) { if (curr.GetType().IsSubclassOf(typeof(Effect))) { Effect effect = (Effect)curr; if (effect.isActive()) { effect.doEffect(this); //if (resistances[effect.getType()]) //damage /= 2; } else { effects.removeItem(i--);//must reduce the count as well since we've removed an item. } } i++; curr = effects.getItem(i); } }
public override void doEffects() { Effect eff = null; int i = 0; do { eff = (Effect)effects.getItem(i); if (eff != null) { if (eff.isActive()) { eff.doEffect(this); } else { effects.removeItem(i); i--;//gotta reduce the count since we're removing an item from the list } } i++; } while (eff != null); }