public void Add(CreatureModifier cm) { if (next != null) { next.Add(cm); } else { next = cm; } }
public void Add(CreatureModifier cm) // this will add the modifier to the end of the linked list { if (next != null) { next.Add(cm); } else { next = cm; } }
static void Main(string[] args) { var goblin = new Creature("Goblin", 1, 1); WriteLine(goblin); var root = new CreatureModifier(goblin); //root.Add(new NoBonusesModifier(goblin)); root.Add(new DoubleAttackModifier(goblin)); root.Add(new DoubleAttackModifier(goblin)); root.Add(new IncreaseDefenseModifier(goblin)); // eventually... root.Handle(); WriteLine(goblin); }