public static void UpdateDisplay() { Console.Clear(); Console.WriteLine(String.Format("STATE - {0}", PlayTracker.Global.State)); Console.WriteLine(String.Format("MANA - {0} \\ {1}", PlayTracker.Global.Mana, PlayTracker.Global.MaxMana)); if (PlayTracker.Global.State == PlayTracker.GameState.NotInitialized || PlayTracker.Global.State == PlayTracker.GameState.Idle) { return; } GameCards gc = PlayTracker.Global.Cards; PrintLabel(String.Format("PLAYER [{0}]", gc.PlayerHero.Name)); PrintLabel("HAND"); PrintCards(gc.PlayerHand.CardsInList); PrintLabel("PLAY"); PrintCards(gc.PlayerPlay.CardsInList); PrintLabel(String.Format("OPPONENT [{0}]", gc.OpponentHero != null ? gc.OpponentHero.Name : "NOT FOUND")); PrintLabel("HAND"); PrintCards(gc.OpponentZonedCards, GameCards.Zones.HAND); PrintLabel("PLAY"); PrintCards(gc.OpponentPlay.CardsInList); PrintLabel("GRAVEYARD"); PrintCards(gc.OpponentZonedCards, GameCards.Zones.GRAVEYARD); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); GameCards unfilteredCards = new GameCards(); unfilteredCards.Init(PlayTracker.Global.unfiltered, null, false); PrintLabel(String.Format("PLAYER [{0}]", unfilteredCards.PlayerHero.Name)); PrintLabel("HAND"); PrintCards(unfilteredCards.PlayerZonedCards, GameCards.Zones.HAND); PrintLabel("PLAY"); PrintCards(unfilteredCards.PlayerZonedCards, GameCards.Zones.PLAY); PrintLabel(String.Format("OPPONENT [{0}]", unfilteredCards.OpponentHero != null ? unfilteredCards.OpponentHero.Name : "NOT FOUND")); PrintLabel("HAND"); PrintCards(unfilteredCards.OpponentZonedCards, GameCards.Zones.HAND); PrintLabel("PLAY"); PrintCards(unfilteredCards.OpponentZonedCards, GameCards.Zones.PLAY); Console.WriteLine(); Console.WriteLine(); PrintLabel("PLAYED THIS TURN"); if (Program.PlayedThisTurn == null) return; foreach(int i in Program.PlayedThisTurn) { Console.Write(i); Console.Write(", "); } Console.WriteLine(); }
private static void PrintCards(List<CardWrapper>[] cardGroup, GameCards.Zones zone) { foreach (CardWrapper card in cardGroup[(int)zone]) { Console.WriteLine(String.Format("{0} @ {1} | {2}", card.Name, card.ZonePos, card.Id)); } }
public static void UpdateDisplay() { Console.Clear(); Console.WriteLine(String.Format("STATE - {0}", PlayTracker.Global.State)); Console.WriteLine(String.Format("MANA - {0} \\ {1}", PlayTracker.Global.Mana, PlayTracker.Global.MaxMana)); if (PlayTracker.Global.State == PlayTracker.GameState.NotInitialized || PlayTracker.Global.State == PlayTracker.GameState.Idle) { return; } GameCards gc = PlayTracker.Global.Cards; PrintLabel(String.Format("PLAYER [{0}]", gc.PlayerHero.Name)); PrintLabel("HAND"); PrintCards(gc.PlayerHand.CardsInList); PrintLabel("PLAY"); PrintCards(gc.PlayerPlay.CardsInList); PrintLabel(String.Format("OPPONENT [{0}]", gc.OpponentHero != null ? gc.OpponentHero.Name : "NOT FOUND")); PrintLabel("HAND"); PrintCards(gc.OpponentZonedCards, GameCards.Zones.HAND); PrintLabel("PLAY"); PrintCards(gc.OpponentPlay.CardsInList); PrintLabel("GRAVEYARD"); PrintCards(gc.OpponentZonedCards, GameCards.Zones.GRAVEYARD); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); GameCards unfilteredCards = new GameCards(); unfilteredCards.Init(PlayTracker.Global.unfiltered, null, false); PrintLabel(String.Format("PLAYER [{0}]", unfilteredCards.PlayerHero.Name)); PrintLabel("HAND"); PrintCards(unfilteredCards.PlayerZonedCards, GameCards.Zones.HAND); PrintLabel("PLAY"); PrintCards(unfilteredCards.PlayerZonedCards, GameCards.Zones.PLAY); PrintLabel(String.Format("OPPONENT [{0}]", unfilteredCards.OpponentHero != null ? unfilteredCards.OpponentHero.Name : "NOT FOUND")); PrintLabel("HAND"); PrintCards(unfilteredCards.OpponentZonedCards, GameCards.Zones.HAND); PrintLabel("PLAY"); PrintCards(unfilteredCards.OpponentZonedCards, GameCards.Zones.PLAY); Console.WriteLine(); Console.WriteLine(); PrintLabel("PLAYED THIS TURN"); if (Program.PlayedThisTurn == null) { return; } foreach (int i in Program.PlayedThisTurn) { Console.Write(i); Console.Write(", "); } Console.WriteLine(); }
public void Update() { List <CardWrapper> cards = searcher.GetCardList(); this.unfiltered = cards; this.Cards = new GameCards(); this.Cards.Init(cards); // No cards, must be idle if (this.Cards.PlayerHero == null) { this.State = GameState.Idle; return; } else if (this.State == GameState.Idle) { this.State = GameState.Mulliganing; } // We make assummptions that we are in the idle start when the app starts if (this.State == GameState.NotInitialized) { throw new Exception("Start Hearthstone-Bot before entering a game!"); } // Game has started, we go from idle state into mulligan state // Leave mulligan state once the number of cards in our hand has increased if (this.State == GameState.Mulliganing) { // We drew a card so we aren't in mulligan phase anymore if (this.lastTurnHand != null && this.lastTurnHand.Count < this.Cards.PlayerHand.CardsInList.Count) { this.State = GameState.MyTurn; this.MaxMana = 1; this.Mana = 1; } this.lastTurnHand = this.Cards.PlayerHand.CardsInList; } if (this.State == GameState.OpponentTurn) { bool sameCards = true; for (int i = 0; i < this.lastTurnHand.Count && i < this.Cards.PlayerHand.CardsInList.Count; ++i) { CardWrapper handCard = this.Cards.PlayerHand.CardsInList[i]; if (this.lastTurnHand.FirstOrDefault(c => c.Id == handCard.Id) == null) { sameCards = false; break; } } if (this.lastTurnHand.Count < this.Cards.PlayerHand.CardsInList.Count || sameCards == false) { // Explain WHY it became my turn because I am very confused FileLogger.Global.LogLine("Switching turns"); FileLogger.Global.LogLine("------------"); FileLogger.Global.LogLine("LastTurnHand"); FileLogger.Global.LogLine("------------"); foreach (CardWrapper card in this.lastTurnHand) { FileLogger.Global.LogLine(String.Format("{0} | {1}", card.Name, card.Id)); } FileLogger.Global.LogLine("------------"); FileLogger.Global.LogLine("PlayerHand"); FileLogger.Global.LogLine("------------"); foreach (CardWrapper card in this.Cards.PlayerHand.CardsInList) { FileLogger.Global.LogLine(String.Format("{0} | {1}", card.Name, card.Id)); } FileLogger.Global.LogLine(String.Empty); FileLogger.Global.LogLine(String.Empty); FileLogger.Global.LogLine(String.Empty); this.State = GameState.MyTurn; this.MaxMana++; this.Mana = this.MaxMana; } } }
public UniqueCardList(GameCards.Zones zone, List<CardWrapper>[] compare) { this.ZoneList = zone; this.CardsCompare = compare; }