public AbilityManagerTest() { AbilityManager = new AbilityManager(); this.Engine.AddActor(AbilityManager); TurnManager = new TurnManager(); this.Engine.AddActor(TurnManager); }
public void CastCard_PlayerChoosesValidCrystals_CrystalsDischargedAndSpellIsCast() { this.FailTestOnEngineCrash(); bool spellResolved = false; AbilityManager am = new AbilityManager(); this.Engine.AddActor(am); TurnManager tm = new TurnManager(); this.Engine.AddActor(tm); ManaStorage m = new ManaStorage(); Player[] players = generatePlayersAndStartGame(new Player[]{new Player(null,null,m,null),new Player()}); this.Engine.Update(); m.AddCrystal(Mana.Divine); m.AddCrystal(Mana.Divine); m.AddCrystal(Mana.Arcane); m.chargeAll(); List<Mana> manaCost = new List<Mana>(); manaCost.Add(Mana.Divine); manaCost.Add(Mana.Arcane); MockCard card = new MockCard(); card.ManaCost = manaCost; card.AddSpellAction(_ => spellResolved = true); Player owner = players[0]; List<Mana> selectedMana = new List<Mana>(); selectedMana.Add(Mana.Divine); selectedMana.Add(Mana.Arcane); this.ActionManager.Queue(new CastCardCommand(owner, card, selectedMana)); this.Engine.Update(); EventManager.Raise(new PlayerPassedPriorityEvent(players[0])); EventManager.Raise(new PlayerPassedPriorityEvent(players[1])); this.Engine.Update(); Assert.IsTrue(m.IsCharged(Mana.Divine, 0)); Assert.IsFalse(m.IsCharged(Mana.Divine, 1)); Assert.IsFalse(m.IsCharged(Mana.Arcane, 0)); Assert.IsTrue(spellResolved); }
public void NewTurn_TurnEndsAndANewTurnBegins_AllCrystalsAreRecharged() { TurnManager turnManager = new TurnManager(); this.Engine.AddActor(turnManager); Player[] players = generatePlayersAndStartGame(2); ManaStorage m = new ManaStorage(); this.Engine.AddActor(m); m.Owner = players[1]; m.AddCrystal(Mana.Divine); m.AddCrystal(Mana.Divine); m.AddCrystal(Mana.Arcane); Assert.IsFalse(m.IsCharged(Mana.Divine, 0)); Assert.IsFalse(m.IsCharged(Mana.Divine, 1)); Assert.IsFalse(m.IsCharged(Mana.Arcane, 0)); changeTurn(players); Assert.IsTrue(m.IsCharged(Mana.Divine, 0)); Assert.IsTrue(m.IsCharged(Mana.Divine, 1)); Assert.IsTrue(m.IsCharged(Mana.Arcane, 0)); }
public TurnManagerTest() { turnman = new TurnManager(); Engine.AddActor(turnman); }