private DisplayCard convertCardToDisplayCard(Card oldcard, decimal odds) { DisplayCard newCard = new DisplayCard(oldcard.cardName, oldcard.cardLevel); newCard.OddsToDrawSpecificCard = Convert.ToString(odds); return newCard; }
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); } }
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 discardCard(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) { 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--; } m_NextStack.Add(playedCard); } }
public void levelUpCard(Card playedCard) { Boolean cardAlreadyInDeck = false; foreach (Card searchCard in m_NextStack) { if (playedCard.cardName == searchCard.cardName && playedCard.cardLevel == searchCard.cardLevel) { cardAlreadyInDeck = true; break; } } foreach (Card searchCard in CurrentStack) { if (playedCard.cardName == searchCard.cardName && playedCard.cardLevel == searchCard.cardLevel) { playedCard.levelUpCard(this); break; } } if (cardAlreadyInDeck == false) { m_NextStack.Add(playedCard); } }
public void addCard(Card playedCard) { CurrentStack.Add(playedCard); }
public void CreatureDies(Card deadCard) { GraveStack.Add(new Card(deadCard.cardName, deadCard.cardLevel)); }
private void internalParseRawLog() { lastPlayedCard = new Card("",0); if (String.IsNullOrEmpty(rawLogText)) { return; } m_gameState.Reset(); FindPlayersName(); if (m_gameState.getNumberofPlayer() != 2) { return; } Match match; string[] tokens = Regex.Split(rawLogText, @"\r?\n|\r"); foreach(string row in tokens) { if (MaxTurnNumber > 0) { if (MaxTurnNumber <= m_gameState.totalTurns) { break; } } match = Regex.Match(row, @"^Lane"); if (match.Success) { continue; } match = Regex.Match(row, @"^" + m_gameState.playerOne.playerName + " ends their turn."); if (match.Success) { m_gameState.NextTurn(); m_gameState.playerOne.nextTurn(); continue; } match = Regex.Match(row, @"^" + m_gameState.playerTwo.playerName + " ends their turn."); if (match.Success) { m_gameState.NextTurn(); m_gameState.playerTwo.nextTurn(); continue; } //Parsing of player 1 card parseLine(row, m_gameState.playerOne, m_gameState.playerTwo); //Same for player 2 parseLine(row, m_gameState.playerTwo, m_gameState.playerOne); } if (MaxTurnNumber > m_gameState.totalTurns) { MaxTurnNumber = m_gameState.totalTurns; } }
private void parseLineForPlay(String Line, Player ActivePlayer, Player PassivePlayer) { Match match; Match submatch; Card playedCard; match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " plays ([a-zA-Z. ,']+) \\(lvl ([0-9])\\)"); if (match.Success) { playedCard = new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value)); if (playedCard.CardDefinition.isBuggedDoublePlay() && lastPlayedCard.cardName == playedCard.cardName) { if (match.Groups[1].Value == "Oratek Battlebrand") { submatch = Regex.Match(Line, @"^" + ActivePlayer.playerName + " plays Oratek Battlebrand \\(lvl [0-9]\\)\\."); if (submatch.Success) { ActivePlayer.playerDeck.levelUpUnknownCard(); } submatch = Regex.Match(Line, @"^" + ActivePlayer.playerName + " plays Oratek Battlebrand \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)."); if (submatch.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(submatch.Groups[1].Value, Convert.ToInt16(submatch.Groups[2].Value))); } } lastPlayedCard = new Card("", 0); return; } ActivePlayer.playerDeck.playCard(playedCard); lastPlayedCard = playedCard; if (match.Groups[1].Value == "Metasight") { submatch = Regex.Match(Line, @"^" + ActivePlayer.playerName + " plays Metasight \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\) and ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (submatch.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(submatch.Groups[1].Value, Convert.ToInt16(submatch.Groups[2].Value) - 1)); ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(submatch.Groups[3].Value, Convert.ToInt16(submatch.Groups[4].Value) - 1)); } submatch = Regex.Match(Line, @"^" + ActivePlayer.playerName + " plays Metasight \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (submatch.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(submatch.Groups[1].Value, Convert.ToInt16(submatch.Groups[2].Value) - 1)); } return; } if (match.Groups[1].Value == "Metasight") { submatch = Regex.Match(Line, @"^" + ActivePlayer.playerName + " plays Perilous Insight \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\) and ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (submatch.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(submatch.Groups[1].Value, Convert.ToInt16(submatch.Groups[2].Value) - 1)); ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(submatch.Groups[3].Value, Convert.ToInt16(submatch.Groups[4].Value) - 1)); } submatch = Regex.Match(Line, @"^" + ActivePlayer.playerName + " plays Perilous Insight \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (submatch.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(submatch.Groups[1].Value, Convert.ToInt16(submatch.Groups[2].Value) - 1)); } return; } if (match.Groups[1].Value == "Energy Surge") { submatch = Regex.Match(Line, @"^" + ActivePlayer.playerName + " plays Energy Surge \\(lvl [0-9]\\) for ([0-9]) cards."); if (submatch.Success) { ActivePlayer.drawCard(Convert.ToInt16(submatch.Groups[1].Value)); } return; } if (match.Groups[1].Value == "Oratek Battlebrand") { submatch = Regex.Match(Line, @"^" + ActivePlayer.playerName + " plays Oratek Battlebrand \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)\\."); if (submatch.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(submatch.Groups[1].Value, Convert.ToInt16(submatch.Groups[2].Value))); } } return; } }
public SolbindCard(String p_cardName, int p_cardlevel, int number) { m_Solbind = new Card(p_cardName, p_cardlevel); m_NumberOfCard = number; }
private int SimulateSpell(Card secondCard) { // 1 -> Creature survive the spell // 0 -> Creature is killed by spell Card spell, creature; if (m_cardDefinition.CardType == "Spell") { spell = this; creature = secondCard; } else { spell = secondCard; creature = this; } //We look spell per spell //Stat Damage int Statdamage = getStatDamage(spell); if (Statdamage > 0) { if (creature.GetHealthValue() <= Statdamage) { return 0; } return 1; } //Burn Damage int Spelldamage = getSpellDamage(spell); if (Spelldamage > 0) { if ((creature.GetHealthValue() + creature.GetArmorValue()) <= Spelldamage) { return 0; } return 1; } //Removal if (spell.cardName == "Botanimate") { if (spell.cardLevel >= creature.cardLevel) { return 0; } return 1; } if (spell.cardName == "Energy Prison") { if (spell.cardLevel >= creature.cardLevel) { return 0; } return 1; } if (spell.cardName == "Dreadbolt") { if (spell.cardLevel >= creature.cardLevel) { if (creature.GetAttackValue() >= creature.GetHealthValue()) { return 0; } } return 1; } if (spell.cardName == "Cull the Weak") { if (spell.cardLevel == 1) { if (creature.GetAttackValue() <= 4) { return 0; } return 1; } if (spell.cardLevel == 2) { if (creature.GetAttackValue() <= 8) { return 0; } return 1; } if (spell.cardLevel == 3) { if (creature.GetAttackValue() <= 14) { return 0; } return 1; } return 1; } return -1; }
private static int getStatDamage(Card spell) { if (spell.cardName == "Contagion Surge") { if (spell.cardLevel == 1) return 1; if (spell.cardLevel == 2) return 2; if (spell.cardLevel == 3) return 3; } if (spell.cardName == "Ghastly Touch") { if (spell.cardLevel == 1) return 3; if (spell.cardLevel == 2) return 6; if (spell.cardLevel == 3) return 12; } if (spell.cardName == "Epidemic") { if (spell.cardLevel == 1) return 2; if (spell.cardLevel == 2) return 4; if (spell.cardLevel == 3) return 6; } return 0; }
private static int getSpellDamage(Card spell) { if (spell.cardName == "Uranti Bolt") { if (spell.cardLevel == 1) return 3; if (spell.cardLevel == 2) return 10; if (spell.cardLevel == 3) return 20; } if (spell.cardName == "Lightning Spark") { if (spell.cardLevel == 1) return 5; if (spell.cardLevel == 2) return 8; if (spell.cardLevel == 3) return 12; } if (spell.cardName == "Static Shock") { if (spell.cardLevel == 1) return 1; if (spell.cardLevel == 2) return 2; if (spell.cardLevel == 3) return 4; } return 0; }
public int SimulateFight(Card secondCreature) { // 0 : cards destroy each other // 1 : inner card destroy other // 2 : compared card destroy other int fightResult; int firstAtck, firstHlth, secondAtck, secondHlth, firstArmor, secondArmor; fightResult = -1; if (m_cardDefinition == null || secondCreature.CardDefinition == null) { return fightResult; } if (m_cardDefinition.CardType == "Spell" && secondCreature.CardDefinition.CardType == "Spell") { return fightResult; } if (m_cardDefinition.CardType == "Spell" || secondCreature.CardDefinition.CardType == "Spell") { // 1 -> Creature survive the spell // 0 -> Creature is killed by spell fightResult = SimulateSpell(secondCreature); if (fightResult == -1) { return -1; } //First Card is the spell if (m_cardDefinition.CardType == "Spell") { if (fightResult == 0) { return 1; } if (fightResult == 1) { return 2; } } //Second Card is the spell else { if (fightResult == 0) { return 2; } if (fightResult == 1) { return 1; } } return -1; } if (m_cardDefinition.CardType == "Creature" && secondCreature.CardDefinition.CardType == "Creature") { firstAtck = GetAttackValue(); firstHlth = GetHealthValue(); firstArmor = GetArmorValue(); secondAtck = secondCreature.GetAttackValue(); secondHlth = secondCreature.GetHealthValue(); secondArmor = secondCreature.GetArmorValue(); if (secondAtck <= firstArmor && firstAtck <= secondArmor) { return 1; } if (cardName == "Witherfrost Banshee") { if (cardLevel == 1) { secondAtck = secondAtck - 2; secondHlth = secondHlth - 2; } if (cardLevel == 2) { secondAtck = secondAtck - 4; secondHlth = secondHlth - 4; } if (cardLevel == 3) { secondAtck = secondAtck - 7; secondHlth = secondHlth - 7; } } if (secondCreature.cardName == "Witherfrost Banshee") { if (secondCreature.cardLevel == 1) { firstAtck = firstAtck - 2; firstHlth = firstHlth - 2; } if (secondCreature.cardLevel == 2) { firstAtck = firstAtck - 4; firstHlth = firstHlth - 4; } if (secondCreature.cardLevel == 3) { firstAtck = firstAtck - 7; firstHlth = firstHlth - 7; } } while (firstHlth > 0 && secondHlth > 0) { if (secondAtck >= firstArmor) { firstHlth = firstHlth - (secondAtck - firstArmor); } if (firstAtck >= secondArmor) { secondHlth = secondHlth - (firstAtck - secondArmor) ; } if (cardName == "Thundersaur") { firstAtck = firstAtck + secondAtck; } if (secondCreature.cardName == "Thundersaur") { secondAtck = firstAtck + secondAtck; } } //End of while if (firstHlth <= 0 && secondHlth <= 0) { return 0; //Draw } if (secondHlth <= 0) { return 1; //First Creature Win } if (firstHlth <= 0) { return 2;//Second Creature Win } } return fightResult; }