Good evening.
Recently I've been thinking of making a simple TBS game in Java for fun and I was wondering if my logic is correct.
Basically, I have the following classes:
public abstract class Effect {
protected EffectType type; //enum which contains all the possible effect types
protected int value;
protected int duration;
....
}
public abstract void cast(Hero hero);
...
}
public class Hero {
...
public void sufferEffect(Effect effect){
effect.cast(this);
}
...
}
I don't know why but it feels a bit clunky to me. Do you think this is a good approach?
Hero.sufferEffect
seems like using double dispatch, and was going to offer an alternate design with hero methods such asTakeDamage
, but this question was closed :( – Cong Xu Apr 22 at 3:26