public void OnEntityChoices(KettleEntityChoices entityChoices) { Console.WriteLine("AI EntityChoices called."); if (entityChoices.PlayerId != PlayerId) { return; } SabberStoneCore.Model.Entities.Controller player = PlayerId == 1 ? Session.Game.Player1 : Session.Game.Player2; Choice Choice = player.Choice; List <PlayerTask> options = new List <PlayerTask>(); switch (Choice.ChoiceType) { case ChoiceType.GENERAL: Choice.Choices.ToList().ForEach(p => options.Add(ChooseTask.Pick(player, p))); break; case ChoiceType.MULLIGAN: IEnumerable <IEnumerable <int> > choices = SabberStoneCore.Model.Util.GetPowerSet(Choice.Choices); choices.ToList().ForEach(p => options.Add(ChooseTask.Mulligan(player, p.ToList()))); break; default: throw new NotImplementedException(); } // Do AI shit PlayerTask option = DoAI(options); // Convert it to a kettle choices KettleChooseEntities chooseEntities = new KettleChooseEntities(); chooseEntities.Id = entityChoices.Id; chooseEntities.Choices = ((ChooseTask)option).Choices; Adapter.SendMessage(chooseEntities); }
public void OnEntityChoices(KettleEntityChoices entityChoices) { Console.WriteLine("AI EntityChoices called."); if (entityChoices.PlayerId != PlayerId) { return; } var pickList = new List <int>(); switch ((ChoiceType)entityChoices.ChoiceType) { case ChoiceType.MULLIGAN: var picks = Rand.Next(0, entityChoices.Entities.Count); pickList.AddRange(entityChoices.Entities); for (var i = 0; i < picks; i++) { pickList.Remove(pickList[Rand.Next(0, pickList.Count)]); } break; case ChoiceType.GENERAL: pickList.Add(entityChoices.Entities[Rand.Next(0, entityChoices.Entities.Count)]); break; case ChoiceType.INVALID: default: throw new NotImplementedException(); } Adapter.SendMessage(new KettleChooseEntities() { Id = entityChoices.Id, Choices = pickList }); }
private static void SendQueue() { _adapter.SendMessage(_history); _history.Clear(); }
public void OnChooseEntities(KettleChooseEntities chooseEntities) { Console.WriteLine("simulator OnChooseEntities called"); if (chooseEntities.Id == 1) { Adapter.SendMessage(TagChangeTest(2, (int)GameTag.MULLIGAN_STATE, (int)Mulligan.DEALING)); Adapter.SendMessage(BlockStartTest("", 6, 2, 0, (int)BlockType.TRIGGER)); Adapter.SendMessage(TagChangeTest(43, (int)GameTag.ZONE, (int)Zone.HAND)); Adapter.SendMessage(TagChangeTest(43, (int)GameTag.ZONE_POSITION, 1)); Adapter.SendMessage(TagChangeTest(57, (int)GameTag.ZONE, (int)Zone.DECK)); Adapter.SendMessage(TagChangeTest(57, (int)GameTag.ZONE_POSITION, 0)); Adapter.SendMessage(TagChangeTest(59, (int)GameTag.ZONE, (int)Zone.HAND)); Adapter.SendMessage(TagChangeTest(59, (int)GameTag.ZONE_POSITION, 2)); Adapter.SendMessage(TagChangeTest(34, (int)GameTag.ZONE, (int)Zone.DECK)); Adapter.SendMessage(TagChangeTest(34, (int)GameTag.ZONE_POSITION, 0)); Adapter.SendMessage(TagChangeTest(51, (int)GameTag.ZONE, (int)Zone.HAND)); Adapter.SendMessage(TagChangeTest(51, (int)GameTag.ZONE_POSITION, 3)); Adapter.SendMessage(TagChangeTest(46, (int)GameTag.ZONE, (int)Zone.DECK)); Adapter.SendMessage(TagChangeTest(46, (int)GameTag.ZONE_POSITION, 0)); Adapter.SendMessage(TagChangeTest(2, (int)GameTag.MULLIGAN_STATE, (int)Mulligan.WAITING)); Adapter.SendMessage(BlockEndTest()); Adapter.SendMessage(BlockStartTest("", 7, 2, 0, (int)BlockType.TRIGGER)); Adapter.SendMessage(TagChangeTest(2, (int)GameTag.MULLIGAN_STATE, (int)Mulligan.DONE)); Adapter.SendMessage(BlockEndTest()); Adapter.SendMessage(TagChangeTest(3, (int)GameTag.MULLIGAN_STATE, (int)Mulligan.DEALING)); Adapter.SendMessage(BlockStartTest("", 6, 3, 0, (int)BlockType.TRIGGER)); Adapter.SendMessage(ShowEntityTest(22, "OG_162", new Dictionary <int, int> { [(int)GameTag.PREMIUM] = 0, [(int)GameTag.DAMAGE] = 0, [(int)GameTag.HEALTH] = 1, [(int)GameTag.ATK] = 2, [(int)GameTag.COST] = 3, [(int)GameTag.ZONE] = (int)Zone.HAND, [(int)GameTag.CONTROLLER] = 1, [(int)GameTag.ENTITY_ID] = 22, //[(int)GameTag.ELITE] = 1, [(int)GameTag.SILENCED] = 0, [(int)GameTag.WINDFURY] = 0, [(int)GameTag.TAUNT] = 0, [(int)GameTag.STEALTH] = 0, [(int)GameTag.DIVINE_SHIELD] = 0, [(int)GameTag.CHARGE] = 0, //[(int)GameTag.FACTION] = (int)Faction.NEUTRAL, [(int)GameTag.CARDTYPE] = (int)CardType.MINION, [(int)GameTag.RARITY] = (int)Rarity.RARE, [(int)GameTag.BATTLECRY] = 1, [(int)GameTag.FROZEN] = 0, [(int)GameTag.ZONE_POSITION] = 0, [(int)GameTag.NUM_ATTACKS_THIS_TURN] = 0, [(int)GameTag.FORCED_PLAY] = 0, [(int)GameTag.TO_BE_DESTROYED] = 0, [(int)GameTag.START_WITH_1_HEALTH] = 0, [(int)GameTag.CUSTOM_KEYWORD_EFFECT] = 0, [(int)GameTag.RITUAL] = 1, [(int)GameTag.EXTRA_ATTACKS_THIS_TURN] = 0, [(int)GameTag.TAG_LAST_KNOWN_COST_IN_HAND] = 3, [479] = 2, })); Adapter.SendMessage(TagChangeTest(22, (int)GameTag.ZONE_POSITION, 2)); Adapter.SendMessage(new KettleHistoryHideEntity() { EntityId = 15, Zone = (int)Zone.DECK }); Adapter.SendMessage(TagChangeTest(15, (int)GameTag.ZONE, (int)Zone.DECK)); Adapter.SendMessage(TagChangeTest(15, (int)GameTag.ZONE_POSITION, 0)); Adapter.SendMessage(ShowEntityTest(26, "LOE_077", new Dictionary <int, int> { [(int)GameTag.PREMIUM] = 0, [(int)GameTag.DAMAGE] = 0, [(int)GameTag.HEALTH] = 4, [(int)GameTag.ATK] = 2, [(int)GameTag.COST] = 3, [(int)GameTag.ZONE] = (int)Zone.HAND, [(int)GameTag.CONTROLLER] = 1, [(int)GameTag.ENTITY_ID] = 26, [(int)GameTag.ELITE] = 1, [(int)GameTag.SILENCED] = 0, [(int)GameTag.WINDFURY] = 0, [(int)GameTag.TAUNT] = 0, [(int)GameTag.STEALTH] = 0, [(int)GameTag.DIVINE_SHIELD] = 0, [(int)GameTag.CHARGE] = 0, //[(int)GameTag.FACTION] = (int)Faction.NEUTRAL, [(int)GameTag.CARDTYPE] = (int)CardType.MINION, [(int)GameTag.RARITY] = (int)Rarity.LEGENDARY, //[(int)GameTag.BATTLECRY] = 1, [(int)GameTag.FROZEN] = 0, [(int)GameTag.ZONE_POSITION] = 0, [(int)GameTag.NUM_ATTACKS_THIS_TURN] = 0, [(int)GameTag.FORCED_PLAY] = 0, [(int)GameTag.TO_BE_DESTROYED] = 0, [(int)GameTag.AURA] = 1, [(int)GameTag.START_WITH_1_HEALTH] = 0, [(int)GameTag.CUSTOM_KEYWORD_EFFECT] = 0, //[(int)GameTag.RITUAL] = 1, [(int)GameTag.EXTRA_ATTACKS_THIS_TURN] = 0, [(int)GameTag.TAG_LAST_KNOWN_COST_IN_HAND] = 3, [479] = 2, })); Adapter.SendMessage(TagChangeTest(26, (int)GameTag.ZONE_POSITION, 3)); Adapter.SendMessage(new KettleHistoryHideEntity() { EntityId = 18, Zone = (int)Zone.DECK }); Adapter.SendMessage(TagChangeTest(18, (int)GameTag.ZONE, (int)Zone.DECK)); Adapter.SendMessage(TagChangeTest(18, (int)GameTag.ZONE_POSITION, 0)); Adapter.SendMessage(TagChangeTest(2, (int)GameTag.MULLIGAN_STATE, (int)Mulligan.WAITING)); Adapter.SendMessage(BlockEndTest()); Adapter.SendMessage(BlockStartTest("", 7, 3, 0, (int)BlockType.TRIGGER)); Adapter.SendMessage(TagChangeTest(3, (int)GameTag.MULLIGAN_STATE, (int)Mulligan.DONE)); Adapter.SendMessage(TagChangeTest(1, (int)GameTag.STEP, (int)Step.MAIN_READY)); Adapter.SendMessage(TagChangeTest(1, (int)GameTag.NEXT_STEP, (int)Step.MAIN_START_TRIGGERS)); Adapter.SendMessage(TagChangeTest(1, (int)GameTag.STEP, (int)Step.MAIN_START_TRIGGERS)); Adapter.SendMessage(TagChangeTest(1, (int)GameTag.NEXT_STEP, (int)Step.MAIN_START)); Adapter.SendMessage(TagChangeTest(1, (int)GameTag.STEP, (int)Step.MAIN_START)); Adapter.SendMessage(TagChangeTest(1, (int)GameTag.NEXT_STEP, (int)Step.MAIN_ACTION)); Adapter.SendMessage(TagChangeTest(1, (int)GameTag.STEP, (int)Step.MAIN_ACTION)); Adapter.SendMessage(TagChangeTest(1, (int)GameTag.NEXT_STEP, (int)Step.MAIN_END)); Adapter.SendMessage(BlockEndTest()); /* MAIN READY !!! */ //Adapter.SendMessage(TagChangeTest(1, (int)GameTag.STEP, (int)Step.MAIN_READY)); //Adapter.SendMessage(BlockStartTest("", 1, 2, 0, (int)BlockType.TRIGGER)); //Adapter.SendMessage(TagChangeTest(66, (int)GameTag.NUM_TURNS_IN_PLAY, 1)); //Adapter.SendMessage(TagChangeTest(67, (int)GameTag.NUM_TURNS_IN_PLAY, 1)); //Adapter.SendMessage(TagChangeTest(64, (int)GameTag.NUM_TURNS_IN_PLAY, 1)); //Adapter.SendMessage(TagChangeTest(65, (int)GameTag.NUM_TURNS_IN_PLAY, 1)); //Adapter.SendMessage(TagChangeTest(2, (int)GameTag.RESOURCES, 1)); //Adapter.SendMessage(TagChangeTest(2, (int)GameTag.NUM_CARDS_DRAWN_THIS_TURN, 0)); //Adapter.SendMessage(TagChangeTest(1, (int)GameTag.NEXT_STEP, (int)Step.MAIN_START_TRIGGERS)); //Adapter.SendMessage(BlockEndTest()); /* MAIN START TRIGGERS !!! */ //Adapter.SendMessage(TagChangeTest(1, (int)GameTag.STEP, (int)Step.MAIN_START_TRIGGERS)); //Adapter.SendMessage(BlockStartTest("", 8, 2, 0, (int)BlockType.TRIGGER)); //Adapter.SendMessage(TagChangeTest(1, (int)GameTag.NEXT_STEP, (int)Step.MAIN_START)); //Adapter.SendMessage(BlockEndTest()); /* MAIN START !!! */ //Adapter.SendMessage(TagChangeTest(1, (int)GameTag.STEP, (int)Step.MAIN_START)); // start turn block //Adapter.SendMessage(BlockStartTest("", 0, 2, 0, (int)BlockType.TRIGGER)); //Adapter.SendMessage(TagChangeTest(2, 467, 1)); //Adapter.SendMessage(ShowEntityTest(62, "CS2_182", new Dictionary<int, int> //{ // [(int)GameTag.PREMIUM] = 0, // [(int)GameTag.DAMAGE] = 0, // [(int)GameTag.HEALTH] = 5, // [(int)GameTag.ATK] = 4, // [(int)GameTag.COST] = 4, // [(int)GameTag.ZONE] = (int)Zone.HAND, // [(int)GameTag.CONTROLLER] = 2, // [(int)GameTag.ENTITY_ID] = 62, // //[(int)GameTag.ELITE] = 1, // [(int)GameTag.SILENCED] = 0, // [(int)GameTag.WINDFURY] = 0, // [(int)GameTag.TAUNT] = 0, // [(int)GameTag.STEALTH] = 0, // [(int)GameTag.DIVINE_SHIELD] = 0, // [(int)GameTag.CHARGE] = 0, // [(int)GameTag.FACTION] = (int)Faction.NEUTRAL, // [(int)GameTag.CARDTYPE] = (int)CardType.MINION, // [(int)GameTag.RARITY] = (int)Rarity.COMMON, // //[(int)GameTag.BATTLECRY] = 1, // [(int)GameTag.FROZEN] = 0, // [(int)GameTag.ZONE_POSITION] = 0, // [(int)GameTag.NUM_ATTACKS_THIS_TURN] = 0, // [(int)GameTag.FORCED_PLAY] = 0, // [(int)GameTag.TO_BE_DESTROYED] = 0, // //[(int)GameTag.AURA] = 1, // [(int)GameTag.START_WITH_1_HEALTH] = 0, // [(int)GameTag.CUSTOM_KEYWORD_EFFECT] = 0, // //[(int)GameTag.RITUAL] = 1, // [(int)GameTag.EXTRA_ATTACKS_THIS_TURN] = 0, // [(int)GameTag.TAG_LAST_KNOWN_COST_IN_HAND] = 4, // //[479] = 4, //})); //Adapter.SendMessage(TagChangeTest(62, (int)GameTag.ZONE_POSITION, 4)); //Adapter.SendMessage(TagChangeTest(2, (int)GameTag.NUM_CARDS_DRAWN_THIS_TURN, 1)); //Adapter.SendMessage(TagChangeTest(2, 467, 0)); //Adapter.SendMessage(TagChangeTest(1, (int)GameTag.NEXT_STEP, (int)Step.MAIN_ACTION)); //Adapter.SendMessage(BlockEndTest()); /* MAIN ACTION !!! */ //Adapter.SendMessage(TagChangeTest(1, (int)GameTag.STEP, (int)Step.MAIN_ACTION)); //Adapter.SendMessage(BlockStartTest("", 2, 2, 0, (int)BlockType.TRIGGER)); // Adapter.SendMessage(TagChangeTest(1, (int)GameTag.NEXT_STEP, (int)Step.MAIN_END)); //Adapter.SendMessage(BlockEndTest()); } if (chooseEntities.Id == 2) { Adapter.SendMessage(TagChangeTest(2, (int)GameTag.MULLIGAN_STATE, (int)Mulligan.DEALING)); Adapter.SendMessage(BlockStartTest("", 6, 2, 0, (int)BlockType.TRIGGER)); Adapter.SendMessage(ShowEntityTest(43, "CS2_029", new Dictionary <int, int> { [(int)GameTag.PREMIUM] = 0, [(int)GameTag.DAMAGE] = 0, //[(int)GameTag.HEALTH] = 5, //[(int)GameTag.ATK] = 5, [(int)GameTag.COST] = 4, [(int)GameTag.ZONE] = (int)Zone.HAND, [(int)GameTag.CONTROLLER] = 2, [(int)GameTag.ENTITY_ID] = 43, //[(int)GameTag.ELITE] = 1, [(int)GameTag.SILENCED] = 0, [(int)GameTag.WINDFURY] = 0, [(int)GameTag.TAUNT] = 0, [(int)GameTag.STEALTH] = 0, [(int)GameTag.DIVINE_SHIELD] = 0, [(int)GameTag.CHARGE] = 0, [(int)GameTag.FACTION] = (int)Faction.NEUTRAL, [(int)GameTag.CARDTYPE] = (int)CardType.SPELL, [(int)GameTag.RARITY] = (int)Rarity.FREE, [(int)GameTag.FROZEN] = 0, [(int)GameTag.ZONE_POSITION] = 0, [(int)GameTag.NUM_ATTACKS_THIS_TURN] = 0, [(int)GameTag.FORCED_PLAY] = 0, [(int)GameTag.TO_BE_DESTROYED] = 0, [(int)GameTag.START_WITH_1_HEALTH] = 0, [(int)GameTag.CUSTOM_KEYWORD_EFFECT] = 0, [(int)GameTag.EXTRA_ATTACKS_THIS_TURN] = 0, [(int)GameTag.TAG_LAST_KNOWN_COST_IN_HAND] = 4, [479] = 0, })); Adapter.SendMessage(TagChangeTest(43, (int)GameTag.ZONE_POSITION, 1)); Adapter.SendMessage(new KettleHistoryHideEntity() { EntityId = 57, Zone = (int)Zone.DECK }); Adapter.SendMessage(TagChangeTest(57, (int)GameTag.ZONE, (int)Zone.DECK)); Adapter.SendMessage(TagChangeTest(57, (int)GameTag.ZONE_POSITION, 0)); Adapter.SendMessage(ShowEntityTest(59, "OG_141", new Dictionary <int, int> { [(int)GameTag.PREMIUM] = 0, [(int)GameTag.DAMAGE] = 0, [(int)GameTag.HEALTH] = 10, [(int)GameTag.ATK] = 10, [(int)GameTag.COST] = 10, [(int)GameTag.ZONE] = (int)Zone.HAND, [(int)GameTag.CONTROLLER] = 2, [(int)GameTag.ENTITY_ID] = 59, //[(int)GameTag.ELITE] = 1, [(int)GameTag.SILENCED] = 0, [(int)GameTag.WINDFURY] = 0, [(int)GameTag.TAUNT] = 0, [(int)GameTag.STEALTH] = 0, [(int)GameTag.DIVINE_SHIELD] = 0, [(int)GameTag.CHARGE] = 0, //[(int)GameTag.FACTION] = (int)Faction.NEUTRAL, [(int)GameTag.CARDTYPE] = (int)CardType.MINION, [(int)GameTag.RARITY] = (int)Rarity.COMMON, [(int)GameTag.FROZEN] = 0, [(int)GameTag.ZONE_POSITION] = 0, [(int)GameTag.NUM_ATTACKS_THIS_TURN] = 0, [(int)GameTag.FORCED_PLAY] = 0, [(int)GameTag.TO_BE_DESTROYED] = 0, [(int)GameTag.START_WITH_1_HEALTH] = 0, [(int)GameTag.CUSTOM_KEYWORD_EFFECT] = 0, [(int)GameTag.EXTRA_ATTACKS_THIS_TURN] = 0, [(int)GameTag.TAG_LAST_KNOWN_COST_IN_HAND] = 10, [479] = 10, })); Adapter.SendMessage(TagChangeTest(59, (int)GameTag.ZONE_POSITION, 2)); Adapter.SendMessage(new KettleHistoryHideEntity() { EntityId = 34, Zone = (int)Zone.DECK }); Adapter.SendMessage(TagChangeTest(34, (int)GameTag.ZONE, (int)Zone.DECK)); Adapter.SendMessage(TagChangeTest(34, (int)GameTag.ZONE_POSITION, 0)); Adapter.SendMessage(ShowEntityTest(51, "EX1_399", new Dictionary <int, int> { [(int)GameTag.PREMIUM] = 0, [(int)GameTag.TRIGGER_VISUAL] = 1, [(int)GameTag.DAMAGE] = 0, [(int)GameTag.HEALTH] = 7, [(int)GameTag.ATK] = 2, [(int)GameTag.COST] = 5, [(int)GameTag.ZONE] = (int)Zone.HAND, [(int)GameTag.CONTROLLER] = 2, [(int)GameTag.ENTITY_ID] = 51, //[(int)GameTag.ELITE] = 1, [(int)GameTag.SILENCED] = 0, [(int)GameTag.WINDFURY] = 0, [(int)GameTag.TAUNT] = 0, [(int)GameTag.STEALTH] = 0, [(int)GameTag.DIVINE_SHIELD] = 0, [(int)GameTag.CHARGE] = 0, [(int)GameTag.FACTION] = (int)Faction.NEUTRAL, [(int)GameTag.CARDTYPE] = (int)CardType.MINION, [(int)GameTag.RARITY] = (int)Rarity.COMMON, [(int)GameTag.FROZEN] = 0, [(int)GameTag.ZONE_POSITION] = 0, [(int)GameTag.NUM_ATTACKS_THIS_TURN] = 0, [(int)GameTag.FORCED_PLAY] = 0, [(int)GameTag.TO_BE_DESTROYED] = 0, [(int)GameTag.START_WITH_1_HEALTH] = 0, [(int)GameTag.CUSTOM_KEYWORD_EFFECT] = 0, [(int)GameTag.EXTRA_ATTACKS_THIS_TURN] = 0, [(int)GameTag.TAG_LAST_KNOWN_COST_IN_HAND] = 5, [479] = 5, })); Adapter.SendMessage(TagChangeTest(51, (int)GameTag.ZONE_POSITION, 3)); Adapter.SendMessage(new KettleHistoryHideEntity() { EntityId = 46, Zone = (int)Zone.DECK }); Adapter.SendMessage(TagChangeTest(46, (int)GameTag.ZONE, (int)Zone.DECK)); Adapter.SendMessage(TagChangeTest(46, (int)GameTag.ZONE_POSITION, 0)); Adapter.SendMessage(TagChangeTest(2, (int)GameTag.MULLIGAN_STATE, (int)Mulligan.WAITING)); Adapter.SendMessage(BlockEndTest()); Adapter.SendMessage(BlockStartTest("", 7, 2, 0, (int)BlockType.TRIGGER)); Adapter.SendMessage(TagChangeTest(2, (int)GameTag.MULLIGAN_STATE, (int)Mulligan.DONE)); // Adapter.SendMessage(TagChangeTest(1, (int)GameTag.NEXT_STEP, (int)Step.MAIN_READY)); Adapter.SendMessage(BlockEndTest()); } }