示例#1
0
        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));
        }
示例#2
0
 public void AddCrystal_NoCrystals_OneCrystalAddedWithoutCharge()
 {
     ManaStorage m = new ManaStorage();
     this.Engine.AddActor(m);
     m.AddCrystal(Mana.Divine);
     Assert.IsFalse(m.IsCharged(Mana.Divine, 0));
 }
示例#3
0
        public void AddCrystal_NoCrystals_OneCrystalAddedWithoutCharge()
        {
            ManaStorage m = new ManaStorage();

            this.Engine.AddActor(m);
            m.AddCrystal(Mana.Divine);
            Assert.IsFalse(m.IsCharged(Mana.Divine, 0));
        }
示例#4
0
        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);
        }
示例#5
0
 public Player(GameLibrary lib, Hand hand, ManaStorage manaStorage,LevelRewarder rewarder)
 {
     this.CurrentXP = 0;
     this.Rewarder = rewarder;
     if (this.Rewarder != null)
         Rewarder.Owner = this;
     Library = lib;
     if(lib!=null)
         Library.Owner = this;
     Hand = hand;
     ManaStorage = manaStorage;
     if(manaStorage != null)
         ManaStorage.Owner = this;
 }
示例#6
0
        public void TestCheckMana_ValidManaCost_ReturnsTrue()
        {
            ManaStorage m = new ManaStorage();

            this.Engine.AddActor(m);

            m.AddCrystal(Mana.Divine);
            m.AddCrystal(Mana.Divine);
            m.AddCrystal(Mana.Arcane);
            m.chargeAll();

            List <Mana> cost = new List <Mana>();

            cost.Add(Mana.Divine);
            cost.Add(Mana.Arcane);

            Assert.IsTrue(m.CheckMana(cost));
        }
示例#7
0
        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);
        }
示例#8
0
        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));
        }
示例#9
0
        public void TestCheckMana_ValidManaCost_ReturnsTrue()
        {
            ManaStorage m = new ManaStorage();
            this.Engine.AddActor(m);

            m.AddCrystal(Mana.Divine);
            m.AddCrystal(Mana.Divine);
            m.AddCrystal(Mana.Arcane);
            m.chargeAll();

            List<Mana> cost = new List<Mana>();
            cost.Add(Mana.Divine);
            cost.Add(Mana.Arcane);

            Assert.IsTrue(m.CheckMana(cost));
        }
 public ManaCrystalSpentEvent(Player p, Mana m, ManaStorage storage)
 {
     Owner = p;
     CrystalType = m;
     Storage = storage;
 }
 public ManaCrystalAddedEvent(Player p, Mana m, ManaStorage storage)
 {
     Owner = p;
     CrystalType = m;
     this.Storage = storage;
 }