forked from noHero123/HRCustomClasses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBoardControl.cs
160 lines (133 loc) · 5.76 KB
/
BoardControl.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
using HREngine.API;
using HREngine.API.Utilities;
using HREngine.Bots;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace HREngine.Bots
{
public class BoardControli : Bot
{
PenalityManager penman = PenalityManager.Instance;
protected override API.HRCard GetMinionByPriority(HRCard lastMinion)
{
var result = HRBattle.GetNextMinionByPriority(MinionPriority.LowestHealth);
if (result != null && (lastMinion == null || lastMinion != null && lastMinion.GetEntity().GetCardId() != result.GetCardId()))
return result.GetCard();
return null;
}
protected override int evaluatePlayfield(Playfield p)
{
if (p.value >= -2000000) return p.value;
int retval = 0;
retval -= p.evaluatePenality;
retval += p.owncards.Count * 1;
retval += p.ownMaxMana;
retval -= p.enemyMaxMana;
retval += p.ownMinions.Count * 10;
retval -= p.enemyMinions.Count * 10;
if (p.ownHeroHp + p.ownHeroDefence > 10)
{
retval += p.ownHeroHp + p.ownHeroDefence;
}
else
{
retval -= (11 - p.ownHeroHp - p.ownHeroDefence) * (11 - p.ownHeroHp - p.ownHeroDefence);
}
retval += -p.enemyHeroHp - p.enemyHeroDefence;
retval += p.ownWeaponAttack * p.ownWeaponDurability;
if (!p.enemyHeroFrozen)
{
retval -= p.enemyWeaponDurability*p.enemyWeaponAttack;
}
else
{
if (p.enemyWeaponDurability>=1)
{
retval += 12;
}
}
retval += p.owncarddraw * 5;
retval -= p.enemycarddraw * 5;
retval += p.ownMaxMana;
int owntaunt = 0;
int ownMinionsCount = 0;
foreach (Minion m in p.ownMinions)
{
retval += m.Hp * 1;
retval += m.Angr * 2;
retval += m.handcard.card.rarity;
if (m.windfury) retval += m.Angr;
if (m.divineshild) retval += 1;
if (m.stealth) retval += 1;
//if (m.poisonous) retval += 1;
if (m.divineshild && m.taunt) retval += 4;
if (m.taunt && m.handcard.card.specialMin == CardDB.specialMinions.frog) owntaunt++;
if (m.Angr > 1 || m.Hp > 1) ownMinionsCount++;
}
if (p.enemyMinions.Count >= 0)
{
int anz = p.enemyMinions.Count;
if (owntaunt == 0) retval -= 10 * anz;
retval += owntaunt * 10 - 11 * anz;
}
int playmobs = 0;
foreach (Action a in p.playactions)
{
if (a.useability && a.handcard.card.name == "lesserheal" && ((a.enemytarget >= 10 && a.enemytarget <= 20) || a.enemytarget == 200)) retval -= 5;
if (!a.cardplay) continue;
if (a.handcard.card.type == CardDB.cardtype.MOB) playmobs++;
//if (a.handcard.card.name == "arcanemissiles" && a.numEnemysBeforePlayed == 0) retval -= 10; // arkane missles on enemy hero is bad :D
if (a.handcard.card.name == "flamestrike" && a.numEnemysBeforePlayed <= 2) retval -= 20;
//save spell for all classes: (except for rouge if he has no combo)
if (p.ownHeroName != "thief" && a.handcard.card.type == CardDB.cardtype.SPELL && (a.numEnemysBeforePlayed == 0 || a.enemytarget == 200) && a.handcard.card.name != "shieldblock") retval -= 11;
if (p.ownHeroName == "thief" && a.handcard.card.type == CardDB.cardtype.SPELL && (a.enemytarget == 200)) retval -= 11;
}
int mobsInHand = 0;
foreach (Handmanager.Handcard hc in p.owncards)
{
if (hc.card.type == CardDB.cardtype.MOB) mobsInHand++;
}
if (ownMinionsCount - p.enemyMinions.Count >= 4 && mobsInHand >= 1)
{
retval += mobsInHand * 20;
}
foreach (Minion m in p.enemyMinions)
{
retval -= m.Hp*2;
if (!m.frozen)
{
retval -= m.Angr * 2;
if (m.windfury) retval -= m.Angr;
}
retval -= m.handcard.card.rarity;
if (m.taunt) retval -= 5;
if (m.divineshild) retval -= 1;
if (m.stealth) retval -= 1;
if (m.poisonous) retval -= 4;
if (penman.priorityTargets.ContainsKey(m.name) && !m.silenced) retval -= penman.priorityTargets[m.name];
if (m.Angr >= 4) retval -= 20;
if (m.Angr >= 7) retval -= 50;
}
retval -= p.enemySecretCount;
retval -= p.lostDamage;//damage which was to high (like killing a 2/1 with an 3/3 -> => lostdamage =2
retval -= p.lostWeaponDamage;
if (p.ownMinions.Count == 0) retval -= 20;
if (p.enemyMinions.Count == 0) retval += 20;
if (p.enemyHeroHp <= 0) retval = 10000;
//soulfire etc
int deletecardsAtLast = 0;
foreach (Action a in p.playactions)
{
if (!a.cardplay) continue;
if (a.handcard.card.name == "soulfire" || a.handcard.card.name == "doomguard" || a.handcard.card.name == "succubus") deletecardsAtLast = 1;
if (deletecardsAtLast == 1 && !(a.handcard.card.name == "soulfire" || a.handcard.card.name == "doomguard" || a.handcard.card.name == "succubus")) retval -= 20;
}
if (p.enemyHeroHp >=1 && p.ownHeroHp + p.ownHeroDefence - p.guessingHeroDamage <= 0) retval -= 1000;
if (p.ownHeroHp <= 0) retval = -10000;
p.value = retval;
return retval;
}
}
}