public void CreatureIsPlacedOnTable() { var state = Common.GameState; var user = state.Users[0]; var card = user.HandSet.Find(c => c.Price <= user.Power); var action = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); Assert.True(action.CanApply(state)); action.Apply(state); Assert.True((user.TableSet.Count > 0) && (user.TableSet[0] == card)); }
public void CreatureIsRemovedFromHand() { var state = Common.GameState; var user = state.Users[0]; var card = user.HandSet.Find(c => c.Price <= user.Power); var action = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); Assert.True(action.CanApply(state)); action.Apply(state); Assert.False(user.HandSet.Contains(card)); }
public void PowerIsSpent() { var state = Common.GameState; var user = state.Users[0]; var card = user.HandSet.Find(c => (c.Price > 0) && (c.Price <= user.Power)); var startPower = user.Power; var action = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); Assert.True(action.CanApply(state)); action.Apply(state); Assert.True(user.Power == (startPower - card.Price)); }
GameState CreatePlayerAttackReadyState() { var state = Common.GameState; var user = state.Users[0]; var card = user.HandSet.Find( c => (c.Type == CardType.Creature) && (user.Power >= c.Price) ); var buyAction = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); buyAction.Apply(state); card.Actions = card.MaxActions; return(state); }
public void IsNotActiveOnFirstTurn() { var state = Common.GameState; var user = state.Users[0]; var card = user.HandSet.Find( c => (c.Type == CardType.Creature) && (user.Power >= c.Price) && (c.MaxActions > 0) ); Assert.NotNull(card); var buyAction = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); buyAction.Apply(state); Assert.True(user.TableSet[0].Actions == 0); }
public void ActiveRestoredOnNextTurn() { var state = Common.GameState; var user = state.Users[0]; var card = user.HandSet.Find( c => (c.Type == CardType.Creature) && (user.Power >= c.Price) && (c.MaxActions > 0) ); var buyAction = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); buyAction.Apply(state); new TurnAction("1").Apply(state); new TurnAction("2").Apply(state); Assert.True(user.TableSet[0].Actions > 0); Assert.True(user.TableSet[0].Actions == user.TableSet[0].MaxActions); }
GameState CreateCreatureAttackReadyState() { var state = CreatePlayerAttackReadyState(); new TurnAction("1").Apply(state); var user = state.Users[1]; var card = user.HandSet.Find( c => (c.Type == CardType.Creature) && (user.Power >= c.Price) ); var buyAction = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); buyAction.Apply(state); new TurnAction("2").Apply(state); return(state); }
public void CreaturesWithoutHealthIsRemoved() { var state = Common.GameState; var user = state.Users[0]; var card = user.HandSet.Find( c => (c.Type == CardType.Creature) && (user.Power >= c.Price) ); var buyAction = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); buyAction.Apply(state); Assert.True(user.TableSet.Contains(card)); card.Health = 0; new EmptyAction().Apply(state); Assert.False(user.TableSet.Contains(card)); }
public void CantBuyToBusyPosition() { var state = Common.GameState; var user = state.Users[0]; var card = user.HandSet.Find(c => c.Price <= user.Power); Assert.NotNull(card); var action = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); Assert.True(action.CanApply(state)); action.Apply(state); user.Power = user.MaxPower; card = user.HandSet.Find(c => c.Price <= user.Power); action = new BuyCreatureAction(user.Name, user.HandSet.IndexOf(card), 0); Assert.False(action.CanApply(state)); }