public void Add(CreatureModifier modifier) { if (_creatureModifier == null) { _creatureModifier = modifier; } else { _creatureModifier._creatureModifier = modifier; } }
public void Demo() { var goblin = new Creature("Goblin", 2, 2); Console.WriteLine(goblin); var root = new CreatureModifier(goblin); root.Add(new NoBonusModifier(goblin)); Console.WriteLine("Let's double goblin's attack..."); root.Add(new DoubleAttackModifier(goblin)); Console.WriteLine("Let's increase goblin's defense"); root.Add(new IncreaseDefenseModifier(goblin)); root.Handle(); Console.WriteLine(goblin); }