private void CheckActionPosition() { if (_transform.position.y > -3f) { _card.Action(_targetPos); } else { ResetPosition(); } }
private void GameCard_Click(object sender, EventArgs e) { MaterialSmallCard sm = (MaterialSmallCard)sender; Card c = (Card)sm.Tag; if (c != null) { if (me.MP < c.Cost) { return; } meCard.Tag = c; meCard.Text = c.Name; meCard.Info = "Cost: " + c.Cost.ToString(); meCard.Show(); me.MP -= c.Cost; c.Action(me, opp); if (me == null) { return; } me.ActiveCard.Remove(c); opp.MP -= 1; me.FillActiveCard(); updateCard(); RefreshMeEffects(); RefreshOppEffects(); Me_OnValueChange(me); Opp_OnValueChange(opp); meCard.AutoExpand = false; timerMeRecentCard.Start(); } }
private void oppAttack() { opp.MP = opp.MaxMP; for (int i = opp.ActiveCard.Count - 1; i >= 0; i--) { Card c = opp.ActiveCard[i]; oppCard.Tag = c; oppCard.Text = c.Name; oppCard.Info = "Cost: " + c.Cost.ToString(); oppCard.Show(); c.Action(opp, me); if (opp == null) { return; } opp.ActiveCard.Remove(c); opp.FillActiveCard(); updateCard(); RefreshMeEffects(); RefreshOppEffects(); Me_OnValueChange(me); Opp_OnValueChange(opp); oppCard.AutoExpand = false; timerOppRecentCard.Start(); } }
public static void HandleNinjaAssasin(Game game, Player currentPlayer, Card card) { var saviourCards = new List <Card>(); if (currentPlayer.Hand.Count > 0) { foreach (var c in currentPlayer.Hand) { if (c.SaviourType) { saviourCards.Add(c); } } } if (saviourCards.Count > 0) { if (game.GameState == GameState.YourTurn) { DisplaySelectFromHand(saviourCards, Constants.RightBorderX + 3, 27); card = SelectCardFromHand(saviourCards); currentPlayer.Hand.Remove(card); } else { int maxPriority = -1; foreach (var c in saviourCards) { maxPriority = c.Priority > maxPriority ? c.Priority : maxPriority; } card = currentPlayer.Hand.FirstOrDefault(c => c.Priority == maxPriority); currentPlayer.Hand.Remove(card); } } card.Action(game); }
public override void Action(Game game) { Card card = game.Deck[game.Deck.Count - 1]; game.Deck.RemoveCardFromDeck(card); game.Log = game.PlayerInTurn + "| ran just for the sake of it."; if (card.SaviourType) { game.Log = game.PlayerInTurn + "| ran for their lives!"; card.Action(game); } else { if (game.CurrentCard.CardType == CardType.NinjaAssassin) { game.Log = game.PlayerInTurn + "| tried to escape but couldn't."; game.PlayerInTurn.IsDead = true; } return; } }
public static void PlayCard(Game game, Player currentPlayer, Card card, PlayersChoice choice = PlayersChoice.NotSelected) { switch (choice) { case PlayersChoice.PlayCard: card.Action(game); game.IsCardPlayed = true; break; case PlayersChoice.SaveToHand: if (currentPlayer.Hand.Count < 3) { currentPlayer.Hand.Add(card); } else { choice = PlayersChoice.PlayDifferentCard; PlayCard(game, currentPlayer, card, choice); } break; case PlayersChoice.PlayDifferentCard: currentPlayer.Hand.Add(card); if (currentPlayer.Hand.Count > 0) { DisplaySelectFromHand(currentPlayer.Hand, Constants.RightBorderX + 3, 27); card = SelectCardFromHand(currentPlayer.Hand); currentPlayer.Hand.Remove(card); choice = PlayersChoice.PlayCard; PlayCard(game, currentPlayer, card, choice); } break; } }