public void Defend(int cardIndex) { defenderCard = currentTarget.Cards[cardIndex]; bool canDefend=false; if (_gctx.TurnCtx.IsFor硅藻土 && _gctx.TurnCtx.needCardType == null) { if (defenderCard is Acid || defenderCard is Base) { canDefend = true; _gctx.TurnCtx.needCardType = defenderCard.GetType(); } } else if (_gctx.TurnCtx.needCardType != null) { canDefend = defenderCard.GetType() == _gctx.TurnCtx.needCardType; } else { canDefend = CanDefend(offenderCard, defenderCard); } if (canDefend) { currentTarget.Cards.Remove(defenderCard); _gctx.droppedCards.Add(defenderCard); _gctx.autoEvent.Set(); } else { OnWrongCard(this, new EventArgs()); } }
public static Card generateCard(int min, int max) { var c = new Card(); c.Name = "Creature_" + index.ToString(); c.Attack = rand.Next(min, max); c.Defence = rand.Next(min, max); index++; return c; }
void DisplayCards(Card[] cards, string title) { Console.WriteLine(title); for (var i = 0; i < cards.Length; i++) { var c = cards[i]; var cardDisplay = string.Format("[{0}] {1}", (i + 1), c); Console.WriteLine(cardDisplay); } Console.WriteLine(); }
public Defence Defend(State state, Card[] attackingCards) { var d = new Defence(); if (_hand.Cards.Count < 3) { return d; } if (attackingCards.Count<Card>() > 1) { d.Response[attackingCards[0]] = new Card[] { _hand.Cards[0] }; d.Response[attackingCards[1]] = new Card[] { _hand.Cards[1] }; } return d; }
public bool CanDefend(Card offender, Card defender) { if (offender is Acid) { return defender is Base; } else if (offender is Base) { return defender is Acid; } else if (offender is KitCard) { return defender is EDTA; } return false; }
public Defence Defend(State state, Card[] attackingCards) { // Show attackers Console.WriteLine("### YOU'RE UNDER ATTACK!!! ###"); Console.WriteLine(); DisplayCards(attackingCards, "Attackers:"); // Show hand DisplayCards(_hand.Cards.ToArray(), "Hand:"); // Loop over attackers and request defenders for each attacker var defence = new Defence(); foreach (Card c in attackingCards) { Console.WriteLine("Input the Numbers of Defending Cards for [{0}] separated by spaces", c); var defenders = SelectCards(_hand.Cards.ToArray()); defence.Response[c] = defenders; } // Return defenders return defence; }
public void Respond() { offenderCard = _gctx.cardDress.VirtualCard; foreach (var t in _gctx.targets) { currentTarget = t; RespondOne(); } }
public CardDress(List<Card> actualCards, Card virtualCard) { ActualCards = actualCards; VirtualCard = virtualCard; }
public CardDress(Card dealedCard) { ActualCards.Add(dealedCard); VirtualCard = dealedCard; }
private void AddCards(Card card, int count) { for (int i = 0; i < count; i++) { availableCards.Add(card); } }
private void PopulateCardsDatabase() { var texture = Content.Load<Texture2D>("arrowed"); var card = new Card { Attack = 3, Defence = 4, Cost = 5, Name = "arrowed" }; _cardsDB.Add(card, texture); texture = Content.Load<Texture2D>("bleeding-heart"); card = new Card { Attack = 4, Defence = 5, Cost = 3, Name = "heart" }; _cardsDB.Add(card, texture); texture = Content.Load<Texture2D>("boiling-bubbles"); card = new Card { Attack = 5, Defence = 3, Cost = 4, Name = "bubbles" }; _cardsDB.Add(card, texture); }
private Card[] SelectCards(Card[] cards) { var input = Console.ReadLine(); var selectNumbers = input.Split(' '); var selected = new Card[selectNumbers.Length]; if (selectNumbers[0] == "") { return null; } for (var i = 0; i < selectNumbers.Length; i++) { var index = int.Parse(selectNumbers[i]) - 1; selected[i] = cards[index]; } return selected; }
public Texture2D LookupTexture(Card card) { return _cardsDB[card]; }
public void Add(Card card, Texture2D texture) { _cardsDB.Add(card, texture); }