public void Add(CreatureModifier modifier) { if (_next != null) { _next.Add(modifier); } else { _next = modifier; } }
public void Test_goblin_attack_defense() { var goblin = new Creature("Goblin", 2, 2); var root = new CreatureModifier(goblin); Debug.WriteLine("Let's double the goblin's attack"); root.Add(new DoubleAttackModifier(goblin)); Debug.WriteLine("Let's increase the goblin's defense"); root.Add(new IncreasedDefenseModidifer(goblin)); root.Handle(); Debug.WriteLine(goblin); }
public void Test_goblin_attack_if_no_bonuses_are_allowed() { var goblin = new Creature("Goblin", 2, 2); var root = new CreatureModifier(goblin); root.Add(new NoBonusesModifier(goblin)); Debug.WriteLine("Let's double the goblin's attack"); root.Add(new DoubleAttackModifier(goblin)); root.Handle(); Debug.WriteLine(goblin); }