// change to Main to run. public static void none(string[] args) { var game = new Game(); // real world would use constructor injection from your DI container var goblin = new Creature2(game, "Strong Goblin", 3, 3); Console.WriteLine(goblin); using (new DoubleAttackModifer2(game, goblin)) { Console.WriteLine(goblin); using (new IncreasedDefenseModifer2(game, goblin)) { Console.WriteLine(goblin); } } // reverts spells (expire) after using event broker. Console.WriteLine(goblin); }
protected CreatureModifier2(Game game, Creature2 creature) { this.game = game ?? throw new ArgumentNullException(nameof(game)); this.creature = creature ?? throw new ArgumentNullException(nameof(creature)); game.Queries += Handle; }
public IncreasedDefenseModifer2(Game game, Creature2 creature) : base(game, creature) { }
public DoubleAttackModifer2(Game game, Creature2 creature) : base(game, creature) { }