1. You can abstract Effect alone, and use two-way polymorphism mode (Visitor®) to implement "action".
Class Effect {
INT EffectStart; // the time effect started
INT Effect Duration; // The Time Effect Holds
INT Effecton (Creature C) {};
}
Class Creature {
...
ArrayList Effects; // The Effects Creature Is Suffering.
Public void Takeeffect (Effect Effect);
Public void updateeffect (Effect Effect); // NEED BE inherited
Public void update ()
{// Iterate Effects
//if (ITERATOR.EFFECTStAtterator.effect Duration) iterator.remove ();
// Execute Updateeffect (Iterator)
}
}
As above, the inheritance class of Effect can freely change Creature's EffectSList (usually added), and Creature's inheritance class can react to Effect of the Updateeffect method.