public void playCard(Card playedCard) { Boolean cardAlreadyInDeck = false; foreach (Card searchCard in CurrentStack) { if (playedCard.cardName == searchCard.cardName && playedCard.cardLevel == searchCard.cardLevel) { CurrentStack.Remove(searchCard); break; } } if (playedCard.getDescription().Contains("Overload.")) { LiveStack.Add(new Card(playedCard.cardName, playedCard.cardLevel)); NumberOfBanishedCard++; return; } switch (playedCard.cardLevel) { case 1: m_NumberOfLevelTwoCards++; break; case 2: m_NumberOfLevelThreeCards++; break; case 3: if (playedCard.CardDefinition.hasLevel4()) { m_NumberOfLevelFourCards++; } break; } foreach (Card searchCard in m_NextStack) { if (playedCard.cardName == searchCard.cardName && playedCard.cardLevel == searchCard.cardLevel) { LiveStack.Add(new Card(playedCard.cardName, playedCard.cardLevel)); searchCard.playCard(this); cardAlreadyInDeck = true; break; } } if (cardAlreadyInDeck == false) { //If the card has a level higher than one it mean it have been leveled by another way //So we can remove one unknown leveled up card if (playedCard.cardLevel > 1) { UnknownCardLeveledUp--; } LiveStack.Add(new Card(playedCard.cardName, playedCard.cardLevel)); m_NextStack.Add(playedCard); playedCard.playCard(this); //Do not forget to add one level to the card } }
public void levelUpCardAndDiscard(Card playedCard) { Boolean cardAlreadyInDeck = false; foreach (Card searchCard in CurrentStack) { if (playedCard.cardName == searchCard.cardName && playedCard.cardLevel == searchCard.cardLevel) { CurrentStack.Remove(searchCard); break; } } foreach (Card searchCard in m_NextStack) { if (playedCard.cardName == searchCard.cardName && playedCard.cardLevel == searchCard.cardLevel) { LiveStack.Add(new Card(playedCard.cardName, playedCard.cardLevel)); searchCard.playCard(this); cardAlreadyInDeck = true; break; } } if (cardAlreadyInDeck == false) { LiveStack.Add(new Card(playedCard.cardName, playedCard.cardLevel)); playedCard.playCard(this); //Do not forget to add one level to the card m_NextStack.Add(playedCard); } }