• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Goblin Blastmage battlecry help!

    Discussion in 'Hearthbuddy Support' started by matter, Jan 30, 2015.

    1. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      hello i need help to change Goblin Blastmage so it only uses it if i have an mech on the table.
      because countless times it just uses it without mech -.-
      i have found a code but dont know if it is right one to edit but i show anyway.
      Code:
      using System;
      using System.Collections.Generic;
      using System.Text;
      
      namespace HREngine.Bots
      {
          class Sim_GVG_004 : SimTemplate //Goblin Blastmage
          {
      
              //    Battlecry: If you have a Mech, deal 4 damage randomly split among all enemies.
      
              public override void  getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
              {
                  // optimistic
                  bool ownplay = own.own;
                  List<Minion> temp1 = (ownplay) ? p.ownMinions : p.enemyMinions;
                  bool haveAMech = true;
                  foreach (Minion m in temp1)
                  {
                      if ((TAG_RACE)m.handcard.card.race == TAG_RACE.MECHANICAL) haveAMech = false;
                  }
                  if (!haveAMech) return;
      
                  int i = 0;
                  List<Minion> temp = (ownplay) ? p.enemyMinions : p.ownMinions;
                  int times = (ownplay) ? p.getSpellDamageDamage(4) : p.getEnemySpellDamageDamage(4);
      
                  if ((ownplay && p.enemyHero.Hp <= times) || (!ownplay && p.ownHero.Hp <= times))
                  {
                      if (ownplay) p.minionGetDamageOrHeal(p.enemyHero, p.enemyHero.Hp - 1);
                      else p.minionGetDamageOrHeal(p.ownHero, p.ownHero.Hp - 1);
                  }
                  else
                  {
                      while (i < times)
                      {
                          if (temp.Count >= 1)
                          {
                              //search Minion with lowest hp
                              Minion enemy = temp[0];
                              int minhp = 10000;
                              bool found = false;
                              foreach (Minion m in temp)
                              {
                                  if (m.name == CardDB.cardName.nerubianegg && enemy.Hp >= 2) continue; //dont attack nerubianegg!
      
                                  if (m.Hp >= 2 && minhp > m.Hp)
                                  {
                                      enemy = m;
                                      minhp = m.Hp;
                                      found = true;
                                  }
                              }
      
                              if (found)
                              {
                                  p.minionGetDamageOrHeal(enemy, 1);
                              }
                              else
                              {
                                  p.minionGetDamageOrHeal(ownplay ? p.enemyHero : p.ownHero, 1);
                              }
      
                          }
                          else
                          {
                              p.minionGetDamageOrHeal(ownplay ? p.enemyHero : p.ownHero, 1);
                          }
      
                          i++;
                      }
                  }
              }
      
      
          }
      
      }
      i may have fixed it.
      test for yourself here are the files for Goblin Blastmage and Tinkertown Technician.
      View attachment Sim_GvG_102.cs
      View attachment Sim_GvG_004.cs
      put the files in Routines\DefaultRoutine\Silverfish\cards

      nvm dont work......
       
      Last edited: Jan 30, 2015
    2. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      happend again, 7mana did blastmage > Tinkertown Tech instead of Harvest golem > Blastmage.
      /clap
       
    3. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      bump
      please someone that are decent with codes just do a simple fix for this. only use if mech on board.
       
    4. Dcrew

      Dcrew New Member

      Joined:
      Jan 24, 2015
      Messages:
      38
      Likes Received:
      0
      Trophy Points:
      0
      You contradicted and reversed the mech check boolean. (I also took the liberty of optimizing and further cleaning the code)

      Try:

      Code:
      using System;
      using System.Collections.Generic;
      using System.Text;
      
      namespace HREngine.Bots
      {
          class Sim_GVG_004 : SimTemplate //Goblin Blastmage
          {
              public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
              {
                  bool myTurn = own.own, hasMech = false;
                  List<Minion> minions = (myTurn ? p.ownMinions : p.enemyMinions);
                  foreach (Minion m in minions) if ((TAG_RACE)m.handcard.card.race == TAG_RACE.MECHANICAL) { hasMech = true; break; }
                  if (!hasMech) return;
                  minions = (myTurn ? p.enemyMinions : p.ownMinions);
                  int times = (myTurn ? p.getSpellDamageDamage(4) : p.getEnemySpellDamageDamage(4));
                  if ((myTurn && (p.enemyHero.Hp <= times)) || (!myTurn && (p.ownHero.Hp <= times)))
                  {
                      if (myTurn) p.minionGetDamageOrHeal(p.enemyHero, (p.enemyHero.Hp - 1));
                      else p.minionGetDamageOrHeal(p.ownHero, (p.ownHero.Hp - 1));
                  }
                  else
                      for (int i = 0; i < times; i++)
                          if (minions.Count >= 1)
                          {
                              Minion enemy = minions[0];
                              byte minHP = byte.MaxValue;
                              foreach (Minion m in minions)
                                  if ((m.name == CardDB.cardName.nerubianegg) && (enemy.Hp >= 2)) continue;
                                  else if ((m.Hp >= 2) && (minHP > m.Hp)) { enemy = m; minHP = (byte)m.Hp; }
                              if (minHP < byte.MaxValue) p.minionGetDamageOrHeal(enemy, 1);
                              else p.minionGetDamageOrHeal((myTurn ? p.enemyHero : p.ownHero), 1);
                          }
                          else p.minionGetDamageOrHeal((myTurn ? p.enemyHero : p.ownHero), 1);
              }
          }
      }
       
      Last edited: Jan 31, 2015
    5. Dcrew

      Dcrew New Member

      Joined:
      Jan 24, 2015
      Messages:
      38
      Likes Received:
      0
      Trophy Points:
      0
      *bump*

      Please let me know if that fixed it.
       
    6. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      i will.
       
      Last edited: Jan 31, 2015
    7. Dcrew

      Dcrew New Member

      Joined:
      Jan 24, 2015
      Messages:
      38
      Likes Received:
      0
      Trophy Points:
      0
      Updated code, got something mixed up before.
       
    8. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      ok will test
       
    9. Dcrew

      Dcrew New Member

      Joined:
      Jan 24, 2015
      Messages:
      38
      Likes Received:
      0
      Trophy Points:
      0
      Could you retry with the latest code? Sorry I just keep noticing my own errors in the code.

      Edit: Thank you
       
    10. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      will try something new till it is fixed :) so i will test :)
       
    11. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      working good so far, will test more and report.
       
    12. Dcrew

      Dcrew New Member

      Joined:
      Jan 24, 2015
      Messages:
      38
      Likes Received:
      0
      Trophy Points:
      0
      Very happy to hear, perhaps the developers can implement my code here.
       
    13. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      could you please do the same with tinkertown tech?

      Code:
      using System;
      using System.Collections.Generic;
      using System.Text;
      
      namespace HREngine.Bots
      {
          class Sim_GVG_102 : SimTemplate //Tinkertown Technician
          {
      
              // Battlecry: If you have a Mech, gain +1/+1 and add a Spare Part to your hand.  
      
              public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
              {
                  List<Minion> temp = (own.own) ? p.ownMinions : p.enemyMinions;
      
                  foreach (Minion m in temp)
                  {
                      if ((TAG_RACE)m.handcard.card.race == TAG_RACE.MECHANICAL)
                      {
                          p.minionGetBuffed(own, 1, 1);
                          p.drawACard(CardDB.cardName.armorplating, own.own, true);
                          return;
                      }
                  }
              }
      
          }
      
      }
       
    14. Dcrew

      Dcrew New Member

      Joined:
      Jan 24, 2015
      Messages:
      38
      Likes Received:
      0
      Trophy Points:
      0
      I actually don't see anything wrong with that one, but I updated it with my code:

      Code:
      using System;
      using System.Collections.Generic;
      using System.Text;
      
      namespace HREngine.Bots
      {
          class Sim_GVG_102 : SimTemplate //Tinkertown Technician
          {
              public override void getBattlecryEffect(Playfield p, Minion own, Minion target, int choice)
              {
                  bool myTurn = own.own, hasMech = false;
                  List<Minion> minions = (myTurn ? p.ownMinions : p.enemyMinions);
                  foreach (Minion m in minions) if ((TAG_RACE)m.handcard.card.race == TAG_RACE.MECHANICAL) { hasMech = true; break; }
                  if (hasMech)
                  {
                      p.minionGetBuffed(own, 1, 1);
                      p.drawACard(CardDB.cardName.armorplating, myTurn, true);
                  }
              }
          }
      }
       
    15. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      thanks man :)
       
    16. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      just did a TTT when i had no mech on board :(
      and now 3 turns later even a blastmage :(
       
      Last edited: Jan 31, 2015
    17. Dcrew

      Dcrew New Member

      Joined:
      Jan 24, 2015
      Messages:
      38
      Likes Received:
      0
      Trophy Points:
      0
      Let me know the problem with blastmage exactly, and what you want the tinkertown to do.

      Sorry, I haven't played Hearthstone that long so I'm new to everything.
       
    18. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      Tinkertown Technician - Hearthstone Cards
      Goblin Blastmage - Hearthstone Cards

      these two card should 99% of all time only be played if a mech is on the board.

      filename is "Sim_GvG_004" for goblin blastmage
      and "Sim_GvG_102" for tinkertown technician
       
    19. Dcrew

      Dcrew New Member

      Joined:
      Jan 24, 2015
      Messages:
      38
      Likes Received:
      0
      Trophy Points:
      0
      I believe my code should be working then, though I didn't write the AI, though I have looked through all of the AI code, and no disrespect intended to the developer(s) but it is terribly coded, optimized and cleaned.
       
    20. matter

      matter Member

      Joined:
      Dec 9, 2012
      Messages:
      185
      Likes Received:
      0
      Trophy Points:
      16
      so there are no fix for this? ;(
       

    Share This Page