public void addPlayer(String Name) { if (m_numberOfPlayer >=2) { throw new Exception("There is more than 2 player in this game"); } if (playerOne == null) { playerOne = new Player(Name); m_numberOfPlayer++; } else { if (playerTwo == null) { playerTwo = new Player(Name); m_numberOfPlayer++; } } }
public void Reset() { m_numberOfPlayer = 0; m_playerOne = null; m_playerTwo = null; m_totalturns = 0; }
private List<DisplayCard> DisplayStack(List<DisplayCard> pstack, Player OwnerOfStack) { if (ConfigurationManager.AppSettings["HideMyLevelOne"] != "true" || OwnerOfStack.playerName != ConfigurationManager.AppSettings["MyName"]) { return pstack; } return ConvertStackToRemoveLevelOne(pstack); }
private void parseLineForTriggers(String Line, Player ActivePlayer, Player PassivePlayer) { Match match; match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Aetherphage \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (match.Success) { PassivePlayer.playerDeck.discardCard(new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value))); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Technosmith \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (match.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value) - 1)); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Aetherforge Oracle \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (match.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value) - 1)); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Apocrymancer \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (match.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value) - 1)); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Metatransfer \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (match.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value) - 1)); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Metamind Adept \\(lvl [0-9]\\) for ([0-9]) cards."); if (match.Success) { ActivePlayer.drawCard(Convert.ToInt16(match.Groups[1].Value)); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Metamind Explorer \\(lvl [0-9]\\) for ([0-9]) cards."); if (match.Success) { ActivePlayer.drawCard(Convert.ToInt16(match.Groups[1].Value)); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Metamind Overseer \\(lvl [0-9]\\) for ([0-9]) cards."); if (match.Success) { ActivePlayer.drawCard(Convert.ToInt16(match.Groups[1].Value)); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Ghox, Metamind Paragon \\(lvl [0-9]\\) for ([0-9]) cards."); if (match.Success) { ActivePlayer.drawCard(Convert.ToInt16(match.Groups[1].Value)); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " triggers Delpha, Chronosculptor \\(lvl [0-9]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (match.Success) { ActivePlayer.playerDeck.levelUpCard(new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value) - 1)); return; } }
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; } }
private void parseLineForDeath(String Line, Player ActivePlayer, Player PassivePlayer) { Match match; match = Regex.Match(Line, @"^" + ActivePlayer.playerName + "'s ([a-zA-Z. ,']+) \\(lvl ([0-9])\\) Dies."); if (match.Success) { ActivePlayer.playerDeck.CreatureDies(new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value))); } }
private void parseLineForActivate(String Line, Player ActivePlayer, Player PassivePlayer) { Match match; match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " activates Synapsis Oracle \\(lvl [1-2]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (match.Success) { ActivePlayer.playerDeck.levelUpCardAndDiscard(new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value) - 1)); return; } match = Regex.Match(Line, @"^" + ActivePlayer.playerName + " activates Synapsis Oracle \\(lvl [3]\\) targeting ([a-zA-Z. ,]+) \\(lvl ([0-9])\\)"); if (match.Success) { ActivePlayer.playerDeck.levelUpCard(new Card(match.Groups[1].Value, Convert.ToInt16(match.Groups[2].Value) - 1)); return; } }
private void parseLine(String Line, Player ActivePlayer, Player PassivePlayer) { parseLineForPlay(Line, ActivePlayer, PassivePlayer); parseLineForActivate(Line, ActivePlayer, PassivePlayer); parseLineForTriggers(Line, ActivePlayer, PassivePlayer); parseLineForDeath(Line, ActivePlayer, PassivePlayer); }