From 938c68bf52c59944eb2d7b6e03c7e3c249f49d0e Mon Sep 17 00:00:00 2001 From: xOlanga Date: Tue, 17 Jan 2023 01:14:55 +0000 Subject: [PATCH] Updated to 1.3 Nerubian Vizier Fix, Better Lethal calculation and more Signed-off-by: xOlanga --- ...S)\345\277\253\346\224\273\346\263\225.cs" | 226 ++++++++++++++++-- 1 file changed, 205 insertions(+), 21 deletions(-) diff --git "a/smartbot/Profiles/Olanga\346\240\207\345\207\206(S)\345\277\253\346\224\273\346\263\225.cs" "b/smartbot/Profiles/Olanga\346\240\207\345\207\206(S)\345\277\253\346\224\273\346\263\225.cs" index b0d16748c..d4d31d027 100644 --- "a/smartbot/Profiles/Olanga\346\240\207\345\207\206(S)\345\277\253\346\224\273\346\263\225.cs" +++ "b/smartbot/Profiles/Olanga\346\240\207\345\207\206(S)\345\277\253\346\224\273\346\263\225.cs" @@ -6,6 +6,7 @@ using SmartBot.Plugins.API; using SmartBotAPI.Plugins.API; using SmartBotAPI.Battlegrounds; using SmartBot.Plugins.API.Actions; +using Microsoft.Win32; // IF YOU READ THIS PLEASE GET INTO CREATING PROFILES :) // WE NEED MORE PEOPLE DOOING THIS AND ITS ACTUALLY FUN // @@ -135,8 +136,16 @@ namespace SmartBotProfiles {Card.Cards.CORE_EX1_249, 2},//Baron Geddon CORE_EX1_249 {Card.Cards.DMF_254, 30},//Baron Geddon CORE_EX1_249 }; -#endregion + //List of all undead cards + private static readonly List _undeadTable = new List() + { + + Card.Cards.CORE_EX1_012, // Bloodmage Thalnos + Card.Cards.RLK_834, // Nerubian Vizier + Card.Cards.REV_845 //Undead Skeleton + }; +#endregion #region Attack Modes and Customization public ProfileParameters GetParameters(Board board) @@ -216,14 +225,111 @@ namespace SmartBotProfiles { int friendCount = board.MinionFriend.Count; int HandCount = board.Hand.Count; + int AvailableMana = board.ManaAvailable; + + int MinionWith2Health=board.MinionEnemy.Count(minion => minion.CurrentHealth == 2); + int MinionWith3Health=board.MinionEnemy.Count(minion => minion.CurrentHealth == 3); + int MinionWith4Health=board.MinionEnemy.Count(minion => minion.CurrentHealth == 4); + int MinionWith5Health=board.MinionEnemy.Count(minion => minion.CurrentHealth == 5); + int MinionWith6Health=board.MinionEnemy.Count(minion => minion.CurrentHealth == 6); + + int MinionWith3OrLessHealth=board.MinionEnemy.Count(minion => minion.CurrentHealth <= 3); + int MinionWith4OrLessHealth=board.MinionEnemy.Count(minion => minion.CurrentHealth <= 4); + int MinionWith5OrLessHealth=board.MinionEnemy.Count(minion => minion.CurrentHealth <= 5); + int MinionWith6OrLessHealth=board.MinionEnemy.Count(minion => minion.CurrentHealth <= 6); + + int MinionWith2OrMoreAttack=board.MinionEnemy.Count(minion => minion.CurrentAtk >= 2); + int MinionWith3OrMoreAttack=board.MinionEnemy.Count(minion => minion.CurrentAtk >= 3); + int MinionWith4OrMoreAttack=board.MinionEnemy.Count(minion => minion.CurrentAtk >= 4); + int MinionWith5OrMoreAttack=board.MinionEnemy.Count(minion => minion.CurrentAtk >= 5); + int MinionWith6OrMoreAttack=board.MinionEnemy.Count(minion => minion.CurrentAtk >= 6); + + int NoOkani = board.MinionEnemy.Count(card => card.Template.Id == Card.Cards.TSC_032); + + int NoObjection = 0; + if(board.SecretEnemyCount > 0 + &&board.EnemyClass==Card.CClass.MAGE){NoObjection=1;} + +#endregion + +#region Face Damage with Spells + int HasBloodmage= board.MinionFriend.Count(card => card.Template.Id == Card.Cards.CORE_EX1_012); //Bloodmage Thalnos + int HasGuildTrader= board.MinionFriend.Count(card => card.Template.Id == Card.Cards.SW_061); //Guild Trader + int HasAegwynn= board.MinionFriend.Count(card => card.Template.Id == Card.Cards.CS3_001); // CS3_001 + + //int TotalSpellDamage=0; + + int SpellDamage = board.MinionFriend.FindAll(x => x.IsSilenced == false).Sum(x => x.SpellPower); + + int BoltsInHand = board.Hand.Count(card => card.Template.Id == Card.Cards.RLK_843); + int BoltBurn = (BoltsInHand*2); + if(board.MaxMana>7){BoltBurn=(BoltsInHand*3);} + int BoltCost = board.Hand.FindAll(x => x.Template.Id == Card.Cards.RLK_843).Sum(x => x.CurrentCost); + + int TouchesInHand = board.Hand.Count(card => card.Template.Id == Card.Cards.REV_601); + int TouchBurn = (TouchesInHand*3); + int TouchCost = board.Hand.FindAll(x => x.Template.Id == Card.Cards.REV_601).Sum(x => x.CurrentCost); + + int InfusedTouchesInHand = board.Hand.Count(card => card.Template.Id == Card.Cards.REV_601t); + int InfusedTouchBurn = (InfusedTouchesInHand*3*2); + int InfusedTouchCost = InfusedTouchesInHand*4; + + int FireballsInHand = board.Hand.Count(card => card.Template.Id == Card.Cards.CORE_CS2_029); + int FireballBurn = (FireballsInHand*6); + int FireballCost = board.Hand.FindAll(x => x.Template.Id == Card.Cards.CORE_CS2_029).Sum(x => x.CurrentCost); + + int OrbsInhand = board.Hand.Count(card => card.Template.Id == Card.Cards.BAR_541); + int OrbBurn = (OrbsInhand*2); + int OrbCost = board.Hand.FindAll(x => x.Template.Id == Card.Cards.BAR_541).Sum(x => x.CurrentCost); + + int TotalBurn = (BoltBurn+TouchBurn+InfusedTouchBurn+FireballBurn+OrbBurn); + if(SpellDamage>0){TotalBurn=(TotalBurn)+((SpellDamage)*(TouchesInHand+InfusedTouchesInHand+FireballsInHand+BoltsInHand+OrbsInhand));} + int TotalBurnCost = (BoltCost+TouchCost+InfusedTouchCost+FireballCost+OrbCost); + + int LethalWithSpells = 0; + + int EnemyHeroHealth = (board.HeroEnemy.CurrentHealth + board.HeroEnemy.CurrentArmor) - TotalBurn; + + if(AvailableMana<=TotalBurnCost + &&TotalBurn>=(board.HeroEnemy.CurrentHealth + board.HeroEnemy.CurrentArmor)){LethalWithSpells=1;} + + + if(AvailableMana<=TotalBurnCost + &&TotalBurn>=(board.HeroEnemy.CurrentHealth + board.HeroEnemy.CurrentArmor)){ + p.GlobalAggroModifier=999; + p.CastSpellsModifiers.AddOrUpdate(Card.Cards.RLK_843, new Modifier(-3000)); //Bolts + p.CastSpellsModifiers.AddOrUpdate(Card.Cards.REV_601, new Modifier(-3000)); //Touches + p.CastSpellsModifiers.AddOrUpdate(Card.Cards.REV_601t, new Modifier(-3000)); //Infused Touches + p.CastSpellsModifiers.AddOrUpdate(Card.Cards.CORE_CS2_029, new Modifier(-3000)); //Fireballs + p.CastSpellsModifiers.AddOrUpdate(Card.Cards.BAR_541, new Modifier(-3000)); //Orbs + Bot.Log("--> [AGGRO MAGE PROFILE] LETHAL WITH ONLY BURN! Aggro Modifier: 999 || Cast Spell Modifier: -3000");} + + if(AvailableMana<=TotalBurnCost + &&TotalBurn<=(board.HeroEnemy.CurrentHealth + board.HeroEnemy.CurrentArmor)){ + //Bot.Log("--> [AGGRO MAGE PROFILE] No Lethal with only Burn."); + } + + Bot.Log("--> [AGGRO MAGE PROFILE] Current Spell Damage: "+SpellDamage); + Bot.Log("--> [AGGRO MAGE PROFILE] Current Damage from Hand: "+TotalBurn); + Bot.Log("--> [AGGRO MAGE PROFILE] Current Cost of Damage from Hand: "+TotalBurnCost); +#endregion + +#region Astalor Damage Calculation +int AstalorDamage = 8; +if(board.MaxMana>9){AstalorDamage=16;} +if(AstalorDamage>=enemyMinionHealth+board.HeroEnemy.CurrentHealth+board.HeroEnemy.CurrentArmor +&&NoObjection==0 +&&NoOkani<1) +{p.CastMinionsModifiers.AddOrUpdate(Card.Cards.RLK_222t2, new Modifier(-9999)); + p.PlayOrderModifiers.AddOrUpdate(Card.Cards.RLK_222t2, new Modifier(9999)); + Bot.Log("--> [AGGRO MAGE PROFILE] LETHAL WITH ASTALOR!"); + } + +//>=enemyMinionHealth+board.HeroEnemy.CurrentHealth+board.HeroEnemy.CurrentArmor #endregion #region The Coin GAME_005 -if( - board.HasCardInHand(Card.Cards.GAME_005) - ){ - p.CastSpellsModifiers.AddOrUpdate(Card.Cards.GAME_005, new Modifier(-50)); -} + if( board.HasCardInHand(Card.Cards.GAME_005) &&board.SecretEnemyCount > 0 @@ -248,6 +354,7 @@ if( if( board.HasCardInHand(Card.Cards.REV_601) &&board.ManaAvailable>1 + &&LethalWithSpells==0 ){ p.CastSpellsModifiers.AddOrUpdate(Card.Cards.REV_601, new Modifier(999)); Bot.Log("--> [CARD IN HAND] Frozen Touch (INACTIVE). Castmodifier: 999"); @@ -255,6 +362,7 @@ if( if( board.HasCardInHand(Card.Cards.REV_601t) &&board.ManaAvailable>1 + &&LethalWithSpells==0 ){ p.CastSpellsModifiers.AddOrUpdate(Card.Cards.REV_601t, new Modifier(-100)); p.PlayOrderModifiers.AddOrUpdate(Card.Cards.REV_601t, new Modifier(700)); @@ -295,17 +403,19 @@ if( board.HasCardInHand(Card.Cards.RLK_843) &&board.MaxMana<8 &&board.ManaAvailable>0 + &&LethalWithSpells==0 ){ - p.CastSpellsModifiers.AddOrUpdate(Card.Cards.RLK_843, new Modifier(350)); - Bot.Log("--> [CARD IN HAND] Arcane Bolt (INACTIVE). Castmodifier: 350"); + p.CastSpellsModifiers.AddOrUpdate(Card.Cards.RLK_843, new Modifier(999)); + Bot.Log("--> [CARD IN HAND] Arcane Bolt (INACTIVE). Castmodifier: 999"); } if( board.HasCardInHand(Card.Cards.RLK_843) &&board.ManaAvailable>0 &&board.MaxMana>7 + &&LethalWithSpells==0 ){ - p.CastSpellsModifiers.AddOrUpdate(Card.Cards.RLK_843, new Modifier(-100)); - Bot.Log("--> [CARD IN HAND] Arcane Bolt (ACTIVE). Castmodifier: -50"); + p.CastSpellsModifiers.AddOrUpdate(Card.Cards.RLK_843, new Modifier(100)); + Bot.Log("--> [CARD IN HAND] Arcane Bolt (ACTIVE). Castmodifier: 100"); } #endregion @@ -444,8 +554,9 @@ if( board.HasCardInHand(Card.Cards.AV_115) &&board.ManaAvailable>1 ){ - p.CastMinionsModifiers.AddOrUpdate(Card.Cards.WC_805, new Modifier(-100)); - Bot.Log("--> [CARD IN HAND] Amplified Snowflurry. Castmodifier: -100"); + p.PlayOrderModifiers.AddOrUpdate(Card.Cards.AV_115, new Modifier(950)); + p.CastMinionsModifiers.AddOrUpdate(Card.Cards.AV_115, new Modifier(-100)); + Bot.Log("--> [CARD IN HAND] Amplified Snowflurry. Castmodifier: -100 || Ordermodifier 950"); } #endregion @@ -454,16 +565,11 @@ if( board.HasCardInHand(Card.Cards.RLK_542) &&board.ManaAvailable>2 ){ - p.CastMinionsModifiers.AddOrUpdate(Card.Cards.RLK_542, new Modifier(-100)); + p.CastMinionsModifiers.AddOrUpdate(Card.Cards.RLK_542, new Modifier(-300)); - Bot.Log("--> [CARD IN HAND] Arcsplitter. Castmodifier: -100"); + Bot.Log("--> [CARD IN HAND] Arcsplitter. Castmodifier: -300"); } - if(board.HasCardOnBoard(Card.Cards.RLK_542) - ) - { - p.OnBoardFriendlyMinionsValuesModifiers.AddOrUpdate(Card.Cards.RLK_542, new Modifier(-250)); - Bot.Log("--> [AGGRO MAGE PROFILE] Arcsplitter Valuemodifier: -250"); - } + #endregion #region Cold Case REV_505 @@ -498,7 +604,7 @@ if( } #endregion -#region Nerubian Vizier RLK_834 +/*#region Nerubian Vizier RLK_834 int UndeadOnBoard=board.MinionFriend.Count(card => card.Race == Card.CRace.UNDEAD); //Skeleton REV_845 //p.OnBoardFriendlyMinionsValuesModifiers.AddOrUpdate(Card.Cards.AV_137, new Modifier(250)); @@ -524,7 +630,54 @@ else if( //Bot.Log("--> [AGGRO MAGE PROFILE] When playing Nerubian Vizier, Ordermodifier: 890"); } #endregion +*/ + #region Nerubian Vizer RLK_834 + //*** Added by EE *** + string subKey = @"Software\DKProfile"; //Create subKey in registries + Debug.OnLogReceived += OnLog; //Read SB log files + int NerubianVizierCost = board.Hand.FindAll(x => x.Template.Id == Card.Cards.RLK_834).Sum(x => x.CurrentCost); //Get current cost Nerubian Vizier + bool CorpseIncrease = Bot.CurrentBoard.FriendGraveyard.Count > NumberFromRegistry("CorpseCount", subKey); //True/False increase corpse count? + Bot.Log("--> [NERUBIAN VIZIER FIX]\r\n\t --> Graveyard count increased? T/F " + CorpseIncrease); + + if (board.HasCardInHand(Card.Cards.RLK_834) && board.ManaAvailable >= NerubianVizierCost) //Is Nerubian Vizier in hand and mana available + { + if (CorpseIncrease) + { + for (int i = NumberFromRegistry("CorpseCount", subKey); i < Bot.CurrentBoard.FriendGraveyard.Count; i++) //FriendGraveyard list, index from --> to + { + Bot.Log("--> [NERUBIAN VIZIER FIX] Cards in Graveyard: " + CardTemplate.LoadFromId(board.FriendGraveyard[i]).Name); + foreach (var cardUndead in _undeadTable) + { + if (CardTemplate.LoadFromId(board.FriendGraveyard[i]).Id == cardUndead) //Search graveyard for any undead in list + { + p.CastMinionsModifiers.AddOrUpdate(Card.Cards.RLK_834, new Modifier(-110)); //Higher chance to play Nerubian Vizier + p.PlayOrderModifiers.AddOrUpdate(Card.Cards.CS3_001, new Modifier(890)); + Bot.Log("--> [NERUBIAN VIZIER FIX] Undead Match: " + CardTemplate.LoadFromId(board.FriendGraveyard[i]).Name); + Bot.Log("--> [CARD IN HAND] Nerubian Vizier. Castmodifier: -100 || Ordermodifier: 890"); + break; + } + } + } + } + else + { + p.CastMinionsModifiers.AddOrUpdate(Card.Cards.RLK_834, new Modifier(9000)); //Chance not to play Nerubian Vizier + Bot.Log("--> [CARD IN HAND] Nerubian Vizier. Castmodifier: 9000"); + } + } + //if ( + // board.HasCardInHand(Card.Cards.RLK_834) + // && board.ManaAvailable > 2 + // ) + // { + // p.CastMinionsModifiers.AddOrUpdate(Card.Cards.RLK_834, new Modifier(-110)); + // p.PlayOrderModifiers.AddOrUpdate(Card.Cards.CS3_001, new Modifier(890)); + // Bot.Log("--> [CARD IN HAND] Nerubian Vizier. Castmodifier: -100 || Ordermodifier: 890"); + // //Bot.Log("--> [AGGRO MAGE PROFILE] When playing Nerubian Vizier, Ordermodifier: 890"); + // } + //*** end by EE *** + #endregion #region Crooked Cook REV_016 if(board.HasCardInHand(Card.Cards.REV_016) &&myAttack>2 @@ -755,6 +908,14 @@ if( } #endregion +#region Objection! MAW_006 + if(board.HasCardInHand(Card.Cards.MAW_006) + ){ + p.CastSpellsModifiers.AddOrUpdate(Card.Cards.MAW_006, new Modifier(-150)); + Bot.Log("--> [CARD IN HAND] Objection!. Castmodifier: -150"); + } +#endregion + #region Tradevalue Modifiers Enemy Minions //just ignore it. basically gives all the listed minions a certain value as in how likely the bot is to kill it off. //Like "more dangerous" minions on the other side of the field). Higher Number = more important to kill @@ -1320,6 +1481,29 @@ if( #endregion return p; }} + //*** Added by EE *** + //Read SB log string + private void OnLog(string str) //Read SB log files + { + string subKey = @"Software\DKProfile"; //Create subKey in registries + if (str.Contains("End Turn")) //On end turn + { + NumberIntoRegistry("CorpseCount", Bot.CurrentBoard.FriendGraveyard.Count, subKey); //Record current FriendGraveyard Count into registries at end of turn + } + } + + // Reading and Writing to windows registry + static void NumberIntoRegistry(string keyName, int value, string subKey) + { + RegistryKey sk = Registry.CurrentUser.CreateSubKey(subKey); + sk.SetValue(keyName, value); + } + static int NumberFromRegistry(string keyName, string subKey) + { + RegistryKey sk = Registry.CurrentUser.OpenSubKey(subKey); + if (sk == null) return 0; else return Convert.ToInt32(sk.GetValue(keyName).ToString()); + } + //*** end by EE *** public Card.Cards SirFinleyChoice(List choices) { var filteredTable = _heroPowersPriorityTable.Where(x => choices.Contains(x.Key)).ToList(); -- Gitee