|
You last visited: Today at 12:59
Advertisement
HREngine - Hearthstone Bot by MMOCrawlerbots.com
Discussion on HREngine - Hearthstone Bot by MMOCrawlerbots.com within the Hearthstone forum part of the Other Online Games category.
03/28/2014, 18:12
|
#16
|
elite*gold: 240
Join Date: Dec 2006
Posts: 1,579
Received Thanks: 1,609
|
Every staff member is working hard to release it as fast as possible. But, tonight seems legit.
|
|
|
03/28/2014, 18:16
|
#17
|
elite*gold: 40
Join Date: Mar 2011
Posts: 6,571
Received Thanks: 1,866
|
Quote:
Originally Posted by Bl@ze!
There is one class at this moment which will be released. This class is called "General" and supports nearly everything including hero power. (except warlock, for now)
I use this as a priest and mage - and this very successful. It supports minions, minions with battle cry, taunts, spells with attack against the enemy.
This class especially can do the following:
- Kill enemy with all required cards (hand, battlefield etc.) if possible
- Kill minions with 1 shot if possible
- Kill enemy minions with taunt ability
- Kill enemy minions with multiple of my minions
- Kill the enemy himself
But - with a custom class nearly everything is possible. An API documentation is coming, soon. (Reflecting the API of HREngine.dll will show you most things in your favorite IDE, but an documentation is also in work)
This class is simple - have a look at it:
Code:
using HREngine.API;
using HREngine.API.Utilities;
using System;
using System.Collections.Generic;
namespace HREngine.Bots
{
internal class PossibleTurnAttack
{
public int Cost;
public int Attack;
public int NeededAttack;
public List<HRCard> Cards;
}
/// <summary>
/// [EN]
/// This Bot implements a simple AI to fight against enemies.
/// Features:
/// - Attacking Taunts
/// - Spawn Taunts
/// - Attack Hero if available.
///
/// [DE]
/// Dieser Bot implementiert eine einfache KI um gegen Gegner
/// zu kämpfen.
/// Funktionen:
/// - Kämpfe gegen Gegner mit Spott
/// - Lege Karten mit Spott
/// - Kämpfe gegen Held
/// </summary>
public class Bot : API.IBot
{
/// <summary>
/// [EN]
/// Initializes a new instance of the <see cref="Bot"/> class.
///
/// [DE]
/// Initialisiert eine neue Instanz dieses Bots.
/// </summary>
public Bot()
{
// [EN]
// Setting required event handler to implement bot logic.
OnBattleLocalPlayerTurn = HandleBattleLocalPlayerTurnHandler;
}
private PossibleTurnAttack GetPossibleTurnAttack(int NeededAttackPower, int MaxCards = -1)
{
PossibleTurnAttack result = new PossibleTurnAttack();
result.NeededAttack = NeededAttackPower;
result.Cards = new List<HRCard>();
try
{
var p = HRPlayer.GetLocalPlayer();
// Loop through all minions that can attack...
List<HRCard> playerBattleField = HRCard.GetCards(HRPlayer.GetLocalPlayer(), HRCardZone.PLAY);
foreach (var card in playerBattleField)
{
if (HRBattle.CanUseCard(card.GetEntity()))
{
if (MaxCards == -1)
{
result.Attack += card.GetEntity().GetATK();
result.Cards.Add(card);
}
else
{
if (result.Cards.Count + 1 == MaxCards)
{
if (result.Attack + card.GetEntity().GetATK() >= NeededAttackPower)
{
result.Attack += card.GetEntity().GetATK();
result.Cards.Add(card);
}
}
else
{
result.Attack += card.GetEntity().GetATK();
result.Cards.Add(card);
}
}
if (result.Attack >= result.NeededAttack || result.Cards.Count == MaxCards)
break;
}
}
if (result.Attack < result.NeededAttack)
{
// Try with hero power?
if (p.GetHeroPower().GetCost() <= p.GetNumAvailableResources())
{
if (p.GetHeroPower().GetATK() > 0)
{
result.Attack += p.GetHeroPower().GetATK();
result.Cost += p.GetHeroPower().GetCost();
result.Cards.Add(p.GetHeroCard());
}
}
// Try with remaining cards..
if (result.Attack < result.NeededAttack)
{
List<HRCard> playerHandField = HRCard.GetCards(p, HRCardZone.HAND);
foreach (var card in playerBattleField)
{
int leftResources = p.GetNumAvailableResources() - result.Cost;
if (card.GetEntity().IsSpell() && card.GetEntity().GetATK() > 0)
{
if (card.GetEntity().GetCost() <= leftResources)
{
result.Attack += card.GetEntity().GetATK();
result.Cost += card.GetEntity().GetCost();
result.Cards.Add(card);
}
}
else if (card.GetEntity().IsMinion() && card.GetEntity().GetATK() > 0)
{
if (card.GetEntity().HasBattlecry())
{
if (card.GetEntity().GetCost() <= leftResources)
{
result.Attack += card.GetEntity().GetATK();
result.Cost += card.GetEntity().GetCost();
result.Cards.Add(card);
}
}
}
if (result.Attack >= result.NeededAttack)
break;
}
}
}
}
catch (Exception)
{
HRLog.Write("GetPossibleTurnAttack caused an exception");
throw;
}
return result;
}
/// <summary>
/// [EN]
/// This handler is executed when the local player turn is active.
///
/// [DE]
/// Dieses Event wird ausgelöst wenn der Spieler am Zug ist.
/// </summary>
private void HandleBattleLocalPlayerTurnHandler()
{
try
{
SafeHandleBattleLocalPlayerTurnHandler();
}
catch (Exception Exception)
{
HRLog.Write(Exception.Message);
HRLog.Write(Environment.StackTrace);
}
HRBattle.FinishRound();
}
private void SafeHandleBattleLocalPlayerTurnHandler()
{
bool didHeroPower = false;
// PRIEST: Heal if Health < 18
if (HRPlayer.GetLocalPlayer().GetRemainingHP() < 18 &&
HRPlayer.GetLocalPlayer().GetClass() == HRClass.PRIEST)
{
try
{
TryHeroPower();
}
catch (Exception)
{
HRLog.Write("TryHeroPower caused an exception");
throw;
}
didHeroPower = true;
}
try
{
TryPossibleWin();
}
catch (Exception)
{
HRLog.Write("TryPossibleWin caused an exception.");
throw;
}
try
{
TrySpawnBattleCry();
}
catch (Exception)
{
HRLog.Write("TrySpawnBattleCry caused an exception.");
}
try
{
TrySpawnRest();
}
catch (Exception)
{
HRLog.Write("TrySpawnRest caused an exception");
throw;
}
try
{
TryPossibleOneShots();
}
catch (Exception)
{
HRLog.Write("TryPossibleOneShots caused an exception.");
throw;
}
// TryFight
try
{
TryFight();
}
catch (Exception)
{
HRLog.Write("TryFight caused an exception");
throw;
}
if (!didHeroPower)
{
try
{
TryHeroPower();
}
catch (Exception)
{
HRLog.Write("TryHeroPower caused an exception");
throw;
}
}
}
private void TryHeroPower()
{
var nextMinion = GetNextMinion(new List<int>());
if (nextMinion == null)
nextMinion = HRPlayer.GetEnemyPlayer().GetHero().GetCard();
HRBattle.UseHeroPower(nextMinion.GetEntity());
}
private void TrySpawnRest()
{
var p = HRPlayer.GetLocalPlayer();
List<HRCard> hand = HRCard.GetCards(p, HRCardZone.HAND);
foreach (var card in hand)
{
if (card.GetEntity().IsMinion() || card.GetEntity().IsSpell())
{
if (HRBattle.CanPlayCard(card.GetEntity()))
{
if (!HRBattle.Push(card))
HRLog.Write(String.Format("Pushing card failed with card {0}", card.GetEntity().GetName()));
else
{
if (HRBattle.IsInTargetMode())
{
var nextMinion = GetNextMinion(new List<int>());
if (nextMinion != null)
HRBattle.Target(nextMinion.GetEntity());
else
HRBattle.Target(HRPlayer.GetEnemyPlayer().GetHero());
}
}
}
}
else
{
HRLog.Write(
String.Format("Card ({0}) is not a minion or spell and cannot be used.",
card.GetEntity().GetName()));
}
}
}
private void TrySpawnBattleCry()
{
var p = HRPlayer.GetLocalPlayer();
List<HRCard> hand = HRCard.GetCards(p, HRCardZone.HAND);
foreach (var card in hand)
{
if (card.GetEntity().HasBattlecry() && HRBattle.CanUseCard(card.GetEntity()))
{
if (!HRBattle.Push(card))
HRLog.Write(String.Format("Pushing battlecry card failed with card {0}", card.GetEntity().GetName()));
}
}
}
private void TryFight()
{
List<int> lsCheckedEntities = new List<int>();
HRCard nextMinion = null;
using (var imp = new HRDeadlockBypass("TryFight"))
{
do
{
nextMinion = GetNextMinion(lsCheckedEntities);
if (nextMinion != null)
{
var possibleAttack = GetPossibleTurnAttack(nextMinion.GetEntity().GetRemainingHP());
if (possibleAttack.Attack >= nextMinion.GetEntity().GetRemainingHP() &&
possibleAttack.Cost <= HRPlayer.GetLocalPlayer().GetNumAvailableResources() &&
possibleAttack.Cards.Count > 0)
{
HRLog.Write(String.Format("Fighting with {0}", nextMinion.GetEntity().GetName()));
PerformAttackFromPossibleTurnAttack(possibleAttack, nextMinion.GetEntity());
}
lsCheckedEntities.Add(nextMinion.GetEntity().GetEntityId());
}
if (imp.HasDeadlock && nextMinion != null)
{
HRLog.Write(String.Format("Deadlock occured with entity {0} and ID {1}",
nextMinion.GetEntity().GetName(),
nextMinion.GetEntity().GetEntityId()));
}
} while (!imp.HasDeadlock && nextMinion != null);
}
// Try to attack his hero...?
var e = HRPlayer.GetEnemyPlayer();
if (!e.HasATauntMinion())
{
var possibleAttack = GetPossibleTurnAttack(e.GetHero().GetRemainingHP());
if (possibleAttack.Cost <= HRPlayer.GetLocalPlayer().GetNumAvailableResources())
{
PerformAttackFromPossibleTurnAttack(possibleAttack, e.GetHero());
}
}
}
private void TryPossibleWin()
{
var e = HRPlayer.GetEnemyPlayer();
if (e.HasATauntMinion() || !e.GetHeroCard().GetEntity().CanBeAttacked())
return;
var p = HRPlayer.GetLocalPlayer();
PossibleTurnAttack possiblePower = GetPossibleTurnAttack(e.GetHero().GetRemainingHP());
if (possiblePower.Attack >= e.GetHero().GetRemainingHP() && possiblePower.Cost <= p.GetNumAvailableResources())
{
HRLog.Write(String.Format("Prepare next win, killing {0}", e.GetHero().GetName()));
PerformAttackFromPossibleTurnAttack(possiblePower, e.GetHero());
}
}
private void PerformAttackFromPossibleTurnAttack(PossibleTurnAttack possiblePower, HREntity entity)
{
if (entity == null)
return;
if (!entity.CanBeAttacked())
{
HRLog.Write(String.Format("Entity {0} cannot be attacked", entity.GetName()));
return;
}
if (possiblePower.Cards == null)
return;
foreach (var item in possiblePower.Cards)
{
if (item.GetEntity().IsHero())
HRBattle.UseHeroPower(entity);
else
{
HRCardZone zone = item.GetEntity().GetZone();
switch (zone)
{
case HRCardZone.PLAY:
HRBattle.Attack(item.GetEntity(), entity);
break;
case HRCardZone.HAND:
if (item.GetEntity().IsMinion() && item.GetEntity().HasBattlecry())
{
HRBattle.Push(item);
HRBattle.Attack(item.GetEntity(), entity);
}
else if (item.GetEntity().IsSpell())
{
HRBattle.Push(item);
if (HRBattle.IsInTargetMode())
HRBattle.Target(entity);
}
break;
default:
break;
}
}
}
}
private void TryPossibleOneShots()
{
List<int> lsCheckedEntities = new List<int>();
HRCard nextMinion = null;
using (var imp = new HRDeadlockBypass("TryPossibleOneShots"))
{
do
{
nextMinion = GetNextMinion(lsCheckedEntities);
if (nextMinion != null)
{
var possibleAttack = GetPossibleTurnAttack(nextMinion.GetEntity().GetRemainingHP(), 1);
if (possibleAttack.Attack >= nextMinion.GetEntity().GetRemainingHP() &&
possibleAttack.Cost <= HRPlayer.GetLocalPlayer().GetNumAvailableResources() && possibleAttack.Cards.Count == 1)
{
HRLog.Write(String.Format("Perform 1 Hit to {0}", nextMinion.GetEntity().GetName()));
PerformAttackFromPossibleTurnAttack(possibleAttack, nextMinion.GetEntity());
}
lsCheckedEntities.Add(nextMinion.GetEntity().GetEntityId());
}
if (imp.HasDeadlock && nextMinion != null)
{
HRLog.Write(String.Format("Deadlock occured with entity {0} and ID {1}",
nextMinion.GetEntity().GetName(),
nextMinion.GetEntity().GetEntityId()));
}
} while (!imp.HasDeadlock && nextMinion != null);
}
}
private HRCard GetNextMinion(List<int> lsCheckedEntities)
{
HRCard nextMinion = null;
var e = HRPlayer.GetEnemyPlayer();
List<HRCard> battleField = HRCard.GetCards(e, HRCardZone.PLAY);
foreach (var card in battleField)
{
if (lsCheckedEntities.Contains(card.GetEntity().GetEntityId()))
continue;
if (card.GetEntity().CanBeAttacked())
{
if (nextMinion == null)
{
if (!e.HasATauntMinion() || card.GetEntity().HasTaunt())
nextMinion = card;
}
else
{
if (card.GetEntity().GetRemainingHP() < nextMinion.GetEntity().GetRemainingHP())
{
if (!e.HasATauntMinion() || card.GetEntity().HasTaunt())
nextMinion = card;
}
else if (card.GetEntity().GetRemainingHP() == nextMinion.GetEntity().GetRemainingHP())
{
// kill minions with higher attack first
if (card.GetEntity().GetATK() > nextMinion.GetEntity().GetATK())
{
if (!e.HasATauntMinion() || card.GetEntity().HasTaunt())
nextMinion = card;
}
}
}
}
}
return nextMinion;
}
}
}
|
Seems nice.
What's your problem with the Warlock Ability?
And could you tell us the priorities (using card's / attacking) of the general class?
|
|
|
03/28/2014, 18:37
|
#18
|
elite*gold: 240
Join Date: Dec 2006
Posts: 1,579
Received Thanks: 1,609
|
Quote:
Originally Posted by javasova
Seems nice.
What's your problem with the Warlock Ability?
And could you tell us the priorities (using card's / attacking) of the general class?
|
Warlock ability will be implemented before it is released. So, don't care about that point.
Priority is easy:
- TryPossibleWin (do we have something to win the fight, yes then use it)
- TrySpawnBattleCry (do we have minions with battlecry, yes then use it)
- TrySpawnRest (everything else that is on hand)
- TryPossibleOneShots (can we kill minions just with 1 card of ours, and without dying ourself?)
- TryFight (can we attack his hero, or any other minion (taunt) )
- TryHeroPower (can we do damage with our hero)
This is for the general class. The logic of these functions is also implemented in the general class.
Edit: Hero Power from Warlock supported now. Can be used in custom classes.
|
|
|
03/28/2014, 19:43
|
#19
|
elite*gold: 128
Join Date: Sep 2007
Posts: 1,495
Received Thanks: 109
|
nice one still can't wait to get my hands on it ... hope you don't have problems with the injection
|
|
|
03/28/2014, 20:22
|
#20
|
elite*gold: 0
Join Date: Dec 2013
Posts: 222
Received Thanks: 12
|
I'm happy about this realease and looking forward to buy this bot
|
|
|
03/28/2014, 20:46
|
#21
|
elite*gold: 240
Join Date: Dec 2006
Posts: 1,579
Received Thanks: 1,609
|
Quote:
Originally Posted by smirk
nice one still can't wait to get my hands on it ... hope you don't have problems with the injection
|
The injection works. It is not the best injection method - and we are working on an on the fly memory injection which works in our alpha testing stage but for this release another injection method is used which also works easy. The bot explains what to do..
# Download available - Happy Botting !
|
|
|
03/29/2014, 00:47
|
#22
|
elite*gold: 0
Join Date: Apr 2008
Posts: 6
Received Thanks: 0
|
Not work on xp because net. framework 4.5 =/
|
|
|
03/29/2014, 00:51
|
#23
|
elite*gold: 240
Join Date: Dec 2006
Posts: 1,579
Received Thanks: 1,609
|
You need Framework 4.0 and this works for me on XP SP3
|
|
|
03/29/2014, 00:57
|
#24
|
elite*gold: 0
Join Date: Apr 2008
Posts: 6
Received Thanks: 0
|
x64 sp1 here
|
|
|
03/29/2014, 00:58
|
#25
|
elite*gold: 240
Join Date: Dec 2006
Posts: 1,579
Received Thanks: 1,609
|
Ah okay, I cannot confirm that this would work. Could you upgrade to SP 3?
|
|
|
03/29/2014, 01:02
|
#26
|
elite*gold: 0
Join Date: Apr 2008
Posts: 6
Received Thanks: 0
|
i go update to windows 7. thx for help!
|
|
|
03/29/2014, 01:03
|
#27
|
elite*gold: 240
Join Date: Dec 2006
Posts: 1,579
Received Thanks: 1,609
|
No Problem, have fun with Bot when you've upgraded to Windows 7. Hope you win a lot of games
|
|
|
03/29/2014, 02:05
|
#28
|
elite*gold: 0
Join Date: Dec 2013
Posts: 222
Received Thanks: 12
|
testing it now  will give you a nice feedback.
#not replacing any cards at the start
#good logics for trading with enemy monsters
#using pyroblast instead of fireball for killing minion with 3 life
#no logics like many wyrm before spell
|
|
|
03/29/2014, 02:25
|
#29
|
elite*gold: 0
Join Date: Jul 2010
Posts: 2
Received Thanks: 0
|
tested a random hunter deck, doesnt use weapon :/
will test more and report.
|
|
|
03/29/2014, 04:07
|
#30
|
elite*gold: 0
Join Date: Mar 2014
Posts: 11
Received Thanks: 0
|
Testing it out right now.
EDIT: Bot looked and felt great. I hope there would be a lifetime subscription to the bot when it is released.
|
|
|
 |
|
Similar Threads
|
Fishing, Gathering, Leveling Bot MMOCrawlerbots.com
11/10/2014 - WoW Bots - 392 Replies
Warcrawler - Your bot for World of Warcraft
» Features:
Grinding, Leveling, Questing, Archaeology, Fishing, Pool Fishing, Gathering
» How does it work?
The Bot is easy to use. Follow these steps and you are ready to use the Bot:
Download Bot and extract/install it to any location
Start Crawlerbots.exe
|
*BETA* auto gathering by MMoCrawlerbots.com
01/24/2014 - WoW Bots - 10 Replies
http://mmocrawlerbots.com/pics/Christmas-2007-A.jp g
Dear Users,
this was a very exciting year, and we want to say thank you for all your proposals, discussions, profiles and of course bug reports. The Bot is running pretty stable and only a few errors are left, and that is a great thing! Now we have time left to implement new great features which will make the bot way more awesome.
One of these great features is our Christmas gift for you: We decided to start the Open Beta for the...
|
24 Stunden Trial Key für MMOCrawlerbots FREE
09/04/2013 - WoW Bots - 1 Replies
Um den Crawlerbot zu testen, bieten wir einen Trial Key für die Leute von ePvp an.
Einfach hier registrieren (wenn ihr noch keinen Account habt): Registration
Und danach auf dieser Seite Trialsetup
den Trial Key eintragen, um die 24 Stunden gratis Zeit zu nutzen.
Trial Key: epvp
|
All times are GMT +1. The time now is 12:59.
|
|