static void Main(string[] args) { Creature goblin = new Creature("Goblin", 2, 2); Console.WriteLine(goblin); var root = new CreatureModifier(goblin); root.Add(new NoBonusesModifier(goblin)); Console.WriteLine("Adding Doubling the attack modifier"); root.Add(new DoubleAttackModifier(goblin)); Console.WriteLine("Adding Increasing the defence modifer"); root.Add(new IncreaseDefenceModifier(goblin)); root.Handle(); Console.WriteLine(goblin); }
static void Main(string[] args) { var goblin = new Creature("Goblin", 2, 2); WriteLine(goblin); var root = new CreatureModifier(goblin); WriteLine("Let's double the Goblin's attack."); root.Add(new DoubleAttackModifier(goblin)); WriteLine("Let's put 'No Bonuses' spell on it..."); root.Add(new NoBonusesModifier(goblin)); WriteLine("Let's increment the Goblin's defense."); root.Add(new IncreaseDefenseModifier(goblin)); root.Handle(); WriteLine(goblin); }
static void Main(string[] args) { var goblin = new Creature("Goblin", 2, 2); WriteLine(goblin); var root = new CreatureModifier(goblin); root.Add(new NoBonusesModifier(goblin)); WriteLine("Let's double goblin's attack..."); root.Add(new DoubleAttackModifier(goblin)); WriteLine("Let's increase goblin's defense"); root.Add(new IncreaseDefenseModifier(goblin)); // eventually... root.Handle(); WriteLine(goblin); }
public virtual void Handle() => next?.Handle();