public PlayerGameState(ICardFactory cardFactory) { _cardFactory = cardFactory; HandZone = new HandZone(); GraveyardZone = new GraveyardZone(); BattlefieldZone = new BattlefieldZone(); }
public void InitializeGameState(IEnumerable <string> deckCardNames) { Deck = new Deck(_cardFactory); Deck.LoadCardByNames(deckCardNames, this); Deck.Shuffle(); HandZone.ClearHand(); GraveyardZone.ClearGraveyard(); BattlefieldZone.ClearBattlefield(); TurnCounter = 1; DrawOpeningHand(); }
public void InitializeGameState(string deckCsvFilePath) { Deck = new Deck(_cardFactory); Deck.LoadFromCsv(deckCsvFilePath, this); //Deck.Shuffle(); HandZone.ClearHand(); GraveyardZone.ClearGraveyard(); BattlefieldZone.ClearBattlefield(); TurnCounter = 1; DrawOpeningHand(); }
/// <summary> /// Initializes this agent's estimation of the opponent /// </summary> /// <param name="opponent"></param> /// <returns></returns> void SetupOpponent(Game game) { BlindGame = game.Clone(); Opponent = BlindGame.CurrentOpponent; Opponent.Game = BlindGame; OpponentDeck = DeckQuery.GetMostPopular(Opponent.HeroClass); OpponentDeckZone = new DeckZone(Opponent) { Controller = Opponent }; Opponent.Deck = OpponentDeck.Clone(); Opponent.DeckZone = OpponentDeckZone; OpponentGraveyardZone = new GraveyardZone(Opponent); OpponentSecretZone = new SecretZone(Opponent); OpponentSet = true; }
private static void Neutral(IDictionary <string, Power> cards) { // --------------------------------------- MINION - NEUTRAL // [FP1_001] Zombie Chow - COST:1 [ATK:2/HP:3] // - Set: naxx, Rarity: common // -------------------------------------------------------- // Text: <b>Deathrattle:</b> Restore 5 Health to the enemy hero. // -------------------------------------------------------- // GameTag: // - DEATHRATTLE = 1 // -------------------------------------------------------- cards.Add("FP1_001", new Power { DeathrattleTask = new HealTask(5, EntityType.OP_HERO) }); // --------------------------------------- MINION - NEUTRAL // [FP1_002] Haunted Creeper - COST:2 [ATK:1/HP:2] // - Race: beast, Set: naxx, Rarity: common // -------------------------------------------------------- // Text: <b>Deathrattle:</b> Summon two 1/1 Spectral Spiders. // -------------------------------------------------------- // GameTag: // - DEATHRATTLE = 1 // -------------------------------------------------------- cards.Add("FP1_002", new Power { DeathrattleTask = new EnqueueTask(2, new SummonTask("FP1_002t", SummonSide.DEATHRATTLE)) }); // --------------------------------------- MINION - NEUTRAL // [FP1_003] Echoing Ooze - COST:2 [ATK:1/HP:2] // - Set: naxx, Rarity: epic // -------------------------------------------------------- // Text: <b>Battlecry:</b> Summon an exact copy of this minion at the end of the turn. // -------------------------------------------------------- // GameTag: // - BATTLECRY = 1 // -------------------------------------------------------- cards.Add("FP1_003", new Power { PowerTask = ComplexTask.Create( new SetGameTagTask(GameTag.CUSTOM_KEYWORD_EFFECT, 1, EntityType.SOURCE), new SetGameTagTask(GameTag.TAG_SCRIPT_DATA_NUM_1, 1, EntityType.SOURCE), new SetGameTagTask(GameTag.MULTIPLY_BUFF_VALUE, 1, EntityType.SOURCE)), Trigger = new Trigger(TriggerType.TURN_END) { SingleTask = ComplexTask.Create( new ConditionTask(EntityType.SOURCE, SelfCondition.IsTagValue(GameTag.CUSTOM_KEYWORD_EFFECT, 1)), new FlagTask(true, ComplexTask.Create( new SetGameTagTask(GameTag.CUSTOM_KEYWORD_EFFECT, 0, EntityType.SOURCE), new SummonCopyTask(EntityType.SOURCE, SummonSide.RIGHT)))), RemoveAfterTriggered = true } }); // --------------------------------------- MINION - NEUTRAL // [FP1_004] Mad Scientist - COST:2 [ATK:2/HP:2] // - Set: naxx, Rarity: common // -------------------------------------------------------- // Text: <b>Deathrattle:</b> Put a <b>Secret</b> from your deck into the battlefield. // -------------------------------------------------------- // GameTag: // - DEATHRATTLE = 1 // -------------------------------------------------------- // RefTag: // - SECRET = 1 // -------------------------------------------------------- cards.Add("FP1_004", new Power { DeathrattleTask = ComplexTask.PutSecretFromDeck }); // --------------------------------------- MINION - NEUTRAL // [FP1_005] Shade of Naxxramas - COST:3 [ATK:2/HP:2] // - Set: naxx, Rarity: epic // -------------------------------------------------------- // Text: <b>Stealth.</b> At the start of your turn, gain +1/+1. // -------------------------------------------------------- // GameTag: // - STEALTH = 1 // -------------------------------------------------------- cards.Add("FP1_005", new Power { Trigger = new Trigger(TriggerType.TURN_START) { SingleTask = new AddEnchantmentTask("FP1_005e", EntityType.SOURCE) } }); // --------------------------------------- MINION - NEUTRAL // [FP1_007] Nerubian Egg - COST:2 [ATK:0/HP:2] // - Set: naxx, Rarity: rare // -------------------------------------------------------- // Text: <b>Deathrattle:</b> Summon a 4/4 Nerubian. // -------------------------------------------------------- // GameTag: // - DEATHRATTLE = 1 // -------------------------------------------------------- cards.Add("FP1_007", new Power { DeathrattleTask = new SummonTask("FP1_007t", SummonSide.DEATHRATTLE) }); // --------------------------------------- MINION - NEUTRAL // [FP1_008] Spectral Knight - COST:5 [ATK:4/HP:6] // - Set: naxx, Rarity: common // -------------------------------------------------------- // Text: Can't be targeted by spells or Hero Powers. // -------------------------------------------------------- // GameTag: // - CANT_BE_TARGETED_BY_SPELLS = 1 // - CANT_BE_TARGETED_BY_HERO_POWERS = 1 // -------------------------------------------------------- cards.Add("FP1_008", null); // --------------------------------------- MINION - NEUTRAL // [FP1_009] Deathlord - COST:3 [ATK:2/HP:8] // - Set: naxx, Rarity: rare // -------------------------------------------------------- // Text: <b>Taunt. Deathrattle:</b> Your opponent puts a minion from their deck into the battlefield. // -------------------------------------------------------- // GameTag: // - TAUNT = 1 // - DEATHRATTLE = 1 // -------------------------------------------------------- cards.Add("FP1_009", new Power { DeathrattleTask = ComplexTask.Create( new IncludeTask(EntityType.OP_DECK), new FilterStackTask(SelfCondition.IsMinion), new RandomTask(1, EntityType.STACK), new SummonStackTask()) }); // --------------------------------------- MINION - NEUTRAL // [FP1_010] Maexxna - COST:6 [ATK:2/HP:8] // - Race: beast, Set: naxx, Rarity: legendary // -------------------------------------------------------- // Text: <b>Poisonous</b> // -------------------------------------------------------- // GameTag: // - ELITE = 1 // - POISONOUS = 1 // -------------------------------------------------------- cards.Add("FP1_010", null); // --------------------------------------- MINION - NEUTRAL // [FP1_012] Sludge Belcher - COST:5 [ATK:3/HP:5] // - Set: naxx, Rarity: rare // -------------------------------------------------------- // Text: <b>Taunt // Deathrattle:</b> Summon a 1/2 Slime with <b>Taunt</b>. // -------------------------------------------------------- // GameTag: // - TAUNT = 1 // - DEATHRATTLE = 1 // -------------------------------------------------------- cards.Add("FP1_012", new Power { DeathrattleTask = new SummonTask("FP1_012t", SummonSide.DEATHRATTLE) }); // --------------------------------------- MINION - NEUTRAL // [FP1_013] Kel'Thuzad - COST:8 [ATK:6/HP:8] // - Set: naxx, Rarity: legendary // -------------------------------------------------------- // Text: At the end of each turn, summon all friendly minions that died this turn. // -------------------------------------------------------- // GameTag: // - ELITE = 1 // -------------------------------------------------------- cards.Add("FP1_013", new Power { Trigger = new Trigger(TriggerType.TURN_END) { EitherTurn = true, SingleTask = new FuncNumberTask(src => { Controller c = src.Controller; int num = c.NumFriendlyMinionsThatDiedThisTurn; GraveyardZone graveyard = c.GraveyardZone; if (graveyard.Count == 0) { return(0); } int i = graveyard.Count - 1; int j = 0; do { if (graveyard[i] is Minion m && m.ToBeDestroyed) { Generic.SummonBlock.Invoke(c, (Minion)Entity.FromCard(c, m.Card), -1); j++; } i--; } while (j < num && i >= 0); return(0); }) } });
/// <summary> /// Updates this agent's estimation of the opponent /// </summary> void UpdateOpponent(int handSize) { Opponent.Game = BlindGame; Opponent.Deck = OpponentDeck.Clone(); Opponent.DeckZone = OpponentDeckZone.Clone(Opponent); //OpponentDeckZone.Controller = Opponent; OpponentHandZone = new HandZone(Opponent); //{ // Controller = Opponent //}; foreach (Card card in OpponentDeck) { Entity.FromCard(Opponent, card, null, OpponentDeckZone); } foreach (Card card in PlayedSoFar) { if (OpponentDeckZone.Contains(card)) { OpponentDeckZone.Remove(card); } } for (int i = 0; i < handSize; ++i) { IPlayable rnd = OpponentDeckZone.Random; OpponentDeckZone.Remove(rnd); rnd.Controller = OpponentHandZone.Controller; OpponentHandZone.Add(rnd); } Opponent.HandZone = OpponentHandZone.Clone(Opponent); OpponentGraveyardZone = BlindGame.CurrentOpponent.GraveyardZone.Clone(Opponent); if (BlindGame.CurrentOpponent.SecretZone.Count == 0) { OpponentSecretZone = new SecretZone(Opponent); } else if (BlindGame.CurrentOpponent.SecretZone.Count == 1 && BlindGame.CurrentOpponent.SecretZone.Contains(s => s.IsQuest)) { OpponentSecretZone = BlindGame.CurrentOpponent.SecretZone.Clone(Opponent); } else { OpponentSecretZone = new SecretZone(Opponent); if (!OpponentDeck.Contains(c => c.IsSecret)) { AddBlindSecrets(); } else { var secretsPlayed = OpponentGraveyardZone.Where(p => p.Card.IsSecret).ToList(); if (secretsPlayed != null) { List <string> secrets = GetSecrets(Opponent.HeroClass); foreach (Spell s in secretsPlayed) { if (secretsPlayed.Count(s) > 2) { secrets.Remove(s.Card.Name); } } if (secrets.Count != 0) { AddBlindSecrets(secrets); } else { AddBlindSecrets(GetSecrets(Opponent.HeroClass)); } } } } BlindGame.Player2 = Opponent; BlindGame.CurrentPlayer.Game = BlindGame; BlindGame.CurrentOpponent.Game = BlindGame; }