PageRenderTime 47ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/ai/action.cs

https://github.com/revolutioncom/HRCustomClasses
C# | 7414 lines | 6158 code | 930 blank | 326 comment | 2351 complexity | 32ee997c99d71ff7390718b10a55e5f8 MD5 | raw file
  1. // the ai :D
  2. //please ask/write me if you use this in your project
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. //TODO:
  7. //cardids of duplicate + avenge
  8. //tueftlermeisteroberfunks
  9. //verrückter bomber ( 3 damage to random chars)
  10. //nozdormu (for computing time :D)
  11. //faehrtenlesen
  12. // lehrensucher cho
  13. //scharmuetzel kills all :D
  14. //hoggersmash
  15. namespace HREngine.Bots
  16. {
  17. public class Action
  18. {
  19. public bool cardplay = false;
  20. public bool heroattack = false;
  21. public bool useability = false;
  22. public bool minionplay = false;
  23. public Handmanager.Handcard handcard;
  24. public int cardEntitiy = -1;
  25. public int owntarget = -1; //= target where card/minion is placed
  26. public int ownEntitiy = -1;
  27. public int enemytarget = -1; // target where red arrow is placed
  28. public int enemyEntitiy = -1;
  29. public int druidchoice = 0; // 1 left card, 2 right card
  30. public int numEnemysBeforePlayed = 0;
  31. public bool comboBeforePlayed = false;
  32. public void print()
  33. {
  34. Helpfunctions help = Helpfunctions.Instance;
  35. help.logg("current Action: ");
  36. if (this.cardplay)
  37. {
  38. help.logg("play " + this.handcard.card.name);
  39. if (this.druidchoice >= 1) help.logg("choose choise " + this.druidchoice);
  40. help.logg("with entityid " + this.cardEntitiy);
  41. if (this.owntarget >= 0)
  42. {
  43. help.logg("on position " + this.owntarget);
  44. }
  45. if (this.enemytarget >= 0)
  46. {
  47. help.logg("and target to " + this.enemytarget + " " + this.enemyEntitiy);
  48. }
  49. }
  50. if (this.minionplay)
  51. {
  52. help.logg("attacker: " + this.owntarget + " enemy: " + this.enemytarget);
  53. help.logg("targetplace " + this.enemyEntitiy);
  54. }
  55. if (this.heroattack)
  56. {
  57. help.logg("attack with hero, enemy: " + this.enemytarget);
  58. help.logg("targetplace " + this.enemyEntitiy);
  59. }
  60. if (this.useability)
  61. {
  62. help.logg("useability ");
  63. if (this.enemytarget >= 0)
  64. {
  65. help.logg("on enemy: " + this.enemytarget + "targetplace " + this.enemyEntitiy);
  66. }
  67. }
  68. help.logg("");
  69. }
  70. }
  71. public class Playfield
  72. {
  73. public bool logging = false;
  74. public bool sEnemTurn = false;
  75. public int attackFaceHP = 15;
  76. public int evaluatePenality = 0;
  77. public int ownController = 0;
  78. public int ownHeroEntity = -1;
  79. public int enemyHeroEntity = -1;
  80. public int value = Int32.MinValue;
  81. public int guessingHeroHP = 30;
  82. public int mana = 0;
  83. public int enemyHeroHp = 30;
  84. public HeroEnum ownHeroName = HeroEnum.druid;
  85. public HeroEnum enemyHeroName = HeroEnum.druid;
  86. public bool ownHeroReady = false;
  87. public bool enemyHeroReady = false;
  88. public int ownHeroNumAttackThisTurn = 0;
  89. public int enemyHeroNumAttackThisTurn = 0;
  90. public bool ownHeroWindfury = false;
  91. public bool enemyHeroWindfury = false;
  92. public List<string> ownSecretsIDList = new List<string>();
  93. public int enemySecretCount = 0;
  94. public int ownHeroHp = 30;
  95. public int ownheroAngr = 0;
  96. public int enemyheroAngr = 0;
  97. public bool ownHeroFrozen = false;
  98. public bool enemyHeroFrozen = false;
  99. public bool heroImmuneWhileAttacking = false;
  100. public bool enemyheroImmuneWhileAttacking = false;
  101. public bool heroImmune = false;
  102. public bool enemyHeroImmune = false;
  103. public int ownWeaponDurability = 0;
  104. public int ownWeaponAttack = 0;
  105. public string ownWeaponName = "";
  106. public string enemyWeaponName = "";
  107. public int enemyWeaponAttack = 0;
  108. public int enemyWeaponDurability = 0;
  109. public List<Minion> ownMinions = new List<Minion>();
  110. public List<Minion> enemyMinions = new List<Minion>();
  111. public List<Handmanager.Handcard> owncards = new List<Handmanager.Handcard>();
  112. public List<Action> playactions = new List<Action>();
  113. public bool complete = false;
  114. public int owncarddraw = 0;
  115. public int ownHeroDefence = 0;
  116. public int enemycarddraw = 0;
  117. public int enemyAnzCards = 0;
  118. public int enemyHeroDefence = 0;
  119. public int doublepriest = 0;
  120. public int spellpower = 0;
  121. public bool auchenaiseelenpriesterin = false;
  122. public bool ownBaronRivendare = false;
  123. public bool enemyBaronRivendare = false;
  124. public bool playedmagierinderkirintor = false;
  125. public bool playedPreparation = false;
  126. public int winzigebeschwoererin = 0;
  127. public int startedWithWinzigebeschwoererin = 0;
  128. public int zauberlehrling = 0;
  129. public int startedWithZauberlehrling = 0;
  130. public int managespenst = 0;
  131. public int startedWithManagespenst = 0;
  132. public int soeldnerDerVenture = 0;
  133. public int startedWithsoeldnerDerVenture = 0;
  134. public int beschwoerungsportal = 0;
  135. public int startedWithbeschwoerungsportal = 0;
  136. public int ownWeaponAttackStarted = 0;
  137. public int ownMobsCountStarted = 0;
  138. public int ownCardsCountStarted = 0;
  139. public int ownHeroHpStarted = 30;
  140. public int enemyHeroHpStarted = 30;
  141. public int mobsplayedThisTurn = 0;
  142. public int startedWithMobsPlayedThisTurn = 0;
  143. public int cardsPlayedThisTurn = 0;
  144. public int ueberladung = 0; //=recall
  145. public int ownMaxMana = 0;
  146. public int enemyMaxMana = 0;
  147. public int lostDamage = 0;
  148. public int lostHeal = 0;
  149. public int lostWeaponDamage = 0;
  150. public int ownDeckSize = 30;
  151. public int enemyDeckSize = 30;
  152. public int ownHeroFatigue = 0;
  153. public int enemyHeroFatigue = 0;
  154. public bool ownAbilityReady = false;
  155. public CardDB.Card ownHeroAblility;
  156. public bool enemyAbilityReady = false;
  157. public CardDB.Card enemyHeroAblility;
  158. //Helpfunctions help = Helpfunctions.Instance;
  159. private void addMinionsReal(List<Minion> source, List<Minion> trgt)
  160. {
  161. foreach (Minion m in source)
  162. {
  163. trgt.Add(new Minion(m));
  164. }
  165. }
  166. private void addCardsReal(List<Handmanager.Handcard> source)
  167. {
  168. foreach (Handmanager.Handcard m in source)
  169. {
  170. this.owncards.Add(new Handmanager.Handcard(m));
  171. }
  172. }
  173. public Playfield()
  174. {
  175. //this.simulateEnemyTurn = Ai.Instance.simulateEnemyTurn;
  176. this.ownController = Hrtprozis.Instance.getOwnController();
  177. this.ownHeroEntity = Hrtprozis.Instance.ownHeroEntity;
  178. this.enemyHeroEntity = Hrtprozis.Instance.enemyHeroEntitiy;
  179. this.mana = Hrtprozis.Instance.currentMana;
  180. this.ownMaxMana = Hrtprozis.Instance.ownMaxMana;
  181. this.enemyMaxMana = Hrtprozis.Instance.enemyMaxMana;
  182. this.evaluatePenality = 0;
  183. this.ownSecretsIDList = Hrtprozis.Instance.ownSecretList;
  184. this.enemySecretCount = Hrtprozis.Instance.enemySecretCount;
  185. this.heroImmune = Hrtprozis.Instance.heroImmune;
  186. this.enemyHeroImmune = Hrtprozis.Instance.enemyHeroImmune;
  187. this.attackFaceHP = Hrtprozis.Instance.attackFaceHp;
  188. addMinionsReal(Hrtprozis.Instance.ownMinions, ownMinions);
  189. addMinionsReal(Hrtprozis.Instance.enemyMinions, enemyMinions);
  190. addCardsReal(Handmanager.Instance.handCards);
  191. this.enemyHeroHp = Hrtprozis.Instance.enemyHp;
  192. this.ownHeroName = Hrtprozis.Instance.heroname;
  193. this.enemyHeroName = Hrtprozis.Instance.enemyHeroname;
  194. this.ownHeroHp = Hrtprozis.Instance.heroHp;
  195. this.complete = false;
  196. this.ownHeroReady = Hrtprozis.Instance.ownheroisread;
  197. this.ownHeroWindfury = Hrtprozis.Instance.ownHeroWindfury;
  198. this.ownHeroNumAttackThisTurn = Hrtprozis.Instance.ownHeroNumAttacksThisTurn;
  199. this.ownHeroFrozen = Hrtprozis.Instance.herofrozen;
  200. this.enemyHeroFrozen = Hrtprozis.Instance.enemyfrozen;
  201. this.ownheroAngr = Hrtprozis.Instance.heroAtk;
  202. this.heroImmuneWhileAttacking = Hrtprozis.Instance.heroImmuneToDamageWhileAttacking;
  203. this.ownWeaponDurability = Hrtprozis.Instance.heroWeaponDurability;
  204. this.ownWeaponAttack = Hrtprozis.Instance.heroWeaponAttack;
  205. this.ownWeaponName = Hrtprozis.Instance.ownHeroWeapon;
  206. this.owncarddraw = 0;
  207. this.ownHeroDefence = Hrtprozis.Instance.heroDefence;
  208. this.enemyHeroDefence = Hrtprozis.Instance.enemyDefence;
  209. this.enemyWeaponAttack = Hrtprozis.Instance.enemyWeaponAttack;//dont know jet
  210. this.enemyWeaponName = Hrtprozis.Instance.enemyHeroWeapon;
  211. this.enemyWeaponDurability = Hrtprozis.Instance.enemyWeaponDurability;
  212. this.enemycarddraw = 0;
  213. this.enemyAnzCards = Handmanager.Instance.enemyAnzCards;
  214. this.ownAbilityReady = Hrtprozis.Instance.ownAbilityisReady;
  215. this.ownHeroAblility = Hrtprozis.Instance.heroAbility;
  216. this.enemyHeroAblility = Hrtprozis.Instance.enemyAbility;
  217. this.doublepriest = 0;
  218. this.spellpower = 0;
  219. this.mobsplayedThisTurn = Hrtprozis.Instance.numMinionsPlayedThisTurn;
  220. this.startedWithMobsPlayedThisTurn = Hrtprozis.Instance.numMinionsPlayedThisTurn;// only change mobsplayedthisturm
  221. this.cardsPlayedThisTurn = Hrtprozis.Instance.cardsPlayedThisTurn;
  222. this.ueberladung = Hrtprozis.Instance.ueberladung;
  223. this.ownHeroFatigue = Hrtprozis.Instance.ownHeroFatigue;
  224. this.enemyHeroFatigue = Hrtprozis.Instance.enemyHeroFatigue;
  225. this.ownDeckSize = Hrtprozis.Instance.ownDeckSize;
  226. this.enemyDeckSize = Hrtprozis.Instance.enemyDeckSize;
  227. //need the following for manacost-calculation
  228. this.ownHeroHpStarted = this.ownHeroHp;
  229. this.enemyHeroHpStarted = this.enemyHeroHp;
  230. this.ownWeaponAttackStarted = this.ownWeaponAttack;
  231. this.ownCardsCountStarted = this.owncards.Count;
  232. this.ownMobsCountStarted = this.ownMinions.Count + this.enemyMinions.Count;
  233. this.playedmagierinderkirintor = false;
  234. this.playedPreparation = false;
  235. this.zauberlehrling = 0;
  236. this.winzigebeschwoererin = 0;
  237. this.managespenst = 0;
  238. this.soeldnerDerVenture = 0;
  239. this.beschwoerungsportal = 0;
  240. this.startedWithbeschwoerungsportal = 0;
  241. this.startedWithManagespenst = 0;
  242. this.startedWithWinzigebeschwoererin = 0;
  243. this.startedWithZauberlehrling = 0;
  244. this.startedWithsoeldnerDerVenture = 0;
  245. this.ownBaronRivendare = false;
  246. this.enemyBaronRivendare = false;
  247. foreach (Minion m in this.ownMinions)
  248. {
  249. if (m.silenced) continue;
  250. if (m.name == "prophetvelen") this.doublepriest++;
  251. spellpower = spellpower + m.handcard.card.spellpowervalue;
  252. if (m.name == "auchenaisoulpriest") this.auchenaiseelenpriesterin = true;
  253. if (m.name == "pint-sizedsummoner")
  254. {
  255. this.winzigebeschwoererin++;
  256. this.startedWithWinzigebeschwoererin++;
  257. }
  258. if (m.name == "sorcerersapprentice")
  259. {
  260. this.zauberlehrling++;
  261. this.startedWithZauberlehrling++;
  262. }
  263. if (m.name == "manawraith")
  264. {
  265. this.managespenst++;
  266. this.startedWithManagespenst++;
  267. }
  268. if (m.name == "venturecomercenary")
  269. {
  270. this.soeldnerDerVenture++;
  271. this.startedWithsoeldnerDerVenture++;
  272. }
  273. if (m.name == "summoningportal")
  274. {
  275. this.beschwoerungsportal++;
  276. this.startedWithbeschwoerungsportal++;
  277. }
  278. if (m.handcard.card.specialMin == CardDB.specialMinions.baronrivendare)
  279. {
  280. this.ownBaronRivendare = true;
  281. }
  282. foreach (Enchantment e in m.enchantments)// only at first init needed, after that its copied
  283. {
  284. if (e.CARDID == "NEW1_036e" || e.CARDID == "NEW1_036e2") m.cantLowerHPbelowONE = true;
  285. }
  286. }
  287. foreach (Minion m in this.enemyMinions)
  288. {
  289. if (m.silenced) continue;
  290. if (m.name == "manawraith")
  291. {
  292. this.managespenst++;
  293. this.startedWithManagespenst++;
  294. }
  295. if (m.handcard.card.specialMin == CardDB.specialMinions.baronrivendare)
  296. {
  297. this.enemyBaronRivendare = true;
  298. }
  299. }
  300. }
  301. public Playfield(Playfield p)
  302. {
  303. this.sEnemTurn = p.sEnemTurn;
  304. this.ownController = p.ownController;
  305. this.ownHeroEntity = p.ownHeroEntity;
  306. this.enemyHeroEntity = p.enemyHeroEntity;
  307. this.evaluatePenality = p.evaluatePenality;
  308. foreach(string s in p.ownSecretsIDList)
  309. { this.ownSecretsIDList.Add(s); }
  310. this.enemySecretCount = p.enemySecretCount;
  311. this.mana = p.mana;
  312. this.ownMaxMana = p.ownMaxMana;
  313. this.enemyMaxMana = p.enemyMaxMana;
  314. addMinionsReal(p.ownMinions, ownMinions);
  315. addMinionsReal(p.enemyMinions, enemyMinions);
  316. addCardsReal(p.owncards);
  317. this.enemyHeroHp = p.enemyHeroHp;
  318. this.ownHeroName = p.ownHeroName;
  319. this.enemyHeroName = p.enemyHeroName;
  320. this.ownHeroHp = p.ownHeroHp;
  321. this.playactions.AddRange(p.playactions);
  322. this.complete = false;
  323. this.ownHeroReady = p.ownHeroReady;
  324. this.enemyHeroReady = p.enemyHeroReady;
  325. this.ownHeroNumAttackThisTurn = p.ownHeroNumAttackThisTurn;
  326. this.enemyHeroNumAttackThisTurn = p.enemyHeroNumAttackThisTurn;
  327. this.ownHeroWindfury = p.ownHeroWindfury;
  328. this.attackFaceHP = p.attackFaceHP;
  329. this.heroImmune = p.heroImmune;
  330. this.enemyHeroImmune = p.enemyHeroImmune;
  331. this.ownheroAngr = p.ownheroAngr;
  332. this.enemyheroAngr = p.enemyheroAngr;
  333. this.ownHeroFrozen = p.ownHeroFrozen;
  334. this.enemyHeroFrozen = p.enemyHeroFrozen;
  335. this.heroImmuneWhileAttacking = p.heroImmuneWhileAttacking;
  336. this.enemyheroImmuneWhileAttacking = p.enemyheroImmuneWhileAttacking;
  337. this.owncarddraw = p.owncarddraw;
  338. this.ownHeroDefence = p.ownHeroDefence;
  339. this.enemyWeaponAttack = p.enemyWeaponAttack;
  340. this.enemyWeaponDurability = p.enemyWeaponDurability;
  341. this.enemyWeaponName = p.enemyWeaponName;
  342. this.enemycarddraw = p.enemycarddraw;
  343. this.enemyAnzCards = p.enemyAnzCards;
  344. this.enemyHeroDefence = p.enemyHeroDefence;
  345. this.ownWeaponDurability = p.ownWeaponDurability;
  346. this.ownWeaponAttack = p.ownWeaponAttack;
  347. this.ownWeaponName = p.ownWeaponName;
  348. this.lostDamage = p.lostDamage;
  349. this.lostWeaponDamage = p.lostWeaponDamage;
  350. this.lostHeal = p.lostHeal;
  351. this.ownAbilityReady = p.ownAbilityReady;
  352. this.enemyAbilityReady = p.enemyAbilityReady;
  353. this.ownHeroAblility = p.ownHeroAblility;
  354. this.enemyHeroAblility = p.enemyHeroAblility;
  355. this.doublepriest = 0;
  356. this.spellpower = 0;
  357. this.mobsplayedThisTurn = p.mobsplayedThisTurn;
  358. this.startedWithMobsPlayedThisTurn = p.startedWithMobsPlayedThisTurn;
  359. this.cardsPlayedThisTurn = p.cardsPlayedThisTurn;
  360. this.ueberladung = p.ueberladung;
  361. this.ownDeckSize = p.ownDeckSize;
  362. this.enemyDeckSize = p.enemyDeckSize;
  363. this.ownHeroFatigue = p.ownHeroFatigue;
  364. this.enemyHeroFatigue = p.enemyHeroFatigue;
  365. //need the following for manacost-calculation
  366. this.ownHeroHpStarted = p.ownHeroHpStarted;
  367. this.enemyHeroHp = p.enemyHeroHp;
  368. this.ownWeaponAttackStarted = p.ownWeaponAttackStarted;
  369. this.ownCardsCountStarted = p.ownCardsCountStarted;
  370. this.ownMobsCountStarted = p.ownMobsCountStarted;
  371. this.startedWithWinzigebeschwoererin = p.startedWithWinzigebeschwoererin;
  372. this.playedmagierinderkirintor = p.playedmagierinderkirintor;
  373. this.startedWithZauberlehrling = p.startedWithZauberlehrling;
  374. this.startedWithWinzigebeschwoererin = p.startedWithWinzigebeschwoererin;
  375. this.startedWithManagespenst = p.startedWithManagespenst;
  376. this.startedWithsoeldnerDerVenture = p.startedWithsoeldnerDerVenture;
  377. this.startedWithbeschwoerungsportal = p.startedWithbeschwoerungsportal;
  378. this.ownBaronRivendare = false;
  379. this.enemyBaronRivendare = false;
  380. this.zauberlehrling = 0;
  381. this.winzigebeschwoererin = 0;
  382. this.managespenst = 0;
  383. this.soeldnerDerVenture = 0;
  384. foreach (Minion m in this.ownMinions)
  385. {
  386. if (m.silenced) continue;
  387. if (m.handcard.card.specialMin == CardDB.specialMinions.prophetvelen) this.doublepriest++;
  388. spellpower = spellpower + m.handcard.card.spellpowervalue;
  389. if (m.handcard.card.specialMin == CardDB.specialMinions.auchenaisoulpriest) this.auchenaiseelenpriesterin = true;
  390. if (m.handcard.card.specialMin == CardDB.specialMinions.pintsizedsummoner) this.winzigebeschwoererin++;
  391. if (m.handcard.card.specialMin == CardDB.specialMinions.sorcerersapprentice) this.zauberlehrling++;
  392. if (m.handcard.card.specialMin == CardDB.specialMinions.manawraith) this.managespenst++;
  393. if (m.handcard.card.specialMin == CardDB.specialMinions.venturecomercenary) this.soeldnerDerVenture++;
  394. if (m.handcard.card.specialMin == CardDB.specialMinions.summoningportal) this.beschwoerungsportal++;
  395. if (m.handcard.card.specialMin == CardDB.specialMinions.baronrivendare)
  396. {
  397. this.ownBaronRivendare = true;
  398. }
  399. }
  400. foreach (Minion m in this.enemyMinions)
  401. {
  402. if (m.silenced) continue;
  403. if (m.handcard.card.specialMin == CardDB.specialMinions.manawraith) this.managespenst++;
  404. if (m.handcard.card.specialMin == CardDB.specialMinions.baronrivendare)
  405. {
  406. this.enemyBaronRivendare = true;
  407. }
  408. }
  409. }
  410. public bool isEqual(Playfield p, bool logg)
  411. {
  412. if (logg)
  413. {
  414. if (this.value != p.value) return false;
  415. }
  416. if (this.enemySecretCount != p.enemySecretCount)
  417. {
  418. if(logg) Helpfunctions.Instance.logg("enemy secrets changed ");
  419. return false;
  420. }
  421. if (this.mana != p.mana || this.enemyMaxMana != p.enemyMaxMana || this.ownMaxMana != p.ownMaxMana)
  422. {
  423. if (logg) Helpfunctions.Instance.logg("mana changed " + this.mana + " " + p.mana + " " + this.enemyMaxMana + " " + p.enemyMaxMana + " " + this.ownMaxMana + " " + p.ownMaxMana);
  424. return false;
  425. }
  426. if (this.ownDeckSize != p.ownDeckSize || this.enemyDeckSize != p.enemyDeckSize || this.ownHeroFatigue != p.ownHeroFatigue || this.enemyHeroFatigue != p.enemyHeroFatigue)
  427. {
  428. if (logg) Helpfunctions.Instance.logg("deck/fatigue changed " + this.ownDeckSize + " " + p.ownDeckSize + " " + this.enemyDeckSize + " " + p.enemyDeckSize + " " + this.ownHeroFatigue + " " + p.ownHeroFatigue + " " + this.enemyHeroFatigue + " " + p.enemyHeroFatigue);
  429. }
  430. if (this.cardsPlayedThisTurn != p.cardsPlayedThisTurn || this.mobsplayedThisTurn != p.mobsplayedThisTurn || this.ueberladung != p.ueberladung)
  431. {
  432. if (logg) Helpfunctions.Instance.logg("stuff changed " + this.cardsPlayedThisTurn + " " + p.cardsPlayedThisTurn + " " + this.mobsplayedThisTurn + " " + p.mobsplayedThisTurn + " " + this.ueberladung + " " + p.ueberladung);
  433. return false;
  434. }
  435. if (this.ownHeroName != p.ownHeroName || this.enemyHeroName != p.enemyHeroName)
  436. {
  437. if (logg) Helpfunctions.Instance.logg("hero name changed ");
  438. return false;
  439. }
  440. if (this.ownHeroHp != p.ownHeroHp || this.ownheroAngr != p.ownheroAngr || this.ownHeroDefence != p.ownHeroDefence || this.ownHeroFrozen != p.ownHeroFrozen || this.heroImmuneWhileAttacking != p.heroImmuneWhileAttacking || this.heroImmune!=p.heroImmune)
  441. {
  442. if (logg) Helpfunctions.Instance.logg("ownhero changed " + this.ownHeroHp + " " + p.ownHeroHp + " " + this.ownheroAngr + " " + p.ownheroAngr + " " + this.ownHeroDefence + " " + p.ownHeroDefence + " " + this.ownHeroFrozen + " " + p.ownHeroFrozen + " " + this.heroImmuneWhileAttacking + " " + p.heroImmuneWhileAttacking + " " + this.heroImmune + " " + p.heroImmune);
  443. return false;
  444. }
  445. if (this.ownHeroReady != p.ownHeroReady || this.ownWeaponAttack != p.ownWeaponAttack || this.ownWeaponDurability != p.ownWeaponDurability || this.ownHeroNumAttackThisTurn != p.ownHeroNumAttackThisTurn || this.ownHeroWindfury != p.ownHeroWindfury)
  446. {
  447. if (logg) Helpfunctions.Instance.logg("weapon changed " + this.ownHeroReady + " " + p.ownHeroReady + " " + this.ownWeaponAttack + " " + p.ownWeaponAttack + " " + this.ownWeaponDurability + " " + p.ownWeaponDurability + " " + this.ownHeroNumAttackThisTurn + " " + p.ownHeroNumAttackThisTurn + " " + this.ownHeroWindfury + " " + p.ownHeroWindfury);
  448. return false;
  449. }
  450. if (this.enemyHeroHp != p.enemyHeroHp || this.enemyWeaponAttack != p.enemyWeaponAttack || this.enemyHeroDefence != p.enemyHeroDefence || this.enemyWeaponDurability != p.enemyWeaponDurability || this.enemyHeroFrozen != p.enemyHeroFrozen || this.enemyHeroImmune != p.enemyHeroImmune)
  451. {
  452. if (logg) Helpfunctions.Instance.logg("enemyhero changed " + this.enemyHeroHp + " " + p.enemyHeroHp + " " + this.enemyWeaponAttack + " " + p.enemyWeaponAttack + " " + this.enemyHeroDefence + " " + p.enemyHeroDefence + " " + this.enemyWeaponDurability + " " + p.enemyWeaponDurability + " " + this.enemyHeroFrozen + " " + p.enemyHeroFrozen + " " + this.enemyHeroImmune + " " + p.enemyHeroImmune);
  453. return false;
  454. }
  455. /*if (this.auchenaiseelenpriesterin != p.auchenaiseelenpriesterin || this.winzigebeschwoererin != p.winzigebeschwoererin || this.zauberlehrling != p.zauberlehrling || this.managespenst != p.managespenst || this.soeldnerDerVenture != p.soeldnerDerVenture || this.beschwoerungsportal != p.beschwoerungsportal || this.doublepriest != p.doublepriest)
  456. {
  457. Helpfunctions.Instance.logg("special minions changed " + this.auchenaiseelenpriesterin + " " + p.auchenaiseelenpriesterin + " " + this.winzigebeschwoererin + " " + p.winzigebeschwoererin + " " + this.zauberlehrling + " " + p.zauberlehrling + " " + this.managespenst + " " + p.managespenst + " " + this.soeldnerDerVenture + " " + p.soeldnerDerVenture + " " + this.beschwoerungsportal + " " + p.beschwoerungsportal + " " + this.doublepriest + " " + p.doublepriest);
  458. return false;
  459. }*/
  460. if (this.ownHeroAblility.name != p.ownHeroAblility.name)
  461. {
  462. if (logg) Helpfunctions.Instance.logg("hero ability changed ");
  463. return false;
  464. }
  465. if (this.spellpower != p.spellpower)
  466. {
  467. if (logg) Helpfunctions.Instance.logg("spellpower changed");
  468. return false;
  469. }
  470. if (this.ownMinions.Count != p.ownMinions.Count || this.enemyMinions.Count != p.enemyMinions.Count || this.owncards.Count != p.owncards.Count)
  471. {
  472. if (logg) Helpfunctions.Instance.logg("minions count or hand changed");
  473. return false;
  474. }
  475. bool minionbool = true;
  476. for (int i = 0; i < this.ownMinions.Count; i++)
  477. {
  478. Minion dis = this.ownMinions[i]; Minion pis = p.ownMinions[i];
  479. //if (dis.entitiyID == 0) dis.entitiyID = pis.entitiyID;
  480. //if (pis.entitiyID == 0) pis.entitiyID = dis.entitiyID;
  481. if (dis.entitiyID != pis.entitiyID) minionbool= false;
  482. if (dis.Angr != pis.Angr || dis.Hp != pis.Hp || dis.maxHp != pis.maxHp || dis.numAttacksThisTurn != pis.numAttacksThisTurn) minionbool = false;
  483. if (dis.Ready != pis.Ready) minionbool = false; // includes frozen, exhaunted
  484. if (dis.playedThisTurn != pis.playedThisTurn || dis.numAttacksThisTurn != pis.numAttacksThisTurn) minionbool = false;
  485. if (dis.silenced != pis.silenced || dis.stealth != pis.stealth || dis.taunt != pis.taunt || dis.windfury != pis.windfury || dis.wounded != pis.wounded || dis.zonepos != pis.zonepos) minionbool = false;
  486. if (dis.divineshild != pis.divineshild || dis.cantLowerHPbelowONE != pis.cantLowerHPbelowONE || dis.immune != pis.immune) minionbool = false;
  487. }
  488. if (minionbool == false)
  489. {
  490. if (logg) Helpfunctions.Instance.logg("ownminions changed");
  491. return false;
  492. }
  493. for (int i = 0; i < this.enemyMinions.Count; i++)
  494. {
  495. Minion dis = this.enemyMinions[i]; Minion pis = p.enemyMinions[i];
  496. //if (dis.entitiyID == 0) dis.entitiyID = pis.entitiyID;
  497. //if (pis.entitiyID == 0) pis.entitiyID = dis.entitiyID;
  498. if (dis.entitiyID != pis.entitiyID) minionbool = false;
  499. if (dis.Angr != pis.Angr || dis.Hp != pis.Hp || dis.maxHp != pis.maxHp || dis.numAttacksThisTurn != pis.numAttacksThisTurn) minionbool = false;
  500. if (dis.Ready != pis.Ready) minionbool = false; // includes frozen, exhaunted
  501. if (dis.playedThisTurn != pis.playedThisTurn || dis.numAttacksThisTurn != pis.numAttacksThisTurn) minionbool = false;
  502. if (dis.silenced != pis.silenced || dis.stealth != pis.stealth || dis.taunt != pis.taunt || dis.windfury != pis.windfury || dis.wounded != pis.wounded || dis.zonepos != pis.zonepos) minionbool = false;
  503. if (dis.divineshild != pis.divineshild || dis.cantLowerHPbelowONE != pis.cantLowerHPbelowONE || dis.immune != pis.immune) minionbool = false;
  504. }
  505. if (minionbool == false)
  506. {
  507. if (logg) Helpfunctions.Instance.logg("enemyminions changed");
  508. return false;
  509. }
  510. for (int i = 0; i < this.owncards.Count; i++)
  511. {
  512. Handmanager.Handcard dishc = this.owncards[i]; Handmanager.Handcard pishc = p.owncards[i];
  513. if ( dishc.position != pishc.position || dishc.entity != pishc.entity || dishc.getManaCost(this) != pishc.getManaCost(p))
  514. {
  515. if (logg) Helpfunctions.Instance.logg("handcard changed: " + dishc.card.name);
  516. return false;
  517. }
  518. }
  519. return true;
  520. }
  521. public void simulateEnemysTurn()
  522. {
  523. int maxwide = 20;
  524. this.enemyAbilityReady = true;
  525. this.enemyHeroNumAttackThisTurn = 0;
  526. this.enemyHeroWindfury = false;
  527. if (this.enemyWeaponName == "doomhammer") this.enemyHeroWindfury = true;
  528. this.enemyheroImmuneWhileAttacking = false;
  529. if (this.enemyWeaponName == "gladiatorslongbow") this.enemyheroImmuneWhileAttacking = true;
  530. if (!this.enemyHeroFrozen && this.enemyWeaponDurability > 0) this.enemyHeroReady = true;
  531. this.enemyheroAngr = this.enemyWeaponAttack;
  532. bool havedonesomething = true;
  533. List<Playfield> posmoves = new List<Playfield>();
  534. posmoves.Add(new Playfield(this));
  535. List<Playfield> temp = new List<Playfield>();
  536. int deep = 0;
  537. while (havedonesomething)
  538. {
  539. temp.Clear();
  540. temp.AddRange(posmoves);
  541. havedonesomething = false;
  542. Playfield bestold = null;
  543. int bestoldval = 20000000;
  544. foreach (Playfield p in temp)
  545. {
  546. if (p.complete)
  547. {
  548. continue;
  549. }
  550. List<Minion> playedMinions = new List<Minion>(8);
  551. foreach (Minion m in p.enemyMinions)
  552. {
  553. if (m.Ready && m.Angr >= 1 && !m.frozen)
  554. {
  555. //BEGIN:cut (double/similar) attacking minions out#####################################
  556. // DONT LET SIMMILAR MINIONS ATTACK IN ONE TURN (example 3 unlesh the hounds-hounds doesnt need to simulated hole)
  557. List<Minion> tempoo = new List<Minion>(playedMinions);
  558. bool dontattacked = true;
  559. bool isSpecial = PenalityManager.Instance.specialMinions.ContainsKey(m.name);
  560. foreach (Minion mnn in tempoo)
  561. {
  562. // special minions are allowed to attack in silended and unsilenced state!
  563. //help.logg(mnn.silenced + " " + m.silenced + " " + mnn.name + " " + m.name + " " + penman.specialMinions.ContainsKey(m.name));
  564. bool otherisSpecial = PenalityManager.Instance.specialMinions.ContainsKey(mnn.name);
  565. if ((!isSpecial || (isSpecial && m.silenced)) && (!otherisSpecial || (otherisSpecial && mnn.silenced))) // both are not special, if they are the same, dont add
  566. {
  567. if (mnn.Angr == m.Angr && mnn.Hp == m.Hp && mnn.divineshild == m.divineshild && mnn.taunt == m.taunt && mnn.poisonous == m.poisonous) dontattacked = false;
  568. continue;
  569. }
  570. if (isSpecial == otherisSpecial && !m.silenced && !mnn.silenced) // same are special
  571. {
  572. if (m.name != mnn.name) // different name -> take it
  573. {
  574. continue;
  575. }
  576. // same name -> test whether they are equal
  577. if (mnn.Angr == m.Angr && mnn.Hp == m.Hp && mnn.divineshild == m.divineshild && mnn.taunt == m.taunt && mnn.poisonous == m.poisonous) dontattacked = false;
  578. continue;
  579. }
  580. }
  581. if (dontattacked)
  582. {
  583. playedMinions.Add(m);
  584. }
  585. else
  586. {
  587. //help.logg(m.name + " doesnt need to attack!");
  588. continue;
  589. }
  590. //END: cut (double/similar) attacking minions out#####################################
  591. //help.logg(m.name + " is going to attack!");
  592. List<targett> trgts = p.getAttackTargets(false);
  593. if (true)//(this.useCutingTargets)
  594. {
  595. trgts = Ai.Instance.cutAttackTargets(trgts, p, false);
  596. }
  597. foreach (targett trgt in trgts)
  598. {
  599. Playfield pf = new Playfield(p);
  600. havedonesomething = true;
  601. pf.ENEMYattackWithMinion(m, trgt.target, trgt.targetEntity);
  602. posmoves.Add(pf);
  603. }
  604. if (trgts.Count == 1 && trgts[0].target == 100)//only enemy hero is available als attack
  605. {
  606. break;
  607. }
  608. }
  609. }
  610. // attacked with minions done
  611. // attack with hero
  612. if (p.enemyHeroReady)
  613. {
  614. List<targett> trgts = p.getAttackTargets(false);
  615. havedonesomething = true;
  616. if (true)//(this.useCutingTargets)
  617. {
  618. trgts = Ai.Instance.cutAttackTargets(trgts, p, false);
  619. }
  620. foreach (targett trgt in trgts)
  621. {
  622. Playfield pf = new Playfield(p);
  623. pf.ENEMYattackWithWeapon(trgt.target, trgt.targetEntity, 0);
  624. posmoves.Add(pf);
  625. }
  626. }
  627. // use ability
  628. /// TODO check if ready after manaup
  629. if (p.enemyAbilityReady && p.enemyHeroAblility.canplayCard(p, 0))
  630. {
  631. int abilityPenality = 0;
  632. havedonesomething = true;
  633. // if we have mage or priest, we have to target something####################################################
  634. if (p.enemyHeroName == HeroEnum.mage || p.enemyHeroName == HeroEnum.priest)
  635. {
  636. List<targett> trgts = p.enemyHeroAblility.getTargetsForCard(p);
  637. foreach (targett trgt in trgts)
  638. {
  639. Playfield pf = new Playfield(p);
  640. havedonesomething = true;
  641. pf.ENEMYactivateAbility(p.enemyHeroAblility, trgt.target, trgt.targetEntity);
  642. posmoves.Add(pf);
  643. }
  644. }
  645. else
  646. {
  647. // the other classes dont have to target####################################################
  648. Playfield pf = new Playfield(p);
  649. havedonesomething = true;
  650. pf.ENEMYactivateAbility(p.enemyHeroAblility, -1, -1);
  651. posmoves.Add(pf);
  652. }
  653. }
  654. p.endEnemyTurn();
  655. if (Ai.Instance.botBase.getPlayfieldValue(p) < bestoldval) // want the best enemy-play-> worst for us
  656. {
  657. bestoldval = Ai.Instance.botBase.getPlayfieldValue(p);
  658. bestold = p;
  659. }
  660. posmoves.Remove(p);
  661. if (posmoves.Count >= maxwide) break;
  662. }
  663. if ( bestoldval <= 10000 && bestold != null)
  664. {
  665. posmoves.Add(bestold);
  666. }
  667. deep++;
  668. if (posmoves.Count >= maxwide) break;
  669. }
  670. foreach (Playfield p in posmoves)
  671. {
  672. if (!p.complete) p.endEnemyTurn();
  673. }
  674. int bestval = int.MaxValue;
  675. Playfield bestplay = posmoves[0];
  676. foreach (Playfield p in posmoves)
  677. {
  678. int val = Ai.Instance.botBase.getPlayfieldValue(p);
  679. if (bestval > val)// we search the worst value
  680. {
  681. bestplay = p;
  682. bestval = val;
  683. }
  684. }
  685. this.value = bestplay.value;
  686. }
  687. public void prepareNextTurn()
  688. {
  689. this.ownMaxMana = Math.Min(10, this.ownMaxMana + 1);
  690. this.mana = this.ownMaxMana - this.ueberladung;
  691. foreach (Minion m in ownMinions)
  692. {
  693. m.Ready = true;
  694. m.numAttacksThisTurn = 0;
  695. m.playedThisTurn = false;
  696. }
  697. if (this.ownWeaponName != "") this.ownHeroReady = true;
  698. this.ownheroAngr = this.ownWeaponAttack;
  699. this.ownHeroFrozen = false;
  700. this.ownAbilityReady = true;
  701. this.complete = false;
  702. this.sEnemTurn = false;
  703. this.value = int.MinValue;
  704. }
  705. public List<targett> getAttackTargets(bool own)
  706. {
  707. List<targett> trgts = new List<targett>();
  708. List<targett> trgts2 = new List<targett>();
  709. bool hastanks = false;
  710. if (own)
  711. {
  712. trgts2.Add(new targett(200, this.enemyHeroEntity));
  713. foreach (Minion m in this.enemyMinions)
  714. {
  715. if (m.stealth) continue; // cant target stealth
  716. if (m.taunt)
  717. {
  718. hastanks = true;
  719. trgts.Add(new targett(m.id + 10, m.entitiyID));
  720. }
  721. else
  722. {
  723. trgts2.Add(new targett(m.id + 10, m.entitiyID));
  724. }
  725. }
  726. }
  727. else
  728. {
  729. foreach (Minion m in this.ownMinions)
  730. {
  731. if (m.stealth) continue; // cant target stealth
  732. if (m.taunt)
  733. {
  734. hastanks = true;
  735. trgts.Add(new targett(m.id, m.entitiyID));
  736. }
  737. else
  738. {
  739. trgts2.Add(new targett(m.id, m.entitiyID));
  740. }
  741. }
  742. if (trgts2.Count == 0) trgts2.Add(new targett(100, this.ownHeroEntity));
  743. }
  744. if (hastanks) return trgts;
  745. return trgts2;
  746. }
  747. public int getBestPlace(CardDB.Card card, bool lethal)
  748. {
  749. if (card.type != CardDB.cardtype.MOB) return 0;
  750. if (this.ownMinions.Count == 0) return 0;
  751. if (this.ownMinions.Count == 1) return 1;
  752. int[] places = new int[this.ownMinions.Count];
  753. int i = 0;
  754. int tempval = 0;
  755. if (lethal && card.specialMin == CardDB.specialMinions.defenderofargus)
  756. {
  757. i = 0;
  758. foreach (Minion m in this.ownMinions)
  759. {
  760. places[i] = 0;
  761. tempval = 0;
  762. if (m.Ready)
  763. {
  764. tempval -= m.Angr -1;
  765. if(m.windfury) tempval-=m.Angr -1;
  766. }
  767. places[i] = tempval;
  768. i++;
  769. }
  770. i = 0;
  771. int bestpl = 7;
  772. int bestval = 10000;
  773. foreach (Minion m in this.ownMinions)
  774. {
  775. int prev = 0;
  776. int next = 0;
  777. if (i >= 1) prev = places[i - 1];
  778. next = places[i];
  779. if (bestval > prev + next)
  780. {
  781. bestval = prev + next;
  782. bestpl = i;
  783. }
  784. i++;
  785. }
  786. return bestpl;
  787. }
  788. if (card.specialMin == CardDB.specialMinions.sunfuryprotector || card.specialMin == CardDB.specialMinions.defenderofargus) // bestplace, if right and left minions have no taunt + lots of hp, dont make priority-minions to taunt
  789. {
  790. i = 0;
  791. foreach (Minion m in this.ownMinions)
  792. {
  793. places[i] = 0;
  794. tempval = 0;
  795. if (!m.taunt)
  796. {
  797. tempval -= m.Hp;
  798. }
  799. else
  800. {
  801. tempval -= m.Hp+2;
  802. }
  803. if (m.handcard.card.specialMin == CardDB.specialMinions.flametonguetotem) tempval += 50;
  804. if (m.handcard.card.specialMin == CardDB.specialMinions.raidleader) tempval += 10;
  805. if (m.handcard.card.specialMin == CardDB.specialMinions.grimscaleoracle) tempval += 10;
  806. if (m.handcard.card.specialMin == CardDB.specialMinions.direwolfalpha) tempval += 50;
  807. if (m.handcard.card.specialMin == CardDB.specialMinions.murlocwarleader) tempval += 10;
  808. if (m.handcard.card.specialMin == CardDB.specialMinions.southseacaptain) tempval += 10;
  809. if (m.handcard.card.specialMin == CardDB.specialMinions.stormwindchampion) tempval += 10;
  810. if (m.handcard.card.specialMin == CardDB.specialMinions.timberwolf) tempval += 10;
  811. if (m.handcard.card.specialMin == CardDB.specialMinions.leokk) tempval += 10;
  812. if (m.handcard.card.specialMin == CardDB.specialMinions.northshirecleric) tempval += 10;
  813. if (m.handcard.card.specialMin == CardDB.specialMinions.sorcerersapprentice) tempval += 10;
  814. if (m.handcard.card.specialMin == CardDB.specialMinions.pintsizedsummoner) tempval += 10;
  815. if (m.handcard.card.specialMin == CardDB.specialMinions.summoningportal) tempval += 10;
  816. if (m.handcard.card.specialMin == CardDB.specialMinions.scavenginghyena) tempval += 10;
  817. places[i] = tempval;
  818. i++;
  819. }
  820. i = 0;
  821. int bestpl = 7;
  822. int bestval = 10000;
  823. foreach (Minion m in this.ownMinions)
  824. {
  825. int prev = 0;
  826. int next = 0;
  827. if (i >= 1) prev = places[i - 1];
  828. next = places[i];
  829. if(bestval > prev + next)
  830. {
  831. bestval = prev + next;
  832. bestpl = i;
  833. }
  834. i++;
  835. }
  836. return bestpl;
  837. }
  838. int cardIsBuffer = 0;
  839. bool placebuff = false;
  840. if (card.specialMin == CardDB.specialMinions.flametonguetotem || card.specialMin == CardDB.specialMinions.direwolfalpha)
  841. {
  842. placebuff = true;
  843. if (card.specialMin == CardDB.specialMinions.flametonguetotem) cardIsBuffer = 2;
  844. if (card.specialMin == CardDB.specialMinions.direwolfalpha) cardIsBuffer = 1;
  845. }
  846. bool commander = false;
  847. foreach (Minion m in this.ownMinions)
  848. {
  849. if (m.handcard.card.specialMin == CardDB.specialMinions.warsongcommander) commander = true;
  850. }
  851. foreach (Minion m in this.ownMinions)
  852. {
  853. if (m.handcard.card.specialMin == CardDB.specialMinions.flametonguetotem || m.handcard.card.specialMin == CardDB.specialMinions.direwolfalpha) placebuff = true;
  854. }
  855. //attackmaxing :D
  856. if (placebuff)
  857. {
  858. int cval = 0;
  859. if (card.Charge || (card.Attack <= 3 && commander))
  860. {
  861. cval = card.Attack;
  862. if (card.windfury) cval = card.Attack;
  863. }
  864. i = 0;
  865. int[] buffplaces = new int[this.ownMinions.Count];
  866. int gesval = 0;
  867. foreach (Minion m in this.ownMinions)
  868. {
  869. buffplaces[i] = 0;
  870. places[i] = 0;
  871. if (m.Ready)
  872. {
  873. tempval = m.Angr;
  874. if (m.windfury && m.numAttacksThisTurn == 0) tempval += m.Angr;
  875. }
  876. if (m.handcard.card.specialMin == CardDB.specialMinions.flametonguetotem )
  877. {
  878. buffplaces[i] = 2;
  879. }
  880. if (m.handcard.card.specialMin == CardDB.specialMinions.direwolfalpha)
  881. {
  882. buffplaces[i] = 1;
  883. }
  884. places[i] = tempval;
  885. gesval += tempval;
  886. i++;
  887. }
  888. int bplace = 0;
  889. int bvale = 0;
  890. tempval = 0;
  891. i = 0;
  892. for (int j = 0; j <= this.ownMinions.Count; j++)
  893. {
  894. tempval = gesval;
  895. int current = cval;
  896. int prev = 0;
  897. int next = 0;
  898. if (i >= 1)
  899. {
  900. tempval -= places[i - 1];
  901. prev = places[i - 1];
  902. prev+=cardIsBuffer;
  903. current+=buffplaces[i-1];
  904. if (i < this.ownMinions.Count)
  905. {
  906. prev -= buffplaces[i];
  907. }
  908. }
  909. if (i < this.ownMinions.Count)
  910. {
  911. tempval -= places[i];
  912. next = places[i];
  913. next += cardIsBuffer;
  914. current += buffplaces[i];
  915. if (i >= 1)
  916. {
  917. next -= buffplaces[i-1];
  918. }
  919. }
  920. tempval += current + prev + next;
  921. if (tempval > bvale)
  922. {
  923. bplace = i;
  924. bvale = tempval;
  925. }
  926. i++;
  927. }
  928. return bplace;
  929. }
  930. // normal placement
  931. int cardvalue = card.Attack * 2 + card.Health;
  932. if (card.tank)
  933. {
  934. cardvalue += 5;
  935. cardvalue += card.Health;
  936. }
  937. if (card.specialMin == CardDB.specialMinions.flametonguetotem) cardvalue += 90;
  938. if (card.specialMin == CardDB.specialMinions.raidleader) cardvalue += 10;
  939. if (card.specialMin == CardDB.specialMinions.grimscaleoracle) cardvalue += 10;
  940. if (card.specialMin == CardDB.specialMinions.direwolfalpha) cardvalue += 90;
  941. if (card.specialMin == CardDB.specialMinions.murlocwarleader) cardvalue += 10;
  942. if (card.specialMin == CardDB.specialMinions.southseacaptain) cardvalue += 10;
  943. if (card.specialMin == CardDB.specialMinions.stormwindchampion) cardvalue += 10;
  944. if (card.specialMin == CardDB.specialMinions.timberwolf) cardvalue += 10;
  945. if (card.specialMin == CardDB.specialMinions.leokk) cardvalue += 10;
  946. if (card.specialMin == CardDB.specialMinions.northshirecleric) cardvalue += 10;
  947. if (card.specialMin == CardDB.specialMinions.sorcerersapprentice) cardvalue += 10;
  948. if (card.specialMin == CardDB.specialMinions.pintsizedsummoner) cardvalue += 10;
  949. if (card.specialMin == CardDB.specialMinions.summoningportal) cardvalue += 10;
  950. if (card.specialMin == CardDB.specialMinions.scavenginghyena) cardvalue += 10;
  951. if (card.specialMin == CardDB.specialMinions.faeriedragon) cardvalue += 40;
  952. cardvalue += 1;
  953. i = 0;
  954. foreach(Minion m in this.ownMinions)
  955. {
  956. places[i] = 0;
  957. tempval = m.Angr * 2 + m.maxHp;
  958. if (m.taunt)
  959. {
  960. tempval += 6;
  961. tempval += m.maxHp;
  962. }
  963. if (!m.silenced)
  964. {
  965. if (m.handcard.card.specialMin == CardDB.specialMinions.flametonguetotem) tempval += 90;
  966. if (m.handcard.card.specialMin == CardDB.specialMinions.raidleader) tempval += 10;
  967. if (m.handcard.card.specialMin == CardDB.specialMinions.grimscaleoracle) tempval += 10;
  968. if (m.handcard.card.specialMin == CardDB.specialMinions.direwolfalpha) tempval += 90;
  969. if (m.handcard.card.specialMin == CardDB.specialMinions.murlocwarleader) tempval += 10;
  970. if (m.handcard.card.specialMin == CardDB.specialMinions.southseacaptain) tempval += 10;
  971. if (m.handcard.card.specialMin == CardDB.specialMinions.stormwindchampion) tempval += 10;
  972. if (m.handcard.card.specialMin == CardDB.specialMinions.timberwolf) tempval += 10;
  973. if (m.handcard.card.specialMin == CardDB.specialMinions.leokk) tempval += 10;
  974. if (m.handcard.card.specialMin == CardDB.specialMinions.northshirecleric) tempval += 10;
  975. if (m.handcard.card.specialMin == CardDB.specialMinions.sorcerersapprentice) tempval += 10;
  976. if (m.handcard.card.specialMin == CardDB.specialMinions.pintsizedsummoner) tempval += 10;
  977. if (m.handcard.card.specialMin == CardDB.specialMinions.summoningportal) tempval += 10;
  978. if (m.handcard.card.specialMin == CardDB.specialMinions.scavenginghyena) tempval += 10;
  979. if (m.handcard.card.specialMin == CardDB.specialMinions.faeriedragon) tempval += 40;
  980. if (m.stealth) tempval += 40;
  981. }
  982. places[i] = tempval;
  983. i++;
  984. }
  985. //bigminion if >=10
  986. int bestplace = 0;
  987. int bestvale = 0;
  988. tempval=0;
  989. i=0;
  990. for (int j = 0; j <= this.ownMinions.Count; j++ )
  991. {
  992. int prev = cardvalue;
  993. int next = cardvalue;
  994. if (i >= 1) prev = places[i - 1];
  995. if (i < this.ownMinions.Count) next = places[i];
  996. if (cardvalue >= prev && cardvalue >= next)
  997. {
  998. tempval = 2 * cardvalue - prev - next;
  999. if (tempval > bestvale)
  1000. {
  1001. bestplace = i;
  1002. bestvale = tempval;
  1003. }
  1004. }
  1005. if (cardvalue <= prev && cardvalue <= next)
  1006. {
  1007. tempval = -2 * cardvalue + prev + next;
  1008. if (tempval > bestvale)
  1009. {
  1010. bestplace = i ;
  1011. bestvale = tempval;
  1012. }
  1013. }
  1014. i++;
  1015. }
  1016. return bestplace;
  1017. }
  1018. public int getBestPlacePrint(CardDB.Card card)
  1019. {
  1020. if (card.type != CardDB.cardtype.MOB) return 0;
  1021. if (this.ownMinions.Count == 0) return 0;
  1022. if (this.ownMinions.Count == 1) return 1;
  1023. int[] places = new int[this.ownMinions.Count];
  1024. int i = 0;
  1025. int tempval = 0;
  1026. if (card.name == "sunfuryprotector" || card.name == "defenderofargus") // bestplace, if right and left minions have no taunt + lots of hp, dont make priority-minions to taunt
  1027. {
  1028. i = 0;
  1029. foreach (Minion m in this.ownMinions)
  1030. {
  1031. places[i] = 0;
  1032. tempval = 0;
  1033. if (!m.taunt)
  1034. {
  1035. tempval -= m.Hp;
  1036. }
  1037. else
  1038. {
  1039. tempval = 30;
  1040. }
  1041. if (m.name == "flametonguetotem") tempval += 50;
  1042. if (m.name == "raidleader") tempval += 10;
  1043. if (m.name == "grimscaleoracle") tempval += 10;
  1044. if (m.name == "direwolfalpha") tempval += 50;
  1045. if (m.name == "murlocwarleader") tempval += 10;
  1046. if (m.name == "southseacaptain") tempval += 10;
  1047. if (m.name == "stormwindchampion") tempval += 10;
  1048. if (m.name == "timberwolf") tempval += 10;
  1049. if (m.name == "leokk") tempval += 10;
  1050. if (m.name == "northshirecleric") tempval += 10;
  1051. if (m.name == "sorcerersapprentice") tempval += 10;
  1052. if (m.name == "pint-sizedsummoner") tempval += 10;
  1053. if (m.name == "summoningportal") tempval += 10;
  1054. if (m.name == "scavenginghyena") tempval += 10;
  1055. places[i] = tempval;
  1056. i++;
  1057. }
  1058. i = 0;
  1059. int bestpl = 7;
  1060. int bestval = 10000;
  1061. foreach (Minion m in this.ownMinions)
  1062. {
  1063. Helpfunctions.Instance.logg(places[i] + "");
  1064. int prev = 0;
  1065. int next = 0;
  1066. if (i >= 1) prev = places[i - 1];
  1067. next = places[i];
  1068. if (bestval > prev + next)
  1069. {
  1070. bestval = prev + next;
  1071. bestpl = i ;
  1072. }
  1073. i++;
  1074. }
  1075. return bestpl;
  1076. }
  1077. // normal placement
  1078. int cardvalue = card.Attack * 2 + card.Health;
  1079. if (card.tank)
  1080. {
  1081. cardvalue += 5;
  1082. cardvalue += card.Health;
  1083. }
  1084. if (card.name == "flametonguetotem") cardvalue += 50;
  1085. if (card.name == "raidleader") cardvalue += 10;
  1086. if (card.name == "grimscaleoracle") cardvalue += 10;
  1087. if (card.name == "direwolfalpha") cardvalue += 50;
  1088. if (card.name == "murlocwarleader") cardvalue += 10;
  1089. if (card.name == "southseacaptain") cardvalue += 10;
  1090. if (card.name == "stormwindchampion") cardvalue += 10;
  1091. if (card.name == "timberwolf") cardvalue += 10;
  1092. if (card.name == "leokk") cardvalue += 10;
  1093. if (card.name == "northshirecleric") cardvalue += 10;
  1094. if (card.name == "sorcerersapprentice") cardvalue += 10;
  1095. if (card.name == "pint-sizedsummoner") cardvalue += 10;
  1096. if (card.name == "summoningportal") cardvalue += 10;
  1097. if (card.name == "scavenginghyena") cardvalue += 10;
  1098. cardvalue += 1;
  1099. i = 0;
  1100. foreach (Minion m in this.ownMinions)
  1101. {
  1102. places[i] = 0;
  1103. tempval = m.Angr * 2 + m.maxHp;
  1104. if (m.taunt)
  1105. {
  1106. tempval += 6;
  1107. tempval += m.maxHp;
  1108. }
  1109. if (m.name == "flametonguetotem") tempval += 50;
  1110. if (m.name == "raidleader") tempval += 10;
  1111. if (m.name == "grimscaleoracle") tempval += 10;
  1112. if (m.name == "direwolfalpha") tempval += 50;
  1113. if (m.name == "murlocwarleader") tempval += 10;
  1114. if (m.name == "southseacaptain") tempval += 10;
  1115. if (m.name == "stormwindchampion") tempval += 10;
  1116. if (m.name == "timberwolf") tempval += 10;
  1117. if (m.name == "leokk") tempval += 10;
  1118. if (m.name == "northshirecleric") tempval += 10;
  1119. if (m.name == "sorcerersapprentice") tempval += 10;
  1120. if (m.name == "pint-sizedsummoner") tempval += 10;
  1121. if (m.name == "summoningportal") tempval += 10;
  1122. if (m.name == "scavenginghyena") tempval += 10;
  1123. places[i] = tempval;
  1124. Helpfunctions.Instance.logg(places[i] + "");
  1125. i++;
  1126. }
  1127. //bigminion if >=10
  1128. int bestplace = 0;
  1129. int bestvale = 0;
  1130. tempval = 0;
  1131. i = 0;
  1132. Helpfunctions.Instance.logg(cardvalue + " (own)");
  1133. i = 0;
  1134. for (int j = 0; j <= this.ownMinions.Count; j++)
  1135. {
  1136. int prev = cardvalue;
  1137. int next = cardvalue;
  1138. if (i >= 1) prev = places[i - 1];
  1139. if (i < this.ownMinions.Count)
  1140. {
  1141. next = places[i];
  1142. }
  1143. if (cardvalue >= prev && cardvalue >= next)
  1144. {
  1145. tempval = 2 * cardvalue - prev - next;
  1146. if (tempval > bestvale)
  1147. {
  1148. bestplace = i ;
  1149. bestvale = tempval;
  1150. }
  1151. }
  1152. if (cardvalue <= prev && cardvalue <= next)
  1153. {
  1154. tempval = -2 * cardvalue + prev + next;
  1155. if (tempval > bestvale)
  1156. {
  1157. bestplace = i;
  1158. bestvale = tempval;
  1159. }
  1160. }
  1161. i++;
  1162. }
  1163. Helpfunctions.Instance.logg(bestplace + " (best)");
  1164. return bestplace;
  1165. }
  1166. private void endEnemyTurn()
  1167. {
  1168. endTurnEffect(false);//own turn ends
  1169. endTurnBuffs(false);//end enemy turn
  1170. startTurnEffect(true);//start your turn
  1171. this.complete = true;
  1172. //Ai.Instance.botBase.getPlayfieldValue(this);
  1173. }
  1174. public void endTurn()
  1175. {
  1176. this.value = int.MinValue;
  1177. //penalty for destroying combo
  1178. this.evaluatePenality += ComboBreaker.Instance.checkIfComboWasPlayed(this.playactions, this.ownWeaponName);
  1179. if (this.complete) return;
  1180. endTurnEffect(true);//own turn ends
  1181. endTurnBuffs(true);//end own buffs
  1182. startTurnEffect(false);//enemy turn begins
  1183. simulateTraps();
  1184. if (!sEnemTurn)
  1185. {
  1186. guessHeroDamage();
  1187. endTurnEffect(false);//own turn ends
  1188. endTurnBuffs(false);//end enemy turn
  1189. startTurnEffect(true);//start your turn
  1190. this.complete = true;
  1191. }
  1192. else
  1193. {
  1194. guessHeroDamage();
  1195. simulateEnemysTurn();
  1196. this.complete = true;
  1197. }
  1198. }
  1199. private void guessHeroDamage()
  1200. {
  1201. int ghd = 0;
  1202. foreach (Minion m in this.enemyMinions)
  1203. {
  1204. if (m.frozen) continue;
  1205. ghd += m.Angr;
  1206. if (m.windfury) ghd += m.Angr;
  1207. }
  1208. if (this.enemyHeroName == HeroEnum.druid) ghd++;
  1209. if (this.enemyHeroName == HeroEnum.mage) ghd++;
  1210. if (this.enemyHeroName == HeroEnum.thief) ghd++;
  1211. if (this.enemyHeroName == HeroEnum.hunter) ghd += 2;
  1212. ghd += enemyWeaponAttack;
  1213. foreach (Minion m in this.ownMinions)
  1214. {
  1215. if (m.frozen) continue;
  1216. if (m.taunt) ghd -= m.Hp;
  1217. if (m.taunt && m.divineshild) ghd -= 1;
  1218. }
  1219. int guessingHeroDamage = Math.Max(0, ghd);
  1220. this.guessingHeroHP = this.ownHeroHp + this.ownHeroDefence - guessingHeroDamage;
  1221. }
  1222. private void simulateTraps()
  1223. {
  1224. // DONT KILL ENEMY HERO (cause its only guessing)
  1225. foreach (string secretID in this.ownSecretsIDList)
  1226. {
  1227. //hunter secrets############
  1228. if (secretID == "EX1_554") //snaketrap
  1229. {
  1230. //call 3 snakes (if possible)
  1231. int posi = this.ownMinions.Count - 1;
  1232. CardDB.Card kid = CardDB.Instance.getCardData("snake");
  1233. callKid(kid, posi, true);
  1234. callKid(kid, posi, true);
  1235. callKid(kid, posi, true);
  1236. }
  1237. if (secretID == "EX1_609") //snipe
  1238. {
  1239. //kill weakest minion of enemy
  1240. List<Minion> temp = new List<Minion>(this.enemyMinions);
  1241. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  1242. if (temp.Count == 0) continue;
  1243. Minion m = temp[0];
  1244. minionGetDamagedOrHealed(m, 4, 0, false);
  1245. }
  1246. if (secretID == "EX1_610") //explosive trap
  1247. {
  1248. //take 2 damage to each enemy
  1249. List<Minion> temp = new List<Minion>(this.enemyMinions);
  1250. foreach (Minion m in temp)
  1251. {
  1252. minionGetDamagedOrHealed(m, 2, 0,false);
  1253. }
  1254. attackEnemyHeroWithoutKill(2);
  1255. }
  1256. if (secretID == "EX1_611") //freezing trap
  1257. {
  1258. //return weakest enemy minion to hand
  1259. List<Minion> temp = new List<Minion>(this.enemyMinions);
  1260. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  1261. if (temp.Count == 0) continue;
  1262. Minion m = temp[0];
  1263. minionReturnToHand(m, false,0);
  1264. }
  1265. if (secretID == "EX1_533") // missdirection
  1266. {
  1267. // first damage to your hero is nulled -> lower guessingHeroDamage
  1268. List<Minion> temp = new List<Minion>(this.enemyMinions);
  1269. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  1270. if (temp.Count == 0) continue;
  1271. Minion m = temp[0];
  1272. m.Angr = 0;
  1273. this.evaluatePenality -= this.enemyMinions.Count;// the more the enemy minions has on board, the more the posibility to destroy something other :D
  1274. }
  1275. //mage secrets############
  1276. if (secretID == "EX1_287") //counterspell
  1277. {
  1278. // what should we do?
  1279. this.evaluatePenality -= 8;
  1280. }
  1281. if (secretID == "EX1_289") //ice barrier
  1282. {
  1283. this.ownHeroDefence += 8;
  1284. }
  1285. if (secretID == "EX1_295") //ice barrier
  1286. {
  1287. //set the guessed Damage to zero
  1288. foreach (Minion m in this.enemyMinions)
  1289. {
  1290. m.Angr = 0;
  1291. }
  1292. }
  1293. if (secretID == "EX1_294") //mirror entity
  1294. {
  1295. //summon snake ( a weak minion)
  1296. int posi = this.ownMinions.Count - 1;
  1297. CardDB.Card kid = CardDB.Instance.getCardData("snake");
  1298. callKid(kid, posi, true);
  1299. }
  1300. if (secretID == "tt_010") //spellbender
  1301. {
  1302. //whut???
  1303. // add 2 to your defence (most attack-buffs give +2, lots of damage spells too)
  1304. this.evaluatePenality -= 4;
  1305. }
  1306. if (secretID == "EX1_594") // vaporize
  1307. {
  1308. // first damage to your hero is nulled -> lower guessingHeroDamage and destroy weakest minion
  1309. List<Minion> temp = new List<Minion>(this.enemyMinions);
  1310. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  1311. if (temp.Count == 0) continue;
  1312. Minion m = temp[0];
  1313. minionGetDestroyed(m, false);
  1314. }
  1315. if (secretID == "EX1_duplicate") // duplicate
  1316. {
  1317. // first damage to your hero is nulled -> lower guessingHeroDamage and destroy weakest minion
  1318. List<Minion> temp = new List<Minion>(this.ownMinions);
  1319. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  1320. if (temp.Count == 0) continue;
  1321. Minion m = temp[0];
  1322. drawACard(m.name, true);
  1323. drawACard(m.name, true);
  1324. }
  1325. //pala secrets############
  1326. if (secretID == "EX1_132") // eye for an eye
  1327. {
  1328. // enemy takes one damage
  1329. List<Minion> temp = new List<Minion>(this.enemyMinions);
  1330. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  1331. if (temp.Count == 0) continue;
  1332. Minion m = temp[0];
  1333. attackEnemyHeroWithoutKill(m.Angr);
  1334. }
  1335. if (secretID == "EX1_130") // noble sacrifice
  1336. {
  1337. //spawn a 2/1 taunt!
  1338. int posi = this.ownMinions.Count - 1;
  1339. CardDB.Card kid = CardDB.Instance.getCardData("frostwolfgrunt");
  1340. callKid(kid, posi, true);
  1341. this.ownMinions[this.ownMinions.Count - 1].maxHp = 1;
  1342. this.ownMinions[this.ownMinions.Count - 1].Hp = 1;
  1343. }
  1344. if (secretID == "EX1_136") // redemption
  1345. {
  1346. // we give our weakest minion a divine shield :D
  1347. List<Minion> temp = new List<Minion>(this.ownMinions);
  1348. temp.Sort((a, b) => a.Hp.CompareTo(b.Hp));//take the weakest
  1349. if (temp.Count == 0) continue;
  1350. foreach (Minion m in temp)
  1351. {
  1352. if (m.divineshild) continue;
  1353. m.divineshild = true;
  1354. break;
  1355. }
  1356. }
  1357. if (secretID == "EX1_379") // repentance
  1358. {
  1359. // set his current lowest hp minion to x/1
  1360. List<Minion> temp = new List<Minion>(this.enemyMinions);
  1361. temp.Sort((a, b) => a.Hp.CompareTo(b.Hp));//take the weakest
  1362. if (temp.Count == 0) continue;
  1363. Minion m = temp[0];
  1364. m.Hp = 1;
  1365. m.maxHp = 1;
  1366. }
  1367. if (secretID == "EX1_Avenge") // avenge
  1368. {
  1369. // we give our weakest minion +3/+2 :D
  1370. List<Minion> temp = new List<Minion>(this.ownMinions);
  1371. temp.Sort((a, b) => a.Hp.CompareTo(b.Hp));//take the weakest
  1372. if (temp.Count == 0) continue;
  1373. foreach (Minion m in temp)
  1374. {
  1375. minionGetBuffed(m, 3, 2, true);
  1376. break;
  1377. }
  1378. }
  1379. }
  1380. }
  1381. private void endTurnBuffs(bool own)
  1382. {
  1383. List<Minion> temp = new List<Minion>();
  1384. if (own)
  1385. {
  1386. temp.AddRange(this.ownMinions);
  1387. }
  1388. else
  1389. {
  1390. temp.AddRange(this.enemyMinions);
  1391. }
  1392. // end buffs
  1393. foreach (Minion m in temp)
  1394. {
  1395. m.cantLowerHPbelowONE = false;
  1396. m.immune = false;
  1397. List<Enchantment> tempench = new List<Enchantment>(m.enchantments);
  1398. foreach (Enchantment e in tempench)
  1399. {
  1400. if (e.CARDID == "EX1_316e")//ueberwaeltigende macht
  1401. {
  1402. minionGetDestroyed(m, own);
  1403. }
  1404. if (e.CARDID == "CS2_046e")//kampfrausch
  1405. {
  1406. debuff(m, e,own);
  1407. }
  1408. if (e.CARDID == "CS2_045e")// waffe felsbeiser
  1409. {
  1410. debuff(m, e, own);
  1411. }
  1412. if (e.CARDID == "EX1_046e")// dunkeleisenzwerg
  1413. {
  1414. debuff(m, e, own);
  1415. }
  1416. if (e.CARDID == "CS2_188o")// ruchloserunteroffizier
  1417. {
  1418. debuff(m, e, own);
  1419. }
  1420. if (e.CARDID == "EX1_055o")// manasuechtige
  1421. {
  1422. debuff(m, e, own);
  1423. }
  1424. if (e.CARDID == "EX1_549o")//zorn des wildtiers
  1425. {
  1426. debuff(m, e, own);
  1427. }
  1428. if (e.CARDID == "EX1_334e")// dunkler wahnsin (control minion till end of turn)
  1429. {
  1430. //"uncontrol minion"
  1431. minionGetControlled(m, !own, true);
  1432. }
  1433. }
  1434. }
  1435. temp.Clear();
  1436. if (own)
  1437. {
  1438. temp.AddRange(this.enemyMinions);
  1439. }
  1440. else
  1441. {
  1442. temp.AddRange(this.ownMinions);
  1443. }
  1444. foreach (Minion m in temp)
  1445. {
  1446. m.cantLowerHPbelowONE = false;
  1447. m.immune = false;
  1448. List<Enchantment> tempench = new List<Enchantment>(m.enchantments);
  1449. foreach (Enchantment e in tempench)
  1450. {
  1451. if (e.CARDID == "EX1_046e")// dunkeleisenzwerg
  1452. {
  1453. debuff(m, e,!own);
  1454. }
  1455. if (e.CARDID == "CS2_188o")// ruchloserunteroffizier
  1456. {
  1457. debuff(m, e, !own);
  1458. }
  1459. if (e.CARDID == "EX1_549o")//zorn des wildtiers
  1460. {
  1461. debuff(m, e, !own);
  1462. }
  1463. }
  1464. }
  1465. }
  1466. private void endTurnEffect(bool own)
  1467. {
  1468. List<Minion> temp = new List<Minion>();
  1469. List<Minion> ownmins = new List<Minion>();
  1470. List<Minion> enemymins = new List<Minion>();
  1471. if (own)
  1472. {
  1473. temp.AddRange(this.ownMinions);
  1474. ownmins.AddRange(this.ownMinions);
  1475. enemymins.AddRange(this.enemyMinions);
  1476. }
  1477. else
  1478. {
  1479. temp.AddRange(this.enemyMinions);
  1480. ownmins.AddRange(this.enemyMinions);
  1481. enemymins.AddRange(this.ownMinions);
  1482. }
  1483. foreach (Minion m in temp)
  1484. {
  1485. if (m.silenced) continue;
  1486. if (m.name == "barongeddon") // all other chards get dmg get 2 dmg
  1487. {
  1488. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  1489. foreach (Minion mm in temp2)
  1490. {
  1491. if (mm.entitiyID != m.entitiyID)
  1492. {
  1493. minionGetDamagedOrHealed(mm, 2, 0, true);
  1494. }
  1495. }
  1496. temp2.Clear();
  1497. temp2.AddRange(this.enemyMinions);
  1498. foreach (Minion mm in temp2)
  1499. {
  1500. if (mm.entitiyID != m.entitiyID)
  1501. {
  1502. minionGetDamagedOrHealed(mm, 2, 0, false);
  1503. }
  1504. }
  1505. attackOrHealHero(2, true);
  1506. attackOrHealHero(2, false);
  1507. }
  1508. if (m.name == "bloodimp" || m.name == "youngpriestess") // buff a minion
  1509. {
  1510. List<Minion> temp2 = new List<Minion>(ownmins);
  1511. temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));//buff the weakest
  1512. foreach (Minion mins in Helpfunctions.TakeList(temp2, 1))
  1513. {
  1514. minionGetBuffed(mins, 0, 1, own);
  1515. }
  1516. }
  1517. if (m.name == "masterswordsmith") // buff a minion
  1518. {
  1519. List<Minion> temp2 = new List<Minion>(ownmins);
  1520. temp2.Sort((a, b) => a.Angr.CompareTo(b.Angr));//buff the weakest
  1521. foreach (Minion mins in Helpfunctions.TakeList(temp2, 1))
  1522. {
  1523. minionGetBuffed(mins, 1, 0, own);
  1524. }
  1525. }
  1526. if (m.name == "emboldener3000") // buff a minion
  1527. {
  1528. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  1529. temp2.Sort((a, b) => -a.Angr.CompareTo(b.Angr));//buff the strongest enemy
  1530. foreach (Minion mins in Helpfunctions.TakeList(temp2, 1))
  1531. {
  1532. minionGetBuffed(mins, 1, 0, false);//buff alyways enemy :D
  1533. }
  1534. }
  1535. if (m.name == "gruul") // gain +1/+1
  1536. {
  1537. minionGetBuffed(m, 1, 1, own);
  1538. }
  1539. if (m.name == "etherealarcanist") // gain +2/+2
  1540. {
  1541. if (own && this.ownSecretsIDList.Count>=1)
  1542. {
  1543. minionGetBuffed(m, 2, 2, own);
  1544. }
  1545. if (!own && this.enemySecretCount >= 1)
  1546. {
  1547. minionGetBuffed(m, 2, 2, own);
  1548. }
  1549. }
  1550. if (m.name == "manatidetotem") // draw card
  1551. {
  1552. if (own)
  1553. {
  1554. //this.owncarddraw++;
  1555. this.drawACard("", own);
  1556. }
  1557. else
  1558. {
  1559. //this.enemycarddraw++;
  1560. this.drawACard("", own);
  1561. }
  1562. }
  1563. if (m.name == "healingtotem") // heal
  1564. {
  1565. List<Minion> temp2 = new List<Minion>(ownmins);
  1566. foreach (Minion mins in temp2)
  1567. {
  1568. minionGetDamagedOrHealed(mins, 0, 1, own);
  1569. }
  1570. }
  1571. if (m.name == "hogger") // summon
  1572. {
  1573. int posi = m.id;
  1574. CardDB.Card kid = CardDB.Instance.getCardData("gnoll");
  1575. callKid(kid, posi, own);
  1576. }
  1577. if (m.name == "impmaster") // damage itself and summon
  1578. {
  1579. int posi = m.id;
  1580. if (m.Hp == 1) posi--;
  1581. minionGetDamagedOrHealed(m, 1, 0, own);
  1582. CardDB.Card kid = CardDB.Instance.getCardData("imp");
  1583. callKid(kid, posi, own);
  1584. }
  1585. if (m.name == "natpagle") // draw card
  1586. {
  1587. if (own)
  1588. {
  1589. //this.owncarddraw++;
  1590. this.drawACard("",own);
  1591. }
  1592. else
  1593. {
  1594. //this.enemycarddraw++;
  1595. this.drawACard("", own);
  1596. }
  1597. }
  1598. if (m.name == "ragnarosthefirelord") // summon
  1599. {
  1600. if (this.enemyMinions.Count >= 1)
  1601. {
  1602. List<Minion> temp2 = new List<Minion>(enemymins);
  1603. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));//damage the stronges
  1604. foreach (Minion mins in Helpfunctions.TakeList(temp2, 1))
  1605. {
  1606. minionGetDamagedOrHealed(mins, 8, 0, !own);
  1607. }
  1608. }
  1609. else
  1610. {
  1611. attackOrHealHero(8, !own);
  1612. }
  1613. }
  1614. if (m.name == "repairbot") // heal damaged char
  1615. {
  1616. attackOrHealHero(-6, false);
  1617. }
  1618. if (m.handcard.card.CardID == "EX1_tk9") //treant which is destroyed
  1619. {
  1620. minionGetDestroyed(m, own);
  1621. }
  1622. if (m.name == "ysera") // draw card
  1623. {
  1624. if (own)
  1625. {
  1626. //this.owncarddraw++;
  1627. this.drawACard("yseraawakens",own);
  1628. }
  1629. else
  1630. {
  1631. //this.enemycarddraw++;
  1632. this.drawACard("yseraawakens", own);
  1633. }
  1634. }
  1635. }
  1636. }
  1637. private void startTurnEffect(bool own)
  1638. {
  1639. List<Minion> temp = new List<Minion>();
  1640. List<Minion> ownmins = new List<Minion>();
  1641. List<Minion> enemymins = new List<Minion>();
  1642. if (own)
  1643. {
  1644. temp.AddRange(this.ownMinions);
  1645. ownmins.AddRange(this.ownMinions);
  1646. enemymins.AddRange(this.enemyMinions);
  1647. }
  1648. else
  1649. {
  1650. temp.AddRange(this.enemyMinions);
  1651. ownmins.AddRange(this.enemyMinions);
  1652. enemymins.AddRange(this.ownMinions);
  1653. }
  1654. bool untergang=false;
  1655. foreach (Minion m in temp)
  1656. {
  1657. if (m.silenced) continue;
  1658. if (m.name == "demolisher") // deal 2 dmg
  1659. {
  1660. List<Minion> temp2 = new List<Minion>(enemymins);
  1661. foreach (Minion mins in temp2)
  1662. {
  1663. minionGetDamagedOrHealed(mins, 2, 0, !own);
  1664. }
  1665. }
  1666. if (m.name == "shadeofnaxxramas") // buff itself
  1667. {
  1668. minionGetBuffed(m, 1, 1, own);
  1669. }
  1670. if (m.name == "doomsayer") // destroy
  1671. {
  1672. untergang = true;
  1673. }
  1674. if (m.name == "homingchicken") // ok
  1675. {
  1676. minionGetDestroyed(m, own);
  1677. if (own)
  1678. {
  1679. //this.owncarddraw += 3;
  1680. this.drawACard("",own);
  1681. this.drawACard("", own);
  1682. this.drawACard("", own);
  1683. }
  1684. else
  1685. {
  1686. //this.enemycarddraw += 3 ;
  1687. this.drawACard("", own);
  1688. this.drawACard("", own);
  1689. this.drawACard("", own);
  1690. }
  1691. }
  1692. if (m.name == "lightwell") // heal
  1693. {
  1694. if (ownmins.Count >= 1)
  1695. {
  1696. List<Minion> temp2 = new List<Minion>(ownmins);
  1697. bool healed = false;
  1698. foreach (Minion mins in temp2)
  1699. {
  1700. if (mins.wounded)
  1701. {
  1702. minionGetDamagedOrHealed(mins, 0, 3, own);
  1703. healed = true;
  1704. break;
  1705. }
  1706. }
  1707. if (!healed) attackOrHealHero(-3, own);
  1708. }
  1709. else
  1710. {
  1711. attackOrHealHero(-3, own);
  1712. }
  1713. }
  1714. if (m.name == "poultryizer") //
  1715. {
  1716. if (own)
  1717. {
  1718. if (this.enemyMinions.Count >= 1)
  1719. {
  1720. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  1721. temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));//damage the lowest
  1722. foreach (Minion mins in temp2)
  1723. {
  1724. CardDB.Card c = CardDB.Instance.getCardDataFromID("Mekka4t");
  1725. minionTransform(mins, c, false);
  1726. break;
  1727. }
  1728. }
  1729. else
  1730. {
  1731. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  1732. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));//damage the stronges
  1733. foreach (Minion mins in temp2)
  1734. {
  1735. CardDB.Card c = CardDB.Instance.getCardDataFromID("Mekka4t");
  1736. minionTransform(mins, c, true);
  1737. break;
  1738. }
  1739. }
  1740. }
  1741. else
  1742. {
  1743. if (this.ownMinions.Count >= 1)
  1744. {
  1745. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  1746. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));//damage the stronges
  1747. foreach (Minion mins in temp2)
  1748. {
  1749. CardDB.Card c = CardDB.Instance.getCardDataFromID("Mekka4t");
  1750. minionTransform(mins, c, true);
  1751. break;
  1752. }
  1753. }
  1754. }
  1755. }
  1756. if (m.name == "alarm-o-bot") //
  1757. {
  1758. if (own)
  1759. {
  1760. List<Handmanager.Handcard> temp2 = new List<Handmanager.Handcard>();
  1761. foreach (Handmanager.Handcard hc in this.owncards)
  1762. {
  1763. if (hc.card.type == CardDB.cardtype.MOB) temp2.Add(hc);
  1764. }
  1765. temp2.Sort((a, b) => -a.card.Attack.CompareTo(b.card.Attack));//damage the stronges
  1766. foreach (Handmanager.Handcard mins in temp2)
  1767. {
  1768. CardDB.Card c = CardDB.Instance.getCardDataFromID(mins.card.CardID);
  1769. minionTransform(m, c, true);
  1770. this.removeCard(mins);
  1771. this.drawACard("alarm-o-bot", true);
  1772. break;
  1773. }
  1774. }
  1775. else
  1776. {
  1777. minionGetBuffed(m, 4, 0, false);
  1778. }
  1779. }
  1780. }
  1781. foreach (Minion m in enemymins) // search for corruption in other minions
  1782. {
  1783. List<Enchantment> elist = new List<Enchantment>(m.enchantments);
  1784. foreach (Enchantment e in elist)
  1785. {
  1786. if (e.CARDID == "CS2_063e")//corruption
  1787. {
  1788. if (own && e.controllerOfCreator == this.ownController) // own turn + we owner of curruption
  1789. {
  1790. minionGetDestroyed(m, false);
  1791. }
  1792. if (!own && e.controllerOfCreator != this.ownController)
  1793. {
  1794. minionGetDestroyed(m, true);
  1795. }
  1796. }
  1797. }
  1798. }
  1799. if (untergang)
  1800. {
  1801. foreach (Minion mins in ownmins)
  1802. {
  1803. minionGetDestroyed(mins, own);
  1804. }
  1805. foreach (Minion mins in enemymins)
  1806. {
  1807. minionGetDestroyed(mins, !own);
  1808. }
  1809. }
  1810. this.drawACard("", own);
  1811. }
  1812. private int getSpellDamageDamage(int dmg)
  1813. {
  1814. int retval = dmg;
  1815. retval += this.spellpower;
  1816. if (this.doublepriest >= 1) retval *= (2 * this.doublepriest);
  1817. return retval;
  1818. }
  1819. private int getSpellHeal(int heal)
  1820. {
  1821. int retval = heal;
  1822. retval += this.spellpower;
  1823. if (this.auchenaiseelenpriesterin) retval *= -1;
  1824. if (this.doublepriest >= 1) retval *= (2 * this.doublepriest);
  1825. return retval;
  1826. }
  1827. private void attackEnemyHeroWithoutKill(int dmg)
  1828. {
  1829. if (this.enemyHeroImmune && dmg > 0) return;
  1830. int oldHp = this.enemyHeroHp;
  1831. if (dmg < 0 && this.enemyHeroHp <= 0) return;
  1832. if (this.enemyHeroDefence <= 0)
  1833. {
  1834. this.enemyHeroHp = Math.Min(30, this.enemyHeroHp - dmg);
  1835. }
  1836. else
  1837. {
  1838. if (this.enemyHeroDefence > 0)
  1839. {
  1840. int rest = enemyHeroDefence - dmg;
  1841. if (rest < 0)
  1842. {
  1843. this.enemyHeroHp += rest;
  1844. }
  1845. this.enemyHeroDefence = Math.Max(0, this.enemyHeroDefence - dmg);
  1846. }
  1847. }
  1848. if (oldHp >= 1 && this.enemyHeroHp == 0) this.enemyHeroHp = 1;
  1849. }
  1850. private void attackOrHealHero(int dmg, bool own) // negative damage is heal
  1851. {
  1852. if (own)
  1853. {
  1854. if (this.heroImmune && dmg > 0) return;
  1855. if (dmg < 0 || this.ownHeroDefence <= 0)
  1856. {
  1857. if (dmg < 0 && this.ownHeroHp <= 0) return;
  1858. //heal
  1859. int copy = this.ownHeroHp;
  1860. if (dmg < 0 && this.ownHeroHp - dmg > 30) this.lostHeal += this.ownHeroHp - dmg - 30;
  1861. this.ownHeroHp = Math.Min(30, this.ownHeroHp - dmg);
  1862. if (copy < this.ownHeroHp)
  1863. {
  1864. triggerAHeroGetHealed(own);
  1865. }
  1866. }
  1867. else
  1868. {
  1869. if (this.ownHeroDefence > 0 && dmg > 0)
  1870. {
  1871. int rest = this.ownHeroDefence - dmg;
  1872. if (rest < 0)
  1873. {
  1874. this.ownHeroHp += rest;
  1875. }
  1876. this.ownHeroDefence = Math.Max(0, this.ownHeroDefence - dmg);
  1877. }
  1878. }
  1879. }
  1880. else
  1881. {
  1882. if (this.enemyHeroImmune && dmg > 0) return;
  1883. if (dmg < 0 || this.enemyHeroDefence <= 0)
  1884. {
  1885. if (dmg < 0 && this.enemyHeroHp <= 0) return;
  1886. int copy = this.enemyHeroHp;
  1887. if (dmg < 0 && this.enemyHeroHp - dmg > 30) this.lostHeal += this.enemyHeroHp - dmg - 30;
  1888. this.enemyHeroHp = Math.Min(30, this.enemyHeroHp - dmg);
  1889. if (copy < this.enemyHeroHp)
  1890. {
  1891. triggerAHeroGetHealed(own);
  1892. }
  1893. }
  1894. else
  1895. {
  1896. if (this.enemyHeroDefence > 0 && dmg > 0)
  1897. {
  1898. int rest = enemyHeroDefence - dmg;
  1899. if (rest < 0)
  1900. {
  1901. this.enemyHeroHp += rest;
  1902. }
  1903. this.enemyHeroDefence = Math.Max(0, this.enemyHeroDefence - dmg);
  1904. }
  1905. }
  1906. }
  1907. }
  1908. private void debuff(Minion m, Enchantment e, bool own)
  1909. {
  1910. int anz = m.enchantments.RemoveAll(x => x.creator == e.creator && x.CARDID == e.CARDID);
  1911. if (anz >= 1)
  1912. {
  1913. for (int i = 0; i < anz; i++)
  1914. {
  1915. if (e.charge && !m.handcard.card.Charge && m.enchantments.FindAll(x => x.charge == true).Count == 0)
  1916. {
  1917. m.charge = false;
  1918. }
  1919. if (e.taunt && !m.handcard.card.tank && m.enchantments.FindAll(x => x.taunt == true).Count == 0)
  1920. {
  1921. m.taunt = false;
  1922. }
  1923. if (e.divineshild && m.enchantments.FindAll(x => x.divineshild == true).Count == 0)
  1924. {
  1925. m.divineshild = false;
  1926. }
  1927. if (e.windfury && !m.handcard.card.windfury && m.enchantments.FindAll(x => x.windfury == true).Count == 0)
  1928. {
  1929. m.divineshild = false;
  1930. }
  1931. if (e.imune && m.enchantments.FindAll(x => x.imune == true).Count == 0)
  1932. {
  1933. m.immune = false;
  1934. }
  1935. minionGetBuffed(m, -e.angrbuff, -e.hpbuff,own);
  1936. }
  1937. }
  1938. }
  1939. private void deleteEffectOf(string CardID, int creator)
  1940. {
  1941. // deletes the effect of the cardID with creator from all minions
  1942. Enchantment e = CardDB.getEnchantmentFromCardID(CardID);
  1943. e.creator = creator;
  1944. List<Minion> temp = new List<Minion>(this.ownMinions);
  1945. foreach (Minion m in temp)
  1946. {
  1947. debuff(m, e,true);
  1948. }
  1949. temp.Clear();
  1950. temp.AddRange(this.enemyMinions);
  1951. foreach (Minion m in temp)
  1952. {
  1953. debuff(m, e,false);
  1954. }
  1955. }
  1956. private void deleteEffectOfWithExceptions(string CardID, int creator, List<int> exeptions)
  1957. {
  1958. // deletes the effect of the cardID with creator from all minions
  1959. Enchantment e = CardDB.getEnchantmentFromCardID(CardID);
  1960. e.creator = creator;
  1961. foreach (Minion m in this.ownMinions)
  1962. {
  1963. if (!exeptions.Contains(m.id))
  1964. {
  1965. debuff(m, e,true);
  1966. }
  1967. }
  1968. foreach (Minion m in this.enemyMinions)
  1969. {
  1970. if (!exeptions.Contains(m.id))
  1971. {
  1972. debuff(m, e,false);
  1973. }
  1974. }
  1975. }
  1976. private void addEffectToMinionNoDoubles(Minion m, Enchantment e, bool own)
  1977. {
  1978. foreach (Enchantment es in m.enchantments)
  1979. {
  1980. if ( es.CARDID == e.CARDID && es.creator == e.creator) return;
  1981. }
  1982. m.enchantments.Add(e);
  1983. if (e.angrbuff >= 1 || e.hpbuff >= 1)
  1984. {
  1985. minionGetBuffed(m, e.angrbuff, e.hpbuff, own);
  1986. }
  1987. if (e.charge) minionGetCharge(m);
  1988. if (e.divineshild) m.divineshild = true;
  1989. if (e.taunt) m.taunt = true;
  1990. if (e.windfury) minionGetWindfurry(m);
  1991. if (e.imune) m.immune = true;
  1992. }
  1993. private void adjacentBuffer(Minion m, string enchantment, int before, int after, bool own)
  1994. {
  1995. List<Minion> lm = new List<Minion>();
  1996. if (own)
  1997. {
  1998. lm.AddRange(this.ownMinions);
  1999. }
  2000. else
  2001. {
  2002. lm.AddRange(this.enemyMinions);
  2003. }
  2004. List<int> exeptions = new List<int>();
  2005. exeptions.Add(before);
  2006. exeptions.Add(after);
  2007. deleteEffectOfWithExceptions(enchantment, m.entitiyID, exeptions);
  2008. Enchantment e = CardDB.getEnchantmentFromCardID(enchantment);
  2009. e.creator = m.entitiyID;
  2010. e.controllerOfCreator = this.ownController;
  2011. if (before >= 0)
  2012. {
  2013. Minion bef = lm[before];
  2014. addEffectToMinionNoDoubles(bef, e, own);
  2015. }
  2016. if (after < lm.Count)
  2017. {
  2018. Minion bef = lm[after];
  2019. addEffectToMinionNoDoubles(bef, e, own);
  2020. }
  2021. }
  2022. private void adjacentBuffUpdate(bool own)
  2023. {
  2024. int before = -1;
  2025. int after = 1;
  2026. List<Minion> lm = new List<Minion>();
  2027. if (own)
  2028. {
  2029. lm.AddRange(this.ownMinions);
  2030. }
  2031. else
  2032. {
  2033. lm.AddRange(this.enemyMinions);
  2034. }
  2035. foreach (Minion m in lm)
  2036. {
  2037. /*
  2038. if (m.name == "direwolfalpha")
  2039. {
  2040. string enchantment = "EX1_162o";
  2041. //help.logg("buffupdate " + m.entitiyID);
  2042. adjacentBuffer(m, enchantment, before, after, own);
  2043. }
  2044. if (m.name == "flametonguetotem")
  2045. {
  2046. string enchantment = "EX1_565o";
  2047. adjacentBuffer(m, enchantment, before, after, own);
  2048. }
  2049. before++;
  2050. after++;
  2051. */
  2052. getNewEffects(m, own, m.id, false);
  2053. }
  2054. }
  2055. private void endEffectsDueToDeath(Minion m, bool own)
  2056. { // minion which grants effect died
  2057. if (m.handcard.card.specialMin == CardDB.specialMinions.raidleader) // if he dies, lower attack of all minions of his side
  2058. {
  2059. deleteEffectOf("CS2_122e", m.entitiyID);
  2060. }
  2061. if (m.handcard.card.specialMin == CardDB.specialMinions.grimscaleoracle)
  2062. {
  2063. deleteEffectOf("EX1_508o", m.entitiyID);
  2064. }
  2065. if (m.handcard.card.specialMin == CardDB.specialMinions.direwolfalpha)
  2066. {
  2067. deleteEffectOf("EX1_162o", m.entitiyID);
  2068. }
  2069. if (m.handcard.card.specialMin == CardDB.specialMinions.murlocwarleader)
  2070. {
  2071. deleteEffectOf("EX1_507e", m.entitiyID);
  2072. }
  2073. if (m.handcard.card.specialMin == CardDB.specialMinions.southseacaptain)
  2074. {
  2075. deleteEffectOf("NEW1_027e", m.entitiyID);
  2076. }
  2077. if (m.handcard.card.specialMin == CardDB.specialMinions.stormwindchampion)
  2078. {
  2079. deleteEffectOf("CS2_222o", m.entitiyID);
  2080. }
  2081. if (m.handcard.card.specialMin == CardDB.specialMinions.timberwolf)
  2082. {
  2083. deleteEffectOf("DS1_175o", m.entitiyID);
  2084. }
  2085. if (m.handcard.card.specialMin == CardDB.specialMinions.leokk)
  2086. {
  2087. deleteEffectOf("NEW1_033o", m.entitiyID);
  2088. }
  2089. //lowering truebaugederalte
  2090. foreach (Minion mnn in this.ownMinions)
  2091. {
  2092. if (mnn.handcard.card.specialMin == CardDB.specialMinions.oldmurkeye && m.handcard.card.race == 14)
  2093. {
  2094. minionGetBuffed(mnn, -1, 0, true);
  2095. }
  2096. }
  2097. foreach (Minion mnn in this.enemyMinions)
  2098. {
  2099. if (mnn.handcard.card.specialMin == CardDB.specialMinions.oldmurkeye && m.handcard.card.race == 14)
  2100. {
  2101. minionGetBuffed(mnn, -1, 0, false);
  2102. }
  2103. }
  2104. //no deathrattle, but lowering the weapon
  2105. if (m.handcard.card.specialMin == CardDB.specialMinions.spitefulsmith && m.wounded)// remove weapon changes form hasserfuelleschmiedin
  2106. {
  2107. if (own && this.ownWeaponDurability >= 1)
  2108. {
  2109. this.ownWeaponAttack -= 2;
  2110. this.ownheroAngr -= 2;
  2111. }
  2112. if (!own && this.enemyWeaponDurability >= 1)
  2113. {
  2114. this.enemyWeaponAttack -= 2;
  2115. this.enemyheroAngr -= 2;
  2116. }
  2117. }
  2118. }
  2119. private void getNewEffects(Minion m, bool own, int placeOfNewMob, bool isSummon)
  2120. {
  2121. bool havekriegshymnenanfuehrerin = false;
  2122. List<Minion> temp = new List<Minion>(this.ownMinions);
  2123. int controller = this.ownController;
  2124. if (!own)
  2125. {
  2126. temp.Clear();
  2127. temp.AddRange(this.enemyMinions);
  2128. controller = 0;
  2129. }
  2130. int ownanz = temp.Count;
  2131. if (own && isSummon && this.ownWeaponName == "swordofjustice")
  2132. {
  2133. minionGetBuffed(m, 1, 1, own);
  2134. this.lowerWeaponDurability(1, true);
  2135. }
  2136. int adjacentplace = 1;
  2137. if (isSummon) adjacentplace = 0;
  2138. foreach (Minion ownm in temp)
  2139. {
  2140. if (ownm.silenced) continue; // silenced minions dont buff
  2141. if (isSummon && ownm.handcard.card.specialMin == CardDB.specialMinions.warsongcommander)
  2142. {
  2143. havekriegshymnenanfuehrerin = true;
  2144. }
  2145. if (ownm.handcard.card.specialMin == CardDB.specialMinions.raidleader && ownm.entitiyID != m.entitiyID)
  2146. {
  2147. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_122e");
  2148. e.creator = ownm.entitiyID;
  2149. e.controllerOfCreator = controller;
  2150. addEffectToMinionNoDoubles(m, e, own);
  2151. }
  2152. if (ownm.handcard.card.specialMin == CardDB.specialMinions.leokk && ownm.entitiyID != m.entitiyID)
  2153. {
  2154. Enchantment e = CardDB.getEnchantmentFromCardID("NEW1_033o");
  2155. e.creator = ownm.entitiyID;
  2156. e.controllerOfCreator = controller;
  2157. addEffectToMinionNoDoubles(m, e, own);
  2158. }
  2159. if (ownm.handcard.card.specialMin == CardDB.specialMinions.stormwindchampion && ownm.entitiyID != m.entitiyID)
  2160. {
  2161. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_222o");
  2162. e.creator = ownm.entitiyID;
  2163. e.controllerOfCreator = controller;
  2164. addEffectToMinionNoDoubles(m, e, own);
  2165. }
  2166. if (ownm.handcard.card.specialMin == CardDB.specialMinions.grimscaleoracle && m.handcard.card.race == 14 && ownm.entitiyID != m.entitiyID)
  2167. {
  2168. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_508o");
  2169. e.creator = ownm.entitiyID;
  2170. e.controllerOfCreator = controller;
  2171. addEffectToMinionNoDoubles(m, e, own);
  2172. }
  2173. if (ownm.handcard.card.specialMin == CardDB.specialMinions.murlocwarleader && m.handcard.card.race == 14 && ownm.entitiyID != m.entitiyID)
  2174. {
  2175. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_507e");
  2176. e.creator = ownm.entitiyID;
  2177. e.controllerOfCreator = controller;
  2178. addEffectToMinionNoDoubles(m, e, own);
  2179. }
  2180. if (ownm.handcard.card.specialMin == CardDB.specialMinions.southseacaptain && m.handcard.card.race == 23)
  2181. {
  2182. Enchantment e = CardDB.getEnchantmentFromCardID("NEW1_027e");
  2183. e.creator = ownm.entitiyID;
  2184. e.controllerOfCreator = controller;
  2185. addEffectToMinionNoDoubles(m, e, own);
  2186. }
  2187. if (ownm.handcard.card.specialMin == CardDB.specialMinions.timberwolf && (TAG_RACE)m.handcard.card.race == TAG_RACE.PET)
  2188. {
  2189. Enchantment e = CardDB.getEnchantmentFromCardID("DS1_175o");
  2190. e.creator = ownm.entitiyID;
  2191. e.controllerOfCreator = controller;
  2192. addEffectToMinionNoDoubles(m, e, own);
  2193. }
  2194. if (isSummon && ownm.handcard.card.specialMin == CardDB.specialMinions.tundrarhino && (TAG_RACE)m.handcard.card.race == TAG_RACE.PET)
  2195. {
  2196. minionGetCharge(m);
  2197. }
  2198. if (ownm.handcard.card.specialMin == CardDB.specialMinions.direwolfalpha)
  2199. {
  2200. if (ownm.id == placeOfNewMob + 1 || ownm.id == placeOfNewMob - adjacentplace)
  2201. {
  2202. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_162o");
  2203. e.creator = ownm.entitiyID;
  2204. e.controllerOfCreator = controller;
  2205. addEffectToMinionNoDoubles(m, e, own);
  2206. }
  2207. else
  2208. {
  2209. //remove effect!!
  2210. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_162o");
  2211. e.creator = ownm.entitiyID;
  2212. e.controllerOfCreator = controller;
  2213. debuff(m, e, own);
  2214. }
  2215. }
  2216. if (ownm.handcard.card.specialMin == CardDB.specialMinions.flametonguetotem)
  2217. {
  2218. if (ownm.id == placeOfNewMob + 1 || ownm.id == placeOfNewMob - adjacentplace)
  2219. {
  2220. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_565o");
  2221. e.creator = ownm.entitiyID;
  2222. e.controllerOfCreator = controller;
  2223. addEffectToMinionNoDoubles(m, e, own);
  2224. }
  2225. else
  2226. {
  2227. //remove effect!!
  2228. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_565o");
  2229. e.creator = ownm.entitiyID;
  2230. e.controllerOfCreator = controller;
  2231. debuff(m, e, own);
  2232. }
  2233. }
  2234. }
  2235. //buff oldmurk
  2236. if (isSummon && m.handcard.card.specialMin == CardDB.specialMinions.oldmurkeye && own)
  2237. {
  2238. int murlocs = 0;
  2239. foreach (Minion mnn in this.ownMinions)
  2240. {
  2241. if (mnn.handcard.card.race == 14) murlocs++;
  2242. }
  2243. foreach (Minion mnn in this.enemyMinions)
  2244. {
  2245. if (mnn.handcard.card.race == 14) murlocs++;
  2246. }
  2247. minionGetBuffed(m, murlocs, 0, true);
  2248. }
  2249. // minions that gave ALL minions buffs
  2250. temp.Clear();
  2251. if (own)
  2252. {
  2253. temp.AddRange(this.enemyMinions);
  2254. controller = 0;
  2255. }
  2256. else
  2257. {
  2258. temp.AddRange(this.ownMinions);
  2259. controller = this.ownController;
  2260. }
  2261. foreach (Minion ownm in temp) // the enemy grimmschuppenorakel!
  2262. {
  2263. if (ownm.silenced) continue; // silenced minions dont buff
  2264. if (ownm.handcard.card.specialMin == CardDB.specialMinions.grimscaleoracle && m.handcard.card.race == 14 && ownm.entitiyID != m.entitiyID)
  2265. {
  2266. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_508o");
  2267. e.creator = ownm.entitiyID;
  2268. e.controllerOfCreator = controller;
  2269. addEffectToMinionNoDoubles(m, e, own);
  2270. }
  2271. if (ownm.handcard.card.specialMin == CardDB.specialMinions.murlocwarleader && m.handcard.card.race == 14 && ownm.entitiyID != m.entitiyID)
  2272. {
  2273. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_507e");
  2274. e.creator = ownm.entitiyID;
  2275. e.controllerOfCreator = controller;
  2276. addEffectToMinionNoDoubles(m, e, own);
  2277. }
  2278. }
  2279. if (isSummon && havekriegshymnenanfuehrerin && m.Angr <= 3)
  2280. {
  2281. minionGetCharge(m);
  2282. }
  2283. }
  2284. private void deathrattle(Minion m, bool own)
  2285. {
  2286. if (!m.silenced)
  2287. {
  2288. //real deathrattles
  2289. if (m.handcard.card.CardID == "EX1_534")//m.name == "savannenhochmaehne"
  2290. {
  2291. CardDB.Card c = CardDB.Instance.getCardData("hyena");
  2292. callKid(c, m.id - 1, own);
  2293. callKid(c, m.id - 1, own);
  2294. }
  2295. if (m.name == "harvestgolem")
  2296. {
  2297. CardDB.Card c = CardDB.Instance.getCardData("damagedgolem");
  2298. callKid(c, m.id - 1, own);
  2299. }
  2300. if (m.name == "cairnebloodhoof")
  2301. {
  2302. CardDB.Card c = CardDB.Instance.getCardData("bainebloodhoof");
  2303. callKid(c, m.id - 1, own);
  2304. //penaltity for summon this thing :D (so we dont kill it only to have a new minion)
  2305. this.evaluatePenality += 5;
  2306. }
  2307. if (m.name == "thebeast")
  2308. {
  2309. CardDB.Card c = CardDB.Instance.getCardData("finkleeinhorn");
  2310. callKid(c, m.id - 1, own);
  2311. }
  2312. if (m.name == "lepergnome")
  2313. {
  2314. attackOrHealHero(2, !own);
  2315. }
  2316. if (m.name == "loothoarder")
  2317. {
  2318. if (own)
  2319. {
  2320. //this.owncarddraw++;
  2321. this.drawACard("", own);
  2322. }
  2323. else
  2324. {
  2325. this.drawACard("", own);
  2326. //this.enemycarddraw++;
  2327. }
  2328. }
  2329. if (m.name == "bloodmagethalnos")
  2330. {
  2331. if (own)
  2332. {
  2333. //this.owncarddraw++;
  2334. this.drawACard("", own);
  2335. }
  2336. else
  2337. {
  2338. //this.enemycarddraw++;
  2339. this.drawACard("", own);
  2340. }
  2341. }
  2342. if (m.name == "abomination")
  2343. {
  2344. if (logging) Helpfunctions.Instance.logg("deathrattle monstrositaet:");
  2345. attackOrHealHero(2, false);
  2346. attackOrHealHero(2, true);
  2347. List<Minion> temp = new List<Minion>(this.ownMinions);
  2348. foreach (Minion mnn in temp)
  2349. {
  2350. minionGetDamagedOrHealed(mnn, 2, 0, true);
  2351. }
  2352. temp.Clear();
  2353. temp.AddRange(this.enemyMinions);
  2354. foreach (Minion mnn in temp)
  2355. {
  2356. minionGetDamagedOrHealed(mnn, 2, 0, false);
  2357. }
  2358. }
  2359. if (m.name == "tirionfordring")
  2360. {
  2361. if (own)
  2362. {
  2363. CardDB.Card c = CardDB.Instance.getCardData("ashbringer");
  2364. this.equipWeapon(c);
  2365. }
  2366. else
  2367. {
  2368. this.enemyWeaponAttack = 5;
  2369. this.enemyWeaponDurability = 3;
  2370. }
  2371. }
  2372. if (m.name == "sylvanaswindrunner")
  2373. {
  2374. List<Minion> temp = new List<Minion>();
  2375. if (own)
  2376. {
  2377. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  2378. temp2.Sort((a, b) => a.Angr.CompareTo(b.Angr));
  2379. temp.AddRange(Helpfunctions.TakeList(temp2, Math.Min(2, this.enemyMinions.Count)));
  2380. }
  2381. else
  2382. {
  2383. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  2384. temp2.Sort((a, b) => -a.Angr.CompareTo(b.Angr));
  2385. temp.AddRange(temp2);
  2386. }
  2387. if (temp.Count >= 1)
  2388. {
  2389. if (own)
  2390. {
  2391. Minion target = new Minion();
  2392. target = temp[0];
  2393. if (temp.Count >= 2 && target.taunt && !temp[1].taunt) target = temp[1];
  2394. minionGetControlled(target, true, false);
  2395. }
  2396. else
  2397. {
  2398. Minion target = new Minion();
  2399. target = temp[0];
  2400. foreach (Minion mnn in temp)
  2401. {
  2402. if (mnn.Ready)
  2403. {
  2404. target = mnn;
  2405. break;
  2406. }
  2407. }
  2408. minionGetControlled(target, false, false);
  2409. }
  2410. }
  2411. }
  2412. if (m.handcard.card.specialMin == CardDB.specialMinions.nerubianegg)
  2413. {
  2414. CardDB.Card c = CardDB.Instance.getCardData("nerubian");
  2415. callKid(c, m.id - 1, own);
  2416. }
  2417. if (m.handcard.card.specialMin == CardDB.specialMinions.dancingswords)
  2418. {
  2419. this.drawACard("", !own);
  2420. }
  2421. if (m.handcard.card.specialMin == CardDB.specialMinions.voidcaller)
  2422. {
  2423. if (own)
  2424. {
  2425. List<Handmanager.Handcard> temp = new List<Handmanager.Handcard>();
  2426. foreach (Handmanager.Handcard hc in this.owncards)
  2427. {
  2428. if ((TAG_RACE)hc.card.race == TAG_RACE.DEMON)
  2429. {
  2430. temp.Add(hc);
  2431. }
  2432. }
  2433. temp.Sort((x, y) => x.card.Attack.CompareTo(y.card.Attack));
  2434. foreach (Handmanager.Handcard mnn in temp)
  2435. {
  2436. callKid(mnn.card, this.ownMinions.Count-1, true);
  2437. removeCard(mnn);
  2438. break;
  2439. }
  2440. }
  2441. else
  2442. {
  2443. if (enemyAnzCards + enemycarddraw >= 1)
  2444. {
  2445. CardDB.Card c = CardDB.Instance.getCardData("felguard");
  2446. callKid(c, this.ownMinions.Count - 1, true);
  2447. }
  2448. }
  2449. }
  2450. if (m.handcard.card.specialMin == CardDB.specialMinions.anubarambusher)
  2451. {
  2452. if (own)
  2453. {
  2454. List<Minion> temp = new List<Minion>();
  2455. if (own)
  2456. {
  2457. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  2458. temp2.Sort((a, b) => -a.Angr.CompareTo(b.Angr));
  2459. temp.AddRange(temp2);
  2460. }
  2461. else
  2462. {
  2463. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  2464. temp2.Sort((a, b) => a.Angr.CompareTo(b.Angr));
  2465. temp.AddRange(temp2);
  2466. }
  2467. if (temp.Count >= 1)
  2468. {
  2469. if (own)
  2470. {
  2471. Minion target = new Minion();
  2472. target = temp[0];
  2473. if (temp.Count >= 2 && !target.taunt && temp[1].taunt) target = temp[1];
  2474. minionReturnToHand(target, own, 0);
  2475. }
  2476. else
  2477. {
  2478. Minion target = new Minion();
  2479. target = temp[0];
  2480. if (temp.Count >= 2 && target.taunt && !temp[1].taunt) target = temp[1];
  2481. minionReturnToHand(target, own, 0);
  2482. }
  2483. }
  2484. }
  2485. }
  2486. if (m.handcard.card.specialMin == CardDB.specialMinions.darkcultist)
  2487. {
  2488. if (own)
  2489. {
  2490. List<Minion> temp = new List<Minion>();
  2491. if (own)
  2492. {
  2493. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  2494. temp2.Sort((a, b) => -a.Angr.CompareTo(b.Angr));
  2495. temp.AddRange(temp2);
  2496. }
  2497. else
  2498. {
  2499. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  2500. temp2.Sort((a, b) => a.Angr.CompareTo(b.Angr));
  2501. temp.AddRange(temp2);
  2502. }
  2503. if (temp.Count >= 1)
  2504. {
  2505. if (own)
  2506. {
  2507. Minion target = new Minion();
  2508. target = temp[0];
  2509. if (temp.Count >= 2 && target.taunt && !temp[1].taunt) target = temp[1];
  2510. minionGetBuffed(target, 0, 3, own);
  2511. }
  2512. else
  2513. {
  2514. Minion target = new Minion();
  2515. target = temp[0];
  2516. if (temp.Count >= 2 && !target.taunt && temp[1].taunt) target = temp[1];
  2517. minionGetBuffed(target, 0, 3, own);
  2518. }
  2519. }
  2520. }
  2521. }
  2522. if (m.handcard.card.specialMin == CardDB.specialMinions.webspinner)
  2523. {
  2524. if (own)
  2525. {
  2526. this.drawACard("rivercrocolisk", true);
  2527. }
  2528. else
  2529. {
  2530. this.drawACard("rivercrocolisk", false);
  2531. }
  2532. }
  2533. }
  2534. //deathrattle enchantments // these can be triggered after an silence (if they are casted after the silence)
  2535. bool geistderahnen = false;
  2536. foreach (Enchantment e in m.enchantments)
  2537. {
  2538. if (e.CARDID == "CS2_038e" && !geistderahnen)
  2539. {
  2540. //revive minion due to "geist der ahnen"
  2541. CardDB.Card kid = m.handcard.card;
  2542. int pos = this.ownMinions.Count - 1;
  2543. if (!own) pos = this.enemyMinions.Count - 1;
  2544. callKid(kid, pos, own);
  2545. geistderahnen = true;
  2546. }
  2547. //Seele des Waldes
  2548. if (e.CARDID == "EX1_158e")
  2549. {
  2550. //revive minion due to "geist der ahnen"
  2551. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_158t");//Treant
  2552. int pos = this.ownMinions.Count - 1;
  2553. if (!own) pos = this.enemyMinions.Count - 1;
  2554. callKid(kid, pos, own);
  2555. }
  2556. }
  2557. }
  2558. private void triggerAMinionDied(Minion m, bool own)
  2559. {
  2560. List<Minion> temp = new List<Minion>();
  2561. List<Minion> temp2 = new List<Minion>();
  2562. if (own)
  2563. {
  2564. temp.AddRange(this.ownMinions);
  2565. temp2.AddRange(this.enemyMinions);
  2566. }
  2567. else
  2568. {
  2569. temp.AddRange(this.enemyMinions);
  2570. temp2.AddRange(this.ownMinions);
  2571. }
  2572. foreach (Minion mnn in temp)
  2573. {
  2574. if (mnn.silenced) continue;
  2575. if (mnn.handcard.card.specialMin == CardDB.specialMinions.scavenginghyena && m.handcard.card.race == 20)
  2576. {
  2577. mnn.Angr += 2; mnn.Hp += 1;
  2578. }
  2579. if (mnn.handcard.card.specialMin == CardDB.specialMinions.flesheatingghoul)
  2580. {
  2581. mnn.Angr += 1;
  2582. }
  2583. if (mnn.handcard.card.specialMin == CardDB.specialMinions.cultmaster)
  2584. {
  2585. if (own)
  2586. {
  2587. //this.owncarddraw++;
  2588. this.drawACard("", own);
  2589. }
  2590. else
  2591. {
  2592. //this.enemycarddraw++;
  2593. this.drawACard("", own);
  2594. }
  2595. }
  2596. }
  2597. foreach (Minion mnn in temp2)
  2598. {
  2599. if (mnn.silenced) continue;
  2600. if (mnn.handcard.card.specialMin == CardDB.specialMinions.flesheatingghoul)
  2601. {
  2602. mnn.Angr += 1;
  2603. }
  2604. }
  2605. }
  2606. private void minionGetDestroyed(Minion m, bool own)
  2607. {
  2608. if (own)
  2609. {
  2610. removeMinionFromList(m, this.ownMinions, true);
  2611. }
  2612. else
  2613. {
  2614. removeMinionFromList(m, this.enemyMinions, false);
  2615. }
  2616. }
  2617. private void minionReturnToHand(Minion m, bool own, int manachange)
  2618. {
  2619. if (own)
  2620. {
  2621. removeMinionFromListNoDeath(m, this.ownMinions, true);
  2622. CardDB.Card c = m.handcard.card;
  2623. Handmanager.Handcard hc = new Handmanager.Handcard();
  2624. hc.card = c;
  2625. hc.position = this.owncards.Count + 1;
  2626. hc.entity = m.entitiyID;
  2627. hc.manacost = c.calculateManaCost(this) + manachange ;
  2628. this.owncards.Add(hc);
  2629. }
  2630. else
  2631. {
  2632. removeMinionFromListNoDeath(m, this.enemyMinions, false);
  2633. }
  2634. }
  2635. private void minionTransform(Minion m, CardDB.Card c, bool own)
  2636. {
  2637. Handmanager.Handcard hc = new Handmanager.Handcard(c);
  2638. hc.entity = m.entitiyID;
  2639. Minion tranform = createNewMinion(hc, m.id, own);
  2640. Minion temp = new Minion();
  2641. temp.setMinionTominion(m);
  2642. m.setMinionTominion(tranform);
  2643. m.entitiyID = -2;
  2644. this.endEffectsDueToDeath(temp, own);
  2645. adjacentBuffUpdate(own);
  2646. if (logging) Helpfunctions.Instance.logg("minion got sheep" + m.name + " " + m.Angr);
  2647. }
  2648. private void minionGetSilenced(Minion m, bool own)
  2649. {
  2650. //TODO
  2651. m.taunt = false;
  2652. m.stealth = false;
  2653. m.charge = false;
  2654. m.divineshild = false;
  2655. m.poisonous = false;
  2656. //delete enrage (if minion is silenced the first time)
  2657. if (m.wounded && m.handcard.card.Enrage && !m.silenced)
  2658. {
  2659. deleteWutanfall(m, own);
  2660. }
  2661. //delete enrage (if minion is silenced the first time)
  2662. if (m.frozen && m.numAttacksThisTurn == 0 && !(m.handcard.card.specialMin == CardDB.specialMinions.ancientwatcher || m.name == "ragnarosthefirelord") && !m.playedThisTurn)
  2663. {
  2664. m.Ready = true;
  2665. }
  2666. m.frozen = false;
  2667. if (!m.silenced && (m.handcard.card.specialMin == CardDB.specialMinions.ancientwatcher || m.name == "ragnarosthefirelord") && !m.playedThisTurn && m.numAttacksThisTurn == 0)
  2668. {
  2669. m.Ready = true;
  2670. }
  2671. endEffectsDueToDeath(m, own);//the minion doesnt die, but its effect is ending
  2672. m.enchantments.Clear();
  2673. m.Angr = m.handcard.card.Attack;
  2674. if (m.maxHp < m.handcard.card.Health)//minion has lower maxHp as his card -> heal his hp
  2675. {
  2676. m.Hp += m.handcard.card.Health - m.maxHp; //heal minion
  2677. }
  2678. m.maxHp = m.handcard.card.Health;
  2679. if (m.Hp > m.maxHp) m.Hp = m.maxHp;
  2680. getNewEffects(m, own, m.id, false);// minion get effects of others
  2681. m.silenced = true;
  2682. }
  2683. private void minionGetControlled(Minion m, bool newOwner, bool canAttack)
  2684. {
  2685. List<Minion> newOwnerList = new List<Minion>();
  2686. if (newOwner) { newOwnerList = new List<Minion>(this.ownMinions); }
  2687. else { newOwnerList.AddRange(this.enemyMinions); }
  2688. if (newOwnerList.Count >= 7) return;
  2689. if (newOwner)
  2690. {
  2691. removeMinionFromListNoDeath(m, this.enemyMinions, !newOwner);
  2692. m.Ready = false;
  2693. m.playedThisTurn = true;
  2694. this.getNewEffects(m, newOwner, newOwnerList.Count, false);
  2695. addMiniontoList(m, this.ownMinions, newOwnerList.Count, newOwner);
  2696. if (m.charge || canAttack)
  2697. {
  2698. m.charge = false;
  2699. minionGetCharge(m);
  2700. }
  2701. }
  2702. else
  2703. {
  2704. removeMinionFromListNoDeath(m, this.ownMinions, !newOwner);
  2705. //m.Ready=false;
  2706. addMiniontoList(m, this.enemyMinions, newOwnerList.Count, newOwner);
  2707. //if (m.charge) minionGetCharge(m);
  2708. }
  2709. }
  2710. private void minionGetWindfurry(Minion m)
  2711. {
  2712. if (m.windfury) return;
  2713. m.windfury = true;
  2714. if (m.frozen) return;
  2715. if (!m.playedThisTurn && m.numAttacksThisTurn <= 1)
  2716. {
  2717. m.Ready = true;
  2718. }
  2719. if (!m.charge && m.numAttacksThisTurn <= 1)
  2720. {
  2721. m.Ready = true;
  2722. }
  2723. }
  2724. private void minionGetCharge(Minion m)
  2725. {
  2726. if (m.charge) return;
  2727. m.charge = true;
  2728. if (m.playedThisTurn && (m.numAttacksThisTurn == 0 || (m.numAttacksThisTurn == 1 && m.windfury)))
  2729. {
  2730. m.Ready = true;
  2731. }
  2732. }
  2733. private void minionGetReady(Minion m) // minion get ready due to attack-buff
  2734. {
  2735. if (!m.silenced && (m.handcard.card.specialMin == CardDB.specialMinions.ancientwatcher || m.name == "ragnarosthefirelord")) return;
  2736. if (!m.playedThisTurn && !m.frozen && (m.numAttacksThisTurn == 0 || (m.numAttacksThisTurn == 1 && m.windfury)))
  2737. {
  2738. m.Ready = true;
  2739. }
  2740. }
  2741. private void minionGetBuffed(Minion m, int attackbuff, int hpbuff, bool own)
  2742. {
  2743. if (m.Angr == 0 && attackbuff >= 1) minionGetReady(m);
  2744. m.Angr = Math.Max(0, m.Angr + attackbuff);
  2745. if (hpbuff >= 1)
  2746. {
  2747. m.Hp = m.Hp + hpbuff;
  2748. m.maxHp = m.maxHp + hpbuff;
  2749. }
  2750. else
  2751. {
  2752. //debuffing hp, lower only maxhp (unless maxhp < hp)
  2753. m.maxHp = m.maxHp + hpbuff;
  2754. if (m.maxHp < m.Hp)
  2755. {
  2756. m.Hp = m.maxHp;
  2757. }
  2758. }
  2759. if (m.maxHp == m.Hp)
  2760. {
  2761. m.wounded = false;
  2762. }
  2763. else
  2764. {
  2765. m.wounded = true;
  2766. }
  2767. if (m.name == "lightspawn" && !m.silenced)
  2768. {
  2769. m.Angr = m.Hp;
  2770. }
  2771. if (m.Hp <= 0)
  2772. {
  2773. if (own)
  2774. {
  2775. this.removeMinionFromList(m, this.ownMinions, true);
  2776. if (logging) Helpfunctions.Instance.logg("own " + m.name + " died");
  2777. }
  2778. else
  2779. {
  2780. this.removeMinionFromList(m, this.enemyMinions, false);
  2781. if (logging) Helpfunctions.Instance.logg("enemy " + m.name + " died");
  2782. }
  2783. }
  2784. }
  2785. private void deleteWutanfall(Minion m, bool own)
  2786. {
  2787. if (m.name == "angrychicken")
  2788. {
  2789. minionGetBuffed(m, -5, 0, own);
  2790. }
  2791. if (m.name == "amaniberserker")
  2792. {
  2793. minionGetBuffed(m, -3, 0, own);
  2794. }
  2795. if (m.name == "taurenwarrior")
  2796. {
  2797. minionGetBuffed(m, -3, 0, own);
  2798. }
  2799. if (m.name == "grommashhellscream")
  2800. {
  2801. minionGetBuffed(m, -6, 0, own);
  2802. }
  2803. if (m.name == "ragingworgen")
  2804. {
  2805. minionGetBuffed(m, -1, 0, own);
  2806. minionGetWindfurry(m);
  2807. }
  2808. if (m.name == "spitefulsmith")
  2809. {
  2810. if (own && this.ownWeaponDurability >= 1)
  2811. {
  2812. this.ownWeaponAttack -= 2;
  2813. this.ownheroAngr -= 2;
  2814. }
  2815. if (!own && this.enemyWeaponDurability >= 1)
  2816. {
  2817. this.enemyWeaponAttack -= 2;
  2818. this.enemyheroAngr -= 2;
  2819. }
  2820. }
  2821. }
  2822. private void wutanfall(Minion m, bool woundedBefore, bool own) // = enrange effects
  2823. {
  2824. if (!m.handcard.card.Enrage) return; // if minion has no enrange, do nothing
  2825. if (woundedBefore == m.wounded || m.silenced) return; // if he was wounded, and still is (or was unwounded) do nothing
  2826. if (m.wounded && m.Hp >= 1) //is wounded, wasnt wounded before, grant wutanfall
  2827. {
  2828. if (m.name == "angrychicken")
  2829. {
  2830. minionGetBuffed(m, 5, 0, own);
  2831. }
  2832. if (m.name == "amaniberserker")
  2833. {
  2834. minionGetBuffed(m, 3, 0, own);
  2835. }
  2836. if (m.name == "taurenwarrior")
  2837. {
  2838. minionGetBuffed(m, 3, 0, own);
  2839. }
  2840. if (m.name == "grommashhellscream")
  2841. {
  2842. minionGetBuffed(m, 6, 0, own);
  2843. }
  2844. if (m.name == "ragingworgen")
  2845. {
  2846. minionGetBuffed(m, 1, 0, own);
  2847. minionGetWindfurry(m);
  2848. }
  2849. if (m.name == "spitefulsmith")
  2850. {
  2851. if (own && this.ownWeaponDurability >= 1)
  2852. {
  2853. this.ownWeaponAttack += 2;
  2854. this.ownheroAngr += 2;
  2855. }
  2856. if (!own && this.enemyWeaponDurability >= 1)
  2857. {
  2858. this.enemyWeaponAttack += 2;
  2859. this.enemyheroAngr += 2;
  2860. }
  2861. }
  2862. }
  2863. if (!m.wounded) // reverse buffs
  2864. {
  2865. deleteWutanfall(m, own);
  2866. }
  2867. }
  2868. private void triggerAHeroGetHealed(bool own)
  2869. {
  2870. foreach (Minion mnn in this.ownMinions)
  2871. {
  2872. if (mnn.silenced) continue;
  2873. if (mnn.handcard.card.specialMin == CardDB.specialMinions.lightwarden)
  2874. {
  2875. minionGetBuffed(mnn, 2, 0, true);
  2876. }
  2877. }
  2878. foreach (Minion mnn in this.enemyMinions)
  2879. {
  2880. if (mnn.silenced) continue;
  2881. if (mnn.handcard.card.specialMin == CardDB.specialMinions.lightwarden)
  2882. {
  2883. minionGetBuffed(mnn, 2, 0, false);
  2884. }
  2885. }
  2886. }
  2887. private void triggerAMinionGetHealed(Minion m, bool own)
  2888. {
  2889. foreach (Minion mnn in this.ownMinions)
  2890. {
  2891. if (mnn.silenced) continue;
  2892. if (mnn.handcard.card.specialMin == CardDB.specialMinions.northshirecleric)
  2893. {
  2894. //this.owncarddraw++;
  2895. this.drawACard("", true);
  2896. }
  2897. if (mnn.handcard.card.specialMin == CardDB.specialMinions.lightwarden)
  2898. {
  2899. minionGetBuffed(mnn, 2, 0, true);
  2900. }
  2901. }
  2902. foreach (Minion mnn in this.enemyMinions)
  2903. {
  2904. if (mnn.silenced) continue;
  2905. if (mnn.handcard.card.specialMin == CardDB.specialMinions.northshirecleric)
  2906. {
  2907. //this.enemycarddraw++;
  2908. this.drawACard("", false);
  2909. }
  2910. if (mnn.handcard.card.specialMin == CardDB.specialMinions.lightwarden)
  2911. {
  2912. minionGetBuffed(mnn, 2, 0, false);
  2913. }
  2914. }
  2915. }
  2916. private void triggerAMinionGetDamage(Minion m, bool own)
  2917. {
  2918. //minion take dmg
  2919. if (m.handcard.card.specialMin == CardDB.specialMinions.acolyteofpain && !m.silenced)
  2920. {
  2921. if (own)
  2922. {
  2923. //this.owncarddraw++;
  2924. this.drawACard("", own);
  2925. }
  2926. else
  2927. {
  2928. //this.enemycarddraw++;
  2929. this.drawACard("", own);
  2930. }
  2931. }
  2932. if (m.handcard.card.specialMin == CardDB.specialMinions.gurubashiberserker && !m.silenced)
  2933. {
  2934. minionGetBuffed(m, 3, 0, own);
  2935. }
  2936. foreach (Minion mnn in this.ownMinions)
  2937. {
  2938. if (mnn.silenced) continue;
  2939. if (mnn.handcard.card.specialMin == CardDB.specialMinions.frothingberserker)
  2940. {
  2941. mnn.Angr++;
  2942. }
  2943. if (own)
  2944. {
  2945. if (mnn.handcard.card.specialMin == CardDB.specialMinions.armorsmith)
  2946. {
  2947. this.ownHeroDefence++;
  2948. }
  2949. }
  2950. }
  2951. foreach (Minion mnn in this.enemyMinions)
  2952. {
  2953. if (mnn.silenced) continue;
  2954. if (mnn.handcard.card.specialMin == CardDB.specialMinions.frothingberserker)
  2955. {
  2956. mnn.Angr++;
  2957. }
  2958. if (!own)
  2959. {
  2960. if (mnn.handcard.card.specialMin == CardDB.specialMinions.armorsmith)
  2961. {
  2962. this.enemyHeroDefence++;
  2963. }
  2964. }
  2965. }
  2966. }
  2967. /*private void minionGetDamagedOrHealed(Minion m, int damages, int heals, bool own)
  2968. {
  2969. minionGetDamagedOrHealed(m, damages, heals, own, false);
  2970. }*/
  2971. private void minionGetDamagedOrHealed(Minion m, int damages, int heals, bool own , bool dontCalcLostDmg=false, bool isMinionattack=false)
  2972. {
  2973. int damage = damages;
  2974. int heal = heals;
  2975. bool woundedbefore = m.wounded;
  2976. if (heal < 0) // heal was shifted in damage
  2977. {
  2978. damage = -1 * heal;
  2979. heal = 0;
  2980. }
  2981. if (damage >= 1 && m.divineshild)
  2982. {
  2983. m.divineshild = false;
  2984. if (!own && !dontCalcLostDmg)
  2985. {
  2986. if (isMinionattack)
  2987. {
  2988. this.lostDamage += damage;
  2989. }
  2990. else
  2991. {
  2992. this.lostDamage += damage * damage;
  2993. }
  2994. }
  2995. return;
  2996. }
  2997. if (m.cantLowerHPbelowONE && damage >= 1 && damage >= m.Hp) damage = m.Hp - 1;
  2998. if (!own && !dontCalcLostDmg && m.Hp < damage)
  2999. {
  3000. if (isMinionattack)
  3001. {
  3002. this.lostDamage += (damage - m.Hp);
  3003. }
  3004. else
  3005. {
  3006. this.lostDamage += (damage - m.Hp) * (damage - m.Hp);
  3007. }
  3008. }
  3009. int hpcopy = m.Hp;
  3010. if (damage >= 1)
  3011. {
  3012. m.Hp = m.Hp - damage;
  3013. }
  3014. if (heal >= 1)
  3015. {
  3016. if (own && !dontCalcLostDmg && heal <= 999 && m.Hp + heal > m.maxHp) this.lostHeal += m.Hp + heal - m.maxHp;
  3017. m.Hp = m.Hp + Math.Min(heal, m.maxHp - m.Hp);
  3018. }
  3019. if (m.Hp > hpcopy)
  3020. {
  3021. //minionWasHealed
  3022. triggerAMinionGetHealed(m, own);
  3023. }
  3024. if (m.Hp < hpcopy)
  3025. {
  3026. triggerAMinionGetDamage(m, own);
  3027. }
  3028. if (m.maxHp == m.Hp)
  3029. {
  3030. m.wounded = false;
  3031. }
  3032. else
  3033. {
  3034. m.wounded = true;
  3035. }
  3036. this.wutanfall(m, woundedbefore, own);
  3037. if (m.name == "lightspawn" && !m.silenced)
  3038. {
  3039. m.Angr = m.Hp;
  3040. }
  3041. if (m.Hp <= 0)
  3042. {
  3043. if (own)
  3044. {
  3045. this.removeMinionFromList(m, this.ownMinions, true);
  3046. if (logging) Helpfunctions.Instance.logg("own " + m.name + " died");
  3047. }
  3048. else
  3049. {
  3050. this.removeMinionFromList(m, this.enemyMinions, false);
  3051. if (logging) Helpfunctions.Instance.logg("enemy " + m.name + " died");
  3052. }
  3053. }
  3054. }
  3055. private void copyMinion(Minion target, Minion source)
  3056. {
  3057. target.name = source.name;
  3058. target.Angr = source.Angr;
  3059. target.handcard.card = CardDB.Instance.getCardDataFromID(source.handcard.card.CardID);
  3060. target.charge = source.charge;
  3061. target.divineshild = source.divineshild;
  3062. target.exhausted = source.exhausted;
  3063. target.frozen = source.frozen;
  3064. target.Hp = source.Hp;
  3065. target.immune = source.immune;
  3066. target.maxHp = source.maxHp;
  3067. target.playedThisTurn = source.playedThisTurn;
  3068. target.poisonous = source.poisonous;
  3069. target.silenced = source.silenced;
  3070. target.stealth = source.stealth;
  3071. target.taunt = source.taunt;
  3072. target.windfury = source.windfury;
  3073. target.wounded = source.wounded;
  3074. target.Ready = false;
  3075. if (target.charge) target.Ready = true;
  3076. foreach (Enchantment e in source.enchantments)
  3077. {
  3078. Enchantment ne = CardDB.getEnchantmentFromCardID(e.CARDID);
  3079. target.enchantments.Add(ne);
  3080. }
  3081. }
  3082. private void removeMinionFromListNoDeath(Minion m, List<Minion> l, bool own)
  3083. {
  3084. l.Remove(m);
  3085. int i = 0;
  3086. foreach (Minion mnn in l)
  3087. {
  3088. mnn.id = i;
  3089. mnn.zonepos = i + 1;
  3090. i++;
  3091. }
  3092. this.endEffectsDueToDeath(m, own);
  3093. adjacentBuffUpdate(own);
  3094. }
  3095. private void removeMinionFromList(Minion m, List<Minion> l, bool own)
  3096. {
  3097. l.Remove(m);
  3098. int i = 0;
  3099. foreach (Minion mnn in l)
  3100. {
  3101. mnn.id = i;
  3102. mnn.zonepos = i + 1;
  3103. i++;
  3104. }
  3105. this.endEffectsDueToDeath(m, own);
  3106. this.deathrattle(m, own);
  3107. if (own)
  3108. {
  3109. if (this.ownBaronRivendare) this.deathrattle(m, own);
  3110. }
  3111. else
  3112. {
  3113. if(this.enemyBaronRivendare) this.deathrattle(m, own);
  3114. }
  3115. this.triggerAMinionDied(m, own);
  3116. adjacentBuffUpdate(own);
  3117. }
  3118. private void attack(int attacker, int target, bool dontcount)
  3119. {
  3120. Minion m = new Minion();
  3121. bool attackOwn = true;
  3122. if (attacker < 10)
  3123. {
  3124. m = this.ownMinions[attacker];
  3125. attackOwn = true;
  3126. }
  3127. if (attacker >= 10 && attacker < 20)
  3128. {
  3129. m = this.enemyMinions[attacker - 10];
  3130. attackOwn = false;
  3131. }
  3132. if (!dontcount)
  3133. {
  3134. m.numAttacksThisTurn++;
  3135. if (m.windfury && m.numAttacksThisTurn == 2)
  3136. {
  3137. m.Ready = false;
  3138. }
  3139. if (!m.windfury)
  3140. {
  3141. m.Ready = false;
  3142. }
  3143. }
  3144. if (logging) Helpfunctions.Instance.logg(".attck with" + m.name + " A " + m.Angr + " H " + m.Hp);
  3145. if (target == 200)//target is hero
  3146. {
  3147. attackOrHealHero(m.Angr, false);
  3148. return;
  3149. }
  3150. bool enemyOwn = false;
  3151. Minion enemy = new Minion();
  3152. if (target < 10)
  3153. {
  3154. enemy = this.ownMinions[target];
  3155. enemyOwn = true;
  3156. }
  3157. if (target >= 10 && target < 20)
  3158. {
  3159. enemy = this.enemyMinions[target - 10];
  3160. enemyOwn = false;
  3161. }
  3162. int ownAttack = m.Angr;
  3163. int enemyAttack = enemy.Angr;
  3164. // defender take damage
  3165. if (m.handcard.card.poisionous)
  3166. {
  3167. minionGetDestroyed(enemy, enemyOwn);
  3168. }
  3169. else
  3170. {
  3171. int oldHP = enemy.Hp;
  3172. minionGetDamagedOrHealed(enemy, ownAttack, 0, enemyOwn,false,true);
  3173. if (!m.silenced && oldHP > enemy.Hp && m.handcard.card.specialMin == CardDB.specialMinions.waterelemental) enemy.frozen = true;
  3174. }
  3175. //attacker take damage
  3176. if (!m.immune && !dontcount)
  3177. {
  3178. if (enemy.handcard.card.poisionous)
  3179. {
  3180. minionGetDestroyed(m, attackOwn);
  3181. }
  3182. else
  3183. {
  3184. int oldHP = m.Hp;
  3185. minionGetDamagedOrHealed(m, enemyAttack, 0, attackOwn,false,true);
  3186. if (!enemy.silenced && oldHP > m.Hp && enemy.handcard.card.specialMin == CardDB.specialMinions.waterelemental) m.frozen = true;
  3187. }
  3188. }
  3189. }
  3190. public void attackWithMinion(Minion ownMinion, int target, int targetEntity, int penality)
  3191. {
  3192. this.evaluatePenality += penality;
  3193. Action a = new Action();
  3194. a.minionplay = true;
  3195. a.owntarget = ownMinion.id;
  3196. a.ownEntitiy = ownMinion.entitiyID;
  3197. a.enemytarget = target;
  3198. a.enemyEntitiy = targetEntity;
  3199. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  3200. a.comboBeforePlayed = (this.cardsPlayedThisTurn >= 1) ? true : false;
  3201. this.playactions.Add(a);
  3202. if (logging) Helpfunctions.Instance.logg("attck with" + ownMinion.name + " " + ownMinion.id + " trgt " + target + " A " + ownMinion.Angr + " H " + ownMinion.Hp);
  3203. attack(ownMinion.id, target, false);
  3204. //draw a card if the minion has enchantment from: Segen der weisheit
  3205. int segenderweisheitAnz = 0;
  3206. foreach (Enchantment e in ownMinion.enchantments)
  3207. {
  3208. if (e.CARDID == "EX1_363e2" && e.controllerOfCreator == this.ownController)
  3209. {
  3210. segenderweisheitAnz++;
  3211. }
  3212. }
  3213. this.owncarddraw += segenderweisheitAnz;
  3214. for (int i = 0; i < segenderweisheitAnz; i++)
  3215. {
  3216. this.drawACard("", true);
  3217. }
  3218. }
  3219. public void ENEMYattackWithMinion(Minion ownMinion, int target, int targetEntity)
  3220. {
  3221. if (logging) Helpfunctions.Instance.logg("ennemy attck with" + ownMinion.name + " " + ownMinion.id + " trgt " + target + " A " + ownMinion.Angr + " H " + ownMinion.Hp);
  3222. attack(ownMinion.id+10, target, false);
  3223. //draw a card if the minion has enchantment from: Segen der weisheit
  3224. int segenderweisheitAnz = 0;
  3225. foreach (Enchantment e in ownMinion.enchantments)
  3226. {
  3227. if (e.CARDID == "EX1_363e2" && e.controllerOfCreator != this.ownController)
  3228. {
  3229. segenderweisheitAnz++;
  3230. }
  3231. }
  3232. this.enemycarddraw += segenderweisheitAnz;
  3233. for (int i = 0; i < segenderweisheitAnz; i++)
  3234. {
  3235. this.drawACard("", false);
  3236. }
  3237. }
  3238. private void addMiniontoList(Minion m, List<Minion> l, int pos, bool own)
  3239. {
  3240. List<Minion> newmins = new List<Minion>(l);
  3241. l.Clear();
  3242. int i = 0;
  3243. foreach (Minion mnn in newmins)
  3244. {
  3245. if (pos == i)
  3246. {
  3247. m.id = i;
  3248. m.zonepos = i + 1;
  3249. l.Add(m);
  3250. i++;
  3251. }
  3252. mnn.id = i;
  3253. mnn.zonepos = i + 1;
  3254. l.Add(mnn);
  3255. i++;
  3256. }
  3257. // maybe he is last mob
  3258. if (pos == i)
  3259. {
  3260. m.id = i;
  3261. m.zonepos = i + 1;
  3262. l.Add(m);
  3263. i++;
  3264. }
  3265. adjacentBuffUpdate(own);
  3266. triggerPlayedAMinion(m.handcard, own);
  3267. }
  3268. private Minion createNewMinion(Handmanager.Handcard hc, int placeOfNewMob, bool own)
  3269. {
  3270. Minion m = new Minion();
  3271. m.handcard = new Handmanager.Handcard(hc);
  3272. m.entitiyID = hc.entity;
  3273. m.Posix = 0;
  3274. m.Posiy = 0;
  3275. m.Angr = hc.card.Attack;
  3276. m.Hp = hc.card.Health;
  3277. m.maxHp = hc.card.Health;
  3278. m.name = hc.card.name;
  3279. m.playedThisTurn = true;
  3280. m.numAttacksThisTurn = 0;
  3281. m.id = placeOfNewMob;
  3282. m.zonepos = placeOfNewMob + 1;
  3283. if (hc.card.windfury) m.windfury = true;
  3284. if (hc.card.tank) m.taunt = true;
  3285. if (hc.card.Charge)
  3286. {
  3287. m.Ready = true;
  3288. m.charge = true;
  3289. }
  3290. if (hc.card.Shield) m.divineshild = true;
  3291. if (hc.card.poisionous) m.poisonous = true;
  3292. if (hc.card.Stealth) m.stealth = true;
  3293. if (m.name == "lightspawn" && !m.silenced)
  3294. {
  3295. m.Angr = m.Hp;
  3296. }
  3297. this.getNewEffects(m, own, placeOfNewMob,true);
  3298. return m;
  3299. }
  3300. private void doBattleCryWithTargeting(Minion c, int target, int choice)
  3301. {
  3302. //target is the target AFTER spawning mobs
  3303. int attackbuff = 0;
  3304. int hpbuff = 0;
  3305. int heal = 0;
  3306. int damage = 0;
  3307. bool spott = false;
  3308. bool divineshild = false;
  3309. bool windfury = false;
  3310. bool silence = false;
  3311. bool destroy = false;
  3312. bool frozen = false;
  3313. bool stealth = false;
  3314. bool backtohand = false;
  3315. int backtoHandManaChange = 0;
  3316. bool own = true;
  3317. if (target >= 10 && target < 20)
  3318. {
  3319. own = false;
  3320. }
  3321. Minion m = new Minion();
  3322. if (target < 10)
  3323. {
  3324. m = this.ownMinions[target];
  3325. }
  3326. if (target >= 10 && target < 20)
  3327. {
  3328. m = this.enemyMinions[target - 10];
  3329. }
  3330. if (c.name == "ancientoflore")
  3331. {
  3332. if (choice == 2)
  3333. {
  3334. heal = 5;
  3335. }
  3336. }
  3337. if (c.name == "keeperofthegrove")
  3338. {
  3339. if (choice == 1)
  3340. {
  3341. damage = 2;
  3342. }
  3343. if (choice == 2)
  3344. {
  3345. silence = true;
  3346. }
  3347. }
  3348. if (c.name == "crazedalchemist")
  3349. {
  3350. if (target < 10)
  3351. {
  3352. bool woundedbef = m.wounded;
  3353. int temp = m.Angr;
  3354. m.Angr = m.Hp;
  3355. m.Hp = temp;
  3356. m.maxHp = temp;
  3357. m.wounded = false;
  3358. wutanfall(m, woundedbef, true);
  3359. if (m.Hp <= 0) minionGetDestroyed(m, true);
  3360. }
  3361. if (target >= 10 && target < 20)
  3362. {
  3363. bool woundedbef = m.wounded;
  3364. int temp = m.Angr;
  3365. m.Angr = m.Hp;
  3366. m.Hp = temp;
  3367. m.maxHp = temp;
  3368. m.wounded = false;
  3369. wutanfall(m, woundedbef, false);
  3370. if (m.Hp <= 0) minionGetDestroyed(m, false);
  3371. }
  3372. }
  3373. if (c.name == "si7agent" && this.cardsPlayedThisTurn >= 1)
  3374. {
  3375. damage = 2;
  3376. }
  3377. if (c.name == "kidnapper" && this.cardsPlayedThisTurn >= 1)
  3378. {
  3379. backtohand = true;
  3380. backtoHandManaChange = 0;
  3381. }
  3382. if (c.name == "masterofdisguise")
  3383. {
  3384. stealth = true;
  3385. }
  3386. if (c.name == "cabalshadowpriest")
  3387. {
  3388. minionGetControlled(m, true, false);
  3389. }
  3390. if (c.name == "ironbeakowl" || c.name == "spellbreaker") //eisenschnabeleule, zauberbrecher
  3391. {
  3392. silence = true;
  3393. }
  3394. if (c.name == "shatteredsuncleric")
  3395. {
  3396. attackbuff = 1;
  3397. hpbuff = 1;
  3398. }
  3399. if (c.name == "ancientbrewmaster")
  3400. {
  3401. backtohand = true;
  3402. backtoHandManaChange = 0;
  3403. }
  3404. if (c.name == "youthfulbrewmaster")
  3405. {
  3406. backtohand = true;
  3407. backtoHandManaChange = 0;
  3408. }
  3409. if (c.name == "darkirondwarf")
  3410. {
  3411. //attackbuff = 2;
  3412. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_046e");
  3413. e.creator = c.entitiyID;
  3414. e.controllerOfCreator = this.ownController;
  3415. addEffectToMinionNoDoubles(m, e, own);
  3416. }
  3417. if (c.name == "hungrycrab")
  3418. {
  3419. destroy = true;
  3420. /*Enchantment e = CardDB.getEnchantmentFromCardID("NEW1_017e");
  3421. e.creator = c.entitiyID;
  3422. e.controllerOfCreator = this.ownController;
  3423. addEffectToMinionNoDoubles(c, e, true);//buff own hungrige krabbe*/
  3424. minionGetBuffed(c, 2, 2, true);
  3425. }
  3426. if (c.name == "abusivesergeant")
  3427. {
  3428. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_188o");
  3429. e.creator = c.entitiyID;
  3430. e.controllerOfCreator = this.ownController;
  3431. addEffectToMinionNoDoubles(m, e, own);
  3432. }
  3433. if (c.name == "crueltaskmaster")
  3434. {
  3435. attackbuff = 2;
  3436. damage = 1;
  3437. }
  3438. if (c.name == "frostelemental")
  3439. {
  3440. frozen = true;
  3441. }
  3442. if (c.name == "elvenarcher")
  3443. {
  3444. damage = 1;
  3445. }
  3446. if (c.name == "voodoodoctor")
  3447. {
  3448. if (this.auchenaiseelenpriesterin)
  3449. { damage = 2; }
  3450. else { heal = 2; }
  3451. }
  3452. if (c.name == "templeenforcer")
  3453. {
  3454. hpbuff = 3;
  3455. }
  3456. if (c.name == "ironforgerifleman")
  3457. {
  3458. damage = 1;
  3459. }
  3460. if (c.name == "stormpikecommando")
  3461. {
  3462. damage = 2;
  3463. }
  3464. if (c.name == "houndmaster")
  3465. {
  3466. attackbuff = 2;
  3467. hpbuff = 2;
  3468. spott = true;
  3469. }
  3470. if (c.name == "aldorpeacekeeper")
  3471. {
  3472. attackbuff = 1 - m.Angr;
  3473. }
  3474. if (c.name == "theblackknight")
  3475. {
  3476. destroy = true;
  3477. }
  3478. if (c.name == "argentprotector")
  3479. {
  3480. divineshild = true; // Grants NO buff
  3481. }
  3482. if (c.name == "windspeaker")
  3483. {
  3484. windfury = true;
  3485. }
  3486. if (c.name == "fireelemental")
  3487. {
  3488. damage = 3;
  3489. }
  3490. if (c.name == "earthenringfarseer")
  3491. {
  3492. if (this.auchenaiseelenpriesterin)
  3493. { damage = 3; }
  3494. else { heal = 3; }
  3495. }
  3496. if (c.name == "biggamehunter")
  3497. {
  3498. destroy = true;
  3499. }
  3500. if (c.name == "alexstrasza")
  3501. {
  3502. if (target == 100)
  3503. {
  3504. this.ownHeroHp = 15;
  3505. }
  3506. if (target == 200)
  3507. {
  3508. this.enemyHeroHp = 15;
  3509. }
  3510. }
  3511. if (c.name == "facelessmanipulator")
  3512. {//todo, test this :D
  3513. copyMinion(c, m);
  3514. }
  3515. //make effect on target
  3516. //ownminion
  3517. if (target < 10)
  3518. {
  3519. if (attackbuff != 0 || hpbuff != 0)
  3520. {
  3521. minionGetBuffed(m, attackbuff, hpbuff, true);
  3522. }
  3523. if (damage != 0 || heal != 0)
  3524. {
  3525. minionGetDamagedOrHealed(m, damage, heal, true);
  3526. }
  3527. if (spott) m.taunt = true;
  3528. if (windfury) minionGetWindfurry(m);
  3529. if (divineshild) m.divineshild = true;
  3530. if (destroy) minionGetDestroyed(m, true);
  3531. if (frozen) m.frozen = true;
  3532. if (stealth) m.stealth = true;
  3533. if (backtohand) minionReturnToHand(m, true, backtoHandManaChange);
  3534. if (silence) minionGetSilenced(m, true);
  3535. }
  3536. //enemyminion
  3537. if (target >= 10 && target < 20)
  3538. {
  3539. if (attackbuff != 0 || hpbuff != 0)
  3540. {
  3541. minionGetBuffed(m, attackbuff, hpbuff, false);
  3542. }
  3543. if (damage != 0 || heal != 0)
  3544. {
  3545. minionGetDamagedOrHealed(m, damage, heal, false);
  3546. }
  3547. if (spott) m.taunt = true;
  3548. if (windfury) minionGetWindfurry(m);
  3549. if (divineshild) m.divineshild = true;
  3550. if (destroy) minionGetDestroyed(m, false);
  3551. if (frozen) m.frozen = true;
  3552. if (stealth) m.stealth = true;
  3553. if (backtohand) minionReturnToHand(m, false,backtoHandManaChange);
  3554. if (silence) minionGetSilenced(m, false);
  3555. }
  3556. if (target == 100)
  3557. {
  3558. if (frozen) this.ownHeroFrozen = true;
  3559. if (damage >= 1) attackOrHealHero(damage, true);
  3560. if (heal >= 1) attackOrHealHero(-heal, true);
  3561. }
  3562. if (target == 200)
  3563. {
  3564. if (frozen) this.enemyHeroFrozen = true;
  3565. if (damage >= 1) attackOrHealHero(damage, false);
  3566. if (heal >= 1) attackOrHealHero(-heal, false);
  3567. }
  3568. }
  3569. private void doBattleCryWithoutTargeting(Minion c, int position, bool own, int choice)
  3570. {
  3571. //only nontargetable battlecrys!
  3572. //druid choices
  3573. //urtum des krieges:
  3574. if (c.name == "ancientofwar")
  3575. {
  3576. if (choice == 1)
  3577. {
  3578. minionGetBuffed(c, 5, 0, true);
  3579. }
  3580. if (choice == 2)
  3581. {
  3582. minionGetBuffed(c, 0, 5, true);
  3583. c.taunt = true;
  3584. }
  3585. }
  3586. if (c.name == "ancientoflore")
  3587. {
  3588. if (choice == 1)
  3589. {
  3590. //this.owncarddraw += 2;
  3591. this.drawACard("", own);
  3592. this.drawACard("", own);
  3593. }
  3594. }
  3595. if (c.name == "druidoftheclaw")
  3596. {
  3597. if (choice == 1)
  3598. {
  3599. minionGetCharge(c);
  3600. }
  3601. if (choice == 2)
  3602. {
  3603. minionGetBuffed(c, 0, 2, true);
  3604. c.taunt = true;
  3605. }
  3606. }
  3607. if (c.name == "cenarius")
  3608. {
  3609. if (choice == 1)
  3610. {
  3611. foreach (Minion m in this.ownMinions)
  3612. {
  3613. minionGetBuffed(m, 2, 2, true);
  3614. }
  3615. }
  3616. //choice 2 = spawn 2 kids
  3617. }
  3618. //normal ones
  3619. if (c.name == "mindcontroltech")
  3620. {
  3621. if (this.enemyMinions.Count >= 4)
  3622. {
  3623. List<Minion> temp = new List<Minion>();
  3624. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  3625. temp2.Sort((a, b) => a.Angr.CompareTo(b.Angr));//we take the weekest
  3626. temp.AddRange(Helpfunctions.TakeList(temp2, 2));
  3627. Minion target = new Minion();
  3628. target = temp[0];
  3629. if (target.taunt && !temp[1].taunt) target = temp[1];
  3630. minionGetControlled(target, true, false);
  3631. }
  3632. }
  3633. if (c.name == "felguard")
  3634. {
  3635. this.ownMaxMana--;
  3636. }
  3637. if (c.name == "arcanegolem")
  3638. {
  3639. this.enemyMaxMana++;
  3640. }
  3641. if (c.name == "edwinvancleef" && this.cardsPlayedThisTurn >= 1)
  3642. {
  3643. minionGetBuffed(c, this.cardsPlayedThisTurn * 2, this.cardsPlayedThisTurn * 2, own);
  3644. }
  3645. if (c.name == "doomguard")
  3646. {
  3647. this.owncarddraw -= Math.Min(2, this.owncards.Count);
  3648. this.owncards.RemoveRange(0, Math.Min(2, this.owncards.Count));
  3649. }
  3650. if (c.name == "succubus")
  3651. {
  3652. this.owncarddraw -= Math.Min(1, this.owncards.Count);
  3653. this.owncards.RemoveRange(0, Math.Min(1, this.owncards.Count));
  3654. }
  3655. if (c.name == "lordjaraxxus")
  3656. {
  3657. this.ownHeroAblility = CardDB.Instance.getCardDataFromID("EX1_tk33");
  3658. this.ownHeroName = HeroEnum.lordjaraxxus;
  3659. this.ownHeroHp = c.Hp;
  3660. }
  3661. if (c.name == "flameimp")
  3662. {
  3663. attackOrHealHero(3, own);
  3664. }
  3665. if (c.name == "pitlord")
  3666. {
  3667. attackOrHealHero(5, own);
  3668. }
  3669. if (c.name == "voidterror")
  3670. {
  3671. List<Minion> temp = new List<Minion>();
  3672. if (own)
  3673. {
  3674. temp.AddRange(this.ownMinions);
  3675. }
  3676. else
  3677. {
  3678. temp.AddRange(this.enemyMinions);
  3679. }
  3680. int angr = 0;
  3681. int hp = 0;
  3682. foreach (Minion m in temp)
  3683. {
  3684. if (m.id == position || m.id == position - 1)
  3685. {
  3686. angr += m.Angr;
  3687. hp += m.Hp;
  3688. }
  3689. }
  3690. foreach (Minion m in temp)
  3691. {
  3692. if (m.id == position || m.id == position - 1)
  3693. {
  3694. minionGetDestroyed(m, own);
  3695. }
  3696. }
  3697. minionGetBuffed(c, angr, hp, own);
  3698. }
  3699. if (c.name == "frostwolfwarlord")
  3700. {
  3701. minionGetBuffed(c, this.ownMinions.Count, this.ownMinions.Count, own);
  3702. }
  3703. if (c.name == "bloodsailraider")
  3704. {
  3705. c.Angr += this.ownWeaponAttack;
  3706. }
  3707. if (c.name == "southseadeckhand" && this.ownWeaponDurability >= 1)
  3708. {
  3709. minionGetCharge(c);
  3710. }
  3711. if (c.name == "bloodknight")
  3712. {
  3713. int shilds = 0;
  3714. foreach (Minion m in this.ownMinions)
  3715. {
  3716. if (m.divineshild)
  3717. {
  3718. m.divineshild = false;
  3719. shilds++;
  3720. }
  3721. }
  3722. foreach (Minion m in this.enemyMinions)
  3723. {
  3724. if (m.divineshild)
  3725. {
  3726. m.divineshild = false;
  3727. shilds++;
  3728. }
  3729. }
  3730. minionGetBuffed(c, 3 * shilds, 3 * shilds, own);
  3731. }
  3732. if (c.name == "kingmukla")
  3733. {
  3734. this.enemycarddraw += 2;
  3735. }
  3736. if (c.name == "coldlightoracle")
  3737. {
  3738. //this.enemycarddraw += 2;
  3739. //this.owncarddraw += 2;
  3740. this.drawACard("", true);
  3741. this.drawACard("", true);
  3742. this.drawACard("", false);
  3743. this.drawACard("", false);
  3744. }
  3745. if (c.name == "arathiweaponsmith")
  3746. {
  3747. CardDB.Card wcard = CardDB.Instance.getCardData("battleaxe");
  3748. this.equipWeapon(wcard);
  3749. }
  3750. if (c.name == "bloodsailcorsair")
  3751. {
  3752. this.lowerWeaponDurability(1, false);
  3753. }
  3754. if (c.name == "acidicswampooze")
  3755. {
  3756. this.lowerWeaponDurability(1000, false);
  3757. }
  3758. if (c.name == "noviceengineer")
  3759. {
  3760. //this.owncarddraw++;
  3761. drawACard("",true);
  3762. }
  3763. if (c.name == "gnomishinventor")
  3764. {
  3765. //this.owncarddraw++;
  3766. drawACard("", true);
  3767. }
  3768. if (c.name == "darkscalehealer")
  3769. {
  3770. List<Minion> temp = new List<Minion>(this.ownMinions);
  3771. foreach (Minion m in temp)
  3772. {
  3773. if (this.auchenaiseelenpriesterin)
  3774. { minionGetDamagedOrHealed(m, 2, 0, true); }
  3775. else { minionGetDamagedOrHealed(m, 0, 2, true); }
  3776. }
  3777. if (this.auchenaiseelenpriesterin)
  3778. { attackOrHealHero(2, true); }
  3779. else { attackOrHealHero(-2, true); }
  3780. }
  3781. if (c.name == "nightblade")
  3782. {
  3783. attackOrHealHero(3, !own);
  3784. }
  3785. if (c.name == "twilightdrake")
  3786. {
  3787. minionGetBuffed(c, 0, this.owncards.Count, true);
  3788. }
  3789. if (c.name == "azuredrake")
  3790. {
  3791. //this.owncarddraw++;
  3792. drawACard("", true);
  3793. }
  3794. if (c.name == "harrisonjones")
  3795. {
  3796. this.enemyWeaponAttack = 0;
  3797. //this.owncarddraw += enemyWeaponDurability;
  3798. for (int i = 0; i < enemyWeaponDurability; i++)
  3799. {
  3800. drawACard("", true);
  3801. }
  3802. this.enemyWeaponDurability = 0;
  3803. }
  3804. if (c.name == "guardianofkings")
  3805. {
  3806. attackOrHealHero(-6, true);
  3807. }
  3808. if (c.name == "captaingreenskin")
  3809. {
  3810. if (this.ownWeaponName != "")
  3811. {
  3812. this.ownheroAngr += 1;
  3813. this.ownWeaponAttack++;
  3814. this.ownWeaponDurability++;
  3815. }
  3816. }
  3817. if (c.name == "priestessofelune")
  3818. {
  3819. attackOrHealHero(-4, true);
  3820. }
  3821. if (c.name == "injuredblademaster")
  3822. {
  3823. minionGetDamagedOrHealed(c, 4, 0, true);
  3824. }
  3825. if (c.name == "dreadinfernal")
  3826. {
  3827. List<Minion> temp = new List<Minion>(this.ownMinions);
  3828. foreach (Minion m in temp)
  3829. {
  3830. minionGetDamagedOrHealed(m, 1, 0, true);
  3831. }
  3832. temp.Clear();
  3833. temp.AddRange(this.enemyMinions);
  3834. foreach (Minion m in temp)
  3835. {
  3836. minionGetDamagedOrHealed(m, 1, 0, false);
  3837. }
  3838. attackOrHealHero(1, false);
  3839. attackOrHealHero(1, true);
  3840. }
  3841. if (c.name == "tundrarhino")
  3842. {
  3843. minionGetCharge(c);
  3844. List<Minion> temp = new List<Minion>(this.ownMinions);
  3845. foreach (Minion m in temp)
  3846. {
  3847. if ((TAG_RACE)m.handcard.card.race == TAG_RACE.PET)
  3848. {
  3849. minionGetCharge(m);
  3850. }
  3851. }
  3852. }
  3853. if (c.name == "stampedingkodo")
  3854. {
  3855. List<Minion> temp = new List<Minion>();
  3856. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  3857. temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));//destroys the weakest
  3858. temp.AddRange(temp2);
  3859. foreach (Minion enemy in temp)
  3860. {
  3861. if (enemy.Angr <= 2)
  3862. {
  3863. minionGetDestroyed(enemy, false);
  3864. break;
  3865. }
  3866. }
  3867. }
  3868. if (c.name == "sunfuryprotector")
  3869. {
  3870. List<Minion> temp = new List<Minion>(this.ownMinions);
  3871. foreach (Minion m in temp)
  3872. {
  3873. if (m.id == position - 1 || m.id == position)
  3874. {
  3875. m.taunt = true;
  3876. }
  3877. }
  3878. }
  3879. if (c.name == "ancientmage")
  3880. {
  3881. List<Minion> temp = new List<Minion>(this.ownMinions);
  3882. foreach (Minion m in temp)
  3883. {
  3884. if (m.id == position - 1 || m.id == position )
  3885. {
  3886. m.handcard.card.spellpowervalue++;
  3887. }
  3888. }
  3889. }
  3890. if (c.name == "defenderofargus")
  3891. {
  3892. List<Minion> temp = new List<Minion>(this.ownMinions);
  3893. foreach (Minion m in temp)
  3894. {
  3895. if (m.id == position - 1 || m.id == position)//position and position -1 because its not placed jet
  3896. {
  3897. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_093e");
  3898. e.creator = c.entitiyID;
  3899. e.controllerOfCreator = this.ownController;
  3900. addEffectToMinionNoDoubles(m, e, own);
  3901. }
  3902. }
  3903. }
  3904. if (c.name == "coldlightseer")
  3905. {
  3906. List<Minion> temp = new List<Minion>(this.ownMinions);
  3907. foreach (Minion m in temp)
  3908. {
  3909. if ((TAG_RACE)m.handcard.card.race == TAG_RACE.MURLOC)
  3910. {
  3911. minionGetBuffed(m, 0, 2, true);
  3912. }
  3913. }
  3914. temp.Clear();
  3915. temp.AddRange(this.enemyMinions);
  3916. foreach (Minion m in temp)
  3917. {
  3918. if ((TAG_RACE)m.handcard.card.race == TAG_RACE.MURLOC)
  3919. {
  3920. minionGetBuffed(m, 0, 2, false);
  3921. }
  3922. }
  3923. }
  3924. if (c.name == "deathwing")
  3925. {
  3926. List<Minion> temp = new List<Minion>(this.ownMinions);
  3927. foreach (Minion enemy in temp)
  3928. {
  3929. minionGetDestroyed(enemy, true);
  3930. }
  3931. temp.Clear();
  3932. temp.AddRange(this.enemyMinions);
  3933. foreach (Minion enemy in temp)
  3934. {
  3935. minionGetDestroyed(enemy, false);
  3936. }
  3937. this.owncards.Clear();
  3938. this.owncarddraw = 0;
  3939. this.enemyAnzCards = 0;
  3940. this.enemycarddraw = 0;
  3941. }
  3942. if (c.name == "captainsparrot")
  3943. {
  3944. //this.owncarddraw++;
  3945. drawACard("", true);
  3946. }
  3947. }
  3948. private int spawnKids(CardDB.Card c, int position, bool own, int choice)
  3949. {
  3950. int kids = 0;
  3951. if (c.name == "murloctidehunter")
  3952. {
  3953. kids = 1;
  3954. CardDB.Card kid = CardDB.Instance.getCardData("murlocscout");
  3955. callKid(kid, position, own);
  3956. }
  3957. if (c.name == "razorfenhunter")
  3958. {
  3959. kids = 1;
  3960. CardDB.Card kid = CardDB.Instance.getCardData("boar");
  3961. callKid(kid, position, own);
  3962. }
  3963. if (c.name == "dragonlingmechanic")
  3964. {
  3965. kids = 1;
  3966. CardDB.Card kid = CardDB.Instance.getCardData("mechanicaldragonling");
  3967. callKid(kid, position, own);
  3968. }
  3969. if (c.name == "leeroyjenkins")
  3970. {
  3971. kids = 2;
  3972. CardDB.Card kid = CardDB.Instance.getCardData("whelp");
  3973. int pos = this.ownMinions.Count - 1;
  3974. if (own) pos = this.enemyMinions.Count - 1;
  3975. callKid(kid, pos, !own);
  3976. callKid(kid, pos, !own);
  3977. }
  3978. if (c.name == "cenarius" && choice == 2)
  3979. {
  3980. kids = 2;
  3981. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_573t"); //special treant
  3982. int pos = this.ownMinions.Count - 1;
  3983. if (!own) pos = this.enemyMinions.Count - 1;
  3984. callKid(kid, pos, own);
  3985. callKid(kid, pos, own);
  3986. }
  3987. if (c.name == "silverhandknight")
  3988. {
  3989. kids = 1;
  3990. CardDB.Card kid = CardDB.Instance.getCardData("squire");
  3991. callKid(kid, position, own);
  3992. }
  3993. if (c.name == "gelbinmekkatorque")
  3994. {
  3995. kids = 1;
  3996. CardDB.Card kid = CardDB.Instance.getCardData("homingchicken");
  3997. callKid(kid, position, own);
  3998. }
  3999. if (c.name == "defiasringleader" && this.cardsPlayedThisTurn >= 1) //needs combo for spawn
  4000. {
  4001. kids = 1;
  4002. CardDB.Card kid = CardDB.Instance.getCardData("defiasbandit");
  4003. callKid(kid, position, own);
  4004. }
  4005. if (c.name == "onyxia")
  4006. {
  4007. kids = 7 - this.ownMinions.Count;
  4008. CardDB.Card kid = CardDB.Instance.getCardData("whelp");
  4009. for (int i = 0; i < kids; i++)
  4010. {
  4011. callKid(kid, position, own);
  4012. }
  4013. }
  4014. return kids;
  4015. }
  4016. private void callKid(CardDB.Card c, int placeoffather, bool own)
  4017. {
  4018. if (own && this.ownMinions.Count >= 7) return;
  4019. if (!own && this.enemyMinions.Count >= 7) return;
  4020. int mobplace = placeoffather + 1;
  4021. /*if (own && this.ownMinions.Count >= 1)
  4022. {
  4023. retval.X = ownMinions[mobplace - 1].Posix + 85;
  4024. retval.Y = ownMinions[mobplace - 1].Posiy;
  4025. }
  4026. if (!own && this.enemyMinions.Count >= 1)
  4027. {
  4028. retval.X = enemyMinions[mobplace - 1].Posix + 85;
  4029. retval.Y = enemyMinions[mobplace - 1].Posiy;
  4030. }*/
  4031. Minion m = createNewMinion(new Handmanager.Handcard(c), mobplace, own);
  4032. if (own)
  4033. {
  4034. addMiniontoList(m, this.ownMinions, mobplace, own);// additional minions span next to it!
  4035. }
  4036. else
  4037. {
  4038. addMiniontoList(m, this.enemyMinions, mobplace, own);// additional minions span next to it!
  4039. }
  4040. }
  4041. private Action placeAmobSomewhere(Handmanager.Handcard hc, int cardpos, int target, int choice, int placepos)
  4042. {
  4043. Action a = new Action();
  4044. a.cardplay = true;
  4045. //a.card = new CardDB.Card(c);
  4046. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  4047. a.comboBeforePlayed = (this.cardsPlayedThisTurn >= 1) ? true : false;
  4048. //we place him on the right!
  4049. int mobplace = placepos;
  4050. //create the minion out of the card + effects from other minions, which higher his hp/angr
  4051. // but before additional minions span next to it! (because we buff the minion in createNewMinion and swordofjustice gives summeond minons his buff first!
  4052. int spawnkids = spawnKids(hc.card, mobplace-1, true, choice); // if a mob targets something, it doesnt spawn minions!?
  4053. //create the new minion
  4054. Minion m = createNewMinion(hc, mobplace, true);
  4055. //do the battlecry (where you dont need a target)
  4056. doBattleCryWithoutTargeting(m, mobplace, true, choice);
  4057. if (target >= 0)
  4058. {
  4059. doBattleCryWithTargeting(m, target, choice);
  4060. }
  4061. addMiniontoList(m, this.ownMinions, mobplace, true);
  4062. if (logging) Helpfunctions.Instance.logg("added " + m.handcard.card.name);
  4063. //only for fun :D
  4064. if (target >= 0)
  4065. {
  4066. // the OWNtargets right of the placed mobs are going up :D
  4067. if (target < 10 && target > mobplace + spawnkids) target++;
  4068. }
  4069. a.enemytarget = target;
  4070. a.owntarget = mobplace + 1; //1==before the 1.minion on board , 2 ==before the 2. minion o board (from left)
  4071. return a;
  4072. }
  4073. private void lowerWeaponDurability(int value, bool own)
  4074. {
  4075. if (own)
  4076. {
  4077. this.ownWeaponDurability -= value;
  4078. if (this.ownWeaponDurability <= 0)
  4079. {
  4080. //deathrattle deathsbite
  4081. if (this.ownWeaponName == "deathsbite")
  4082. {
  4083. int anz =1;
  4084. if(this.ownBaronRivendare) anz=2;
  4085. for (int i = 0; i < anz; i++)
  4086. {
  4087. int dmg = getSpellDamageDamage(1);
  4088. List<Minion> temp = new List<Minion>(this.ownMinions);
  4089. foreach (Minion m in temp)
  4090. {
  4091. minionGetDamagedOrHealed(m, 1, 0, true);
  4092. }
  4093. temp.Clear();
  4094. temp.AddRange(this.enemyMinions);
  4095. foreach (Minion m in temp)
  4096. {
  4097. minionGetDamagedOrHealed(m, 1, 0, false);
  4098. }
  4099. }
  4100. }
  4101. this.ownheroAngr -= this.ownWeaponAttack;
  4102. this.ownWeaponDurability = 0;
  4103. this.ownWeaponAttack = 0;
  4104. this.ownWeaponName = "";
  4105. foreach (Minion m in this.ownMinions)
  4106. {
  4107. if (m.playedThisTurn && m.name == "southseadeckhand")
  4108. {
  4109. m.Ready = false;
  4110. m.charge = false;
  4111. }
  4112. }
  4113. }
  4114. }
  4115. else
  4116. {
  4117. this.enemyWeaponDurability -= value;
  4118. if (this.enemyWeaponDurability <= 0)
  4119. {
  4120. //deathrattle deathsbite
  4121. if (this.enemyWeaponName == "deathsbite")
  4122. {
  4123. int anz = 1;
  4124. if (this.enemyBaronRivendare) anz = 2;
  4125. for (int i = 0; i < anz; i++)
  4126. {
  4127. int dmg = getSpellDamageDamage(1);
  4128. List<Minion> temp = new List<Minion>(this.ownMinions);
  4129. foreach (Minion m in temp)
  4130. {
  4131. minionGetDamagedOrHealed(m, 1, 0, true);
  4132. }
  4133. temp.Clear();
  4134. temp.AddRange(this.enemyMinions);
  4135. foreach (Minion m in temp)
  4136. {
  4137. minionGetDamagedOrHealed(m, 1, 0, false);
  4138. }
  4139. }
  4140. }
  4141. this.enemyheroAngr -= this.enemyWeaponAttack;
  4142. this.enemyWeaponDurability = 0;
  4143. this.enemyWeaponAttack = 0;
  4144. this.enemyWeaponName = "";
  4145. }
  4146. }
  4147. }
  4148. private void equipWeapon(CardDB.Card c)
  4149. {
  4150. if (this.ownWeaponDurability >= 1)
  4151. {
  4152. this.lostWeaponDamage += this.ownWeaponDurability * this.ownWeaponAttack * this.ownWeaponAttack;
  4153. this.lowerWeaponDurability(1000, true);
  4154. }
  4155. this.ownheroAngr = c.Attack;
  4156. this.ownWeaponAttack = c.Attack;
  4157. this.ownWeaponDurability = c.Durability;
  4158. this.ownWeaponName = c.name;
  4159. if (c.name == "doomhammer")
  4160. {
  4161. this.ownHeroWindfury = true;
  4162. }
  4163. else
  4164. {
  4165. this.ownHeroWindfury = false;
  4166. }
  4167. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  4168. {
  4169. this.ownHeroReady = true;
  4170. }
  4171. if (c.name == "gladiatorslongbow")
  4172. {
  4173. this.heroImmuneWhileAttacking = true;
  4174. }
  4175. else
  4176. {
  4177. this.heroImmuneWhileAttacking = false;
  4178. }
  4179. foreach (Minion m in this.ownMinions)
  4180. {
  4181. if (m.playedThisTurn && m.name == "southseadeckhand")
  4182. {
  4183. minionGetCharge(m);
  4184. }
  4185. }
  4186. }
  4187. private void playCardWithTarget(Handmanager.Handcard hc, int target, int choice)
  4188. {
  4189. CardDB.Card c = hc.card;
  4190. //play card with target
  4191. int attackbuff = 0;
  4192. int hpbuff = 0;
  4193. int heal = 0;
  4194. int damage = 0;
  4195. bool spott = false;
  4196. bool divineshild = false;
  4197. bool windfury = false;
  4198. bool silence = false;
  4199. bool destroy = false;
  4200. bool frozen = false;
  4201. bool stealth = false;
  4202. bool backtohand = false;
  4203. int backtoHandManaChange = 0;
  4204. bool charge = false;
  4205. bool setHPtoONE = false;
  4206. bool immune = false;
  4207. int adjacentDamage = 0;
  4208. bool sheep = false;
  4209. bool frogg = false;
  4210. //special
  4211. bool geistderahnen = false;
  4212. bool ueberwaeltigendemacht = false;
  4213. bool own = true;
  4214. if (target >= 10 && target < 20)
  4215. {
  4216. own = false;
  4217. }
  4218. Minion m = new Minion();
  4219. if (target < 10)
  4220. {
  4221. m = this.ownMinions[target];
  4222. }
  4223. if (target >= 10 && target < 20)
  4224. {
  4225. m = this.enemyMinions[target - 10];
  4226. }
  4227. //warrior###########################################################################
  4228. if (c.name == "execute")
  4229. {
  4230. destroy = true;
  4231. }
  4232. if (c.name == "innerrage")
  4233. {
  4234. damage = 1;
  4235. attackbuff = 2;
  4236. }
  4237. if (c.name == "slam")
  4238. {
  4239. damage = 2;
  4240. if (m.Hp >= 3)
  4241. {
  4242. //this.owncarddraw++;
  4243. drawACard("", true);
  4244. }
  4245. }
  4246. if (c.name == "mortalstrike")
  4247. {
  4248. damage = 4;
  4249. if (ownHeroHp <= 12) damage = 6;
  4250. }
  4251. if (c.name == "shieldslam")
  4252. {
  4253. damage = this.ownHeroDefence;
  4254. }
  4255. if (c.name == "charge")
  4256. {
  4257. charge = true;
  4258. attackbuff = 2;
  4259. }
  4260. if (c.name == "rampage")
  4261. {
  4262. attackbuff = 3;
  4263. hpbuff = 3;
  4264. }
  4265. //hunter#################################################################################
  4266. if (c.name == "huntersmark")
  4267. {
  4268. setHPtoONE = true;
  4269. }
  4270. if (c.name == "arcaneshot")
  4271. {
  4272. damage = 2;
  4273. }
  4274. if (c.name == "killcommand")
  4275. {
  4276. damage = 3;
  4277. foreach (Minion mnn in this.ownMinions)
  4278. {
  4279. if ((TAG_RACE)mnn.handcard.card.race == TAG_RACE.PET)
  4280. {
  4281. damage = 5;
  4282. }
  4283. }
  4284. }
  4285. if (c.name == "bestialwrath")
  4286. {
  4287. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_549o");
  4288. e.creator = hc.entity;
  4289. e.controllerOfCreator = this.ownController;
  4290. addEffectToMinionNoDoubles(m, e, own);
  4291. }
  4292. if (c.name == "explosiveshot")
  4293. {
  4294. damage = 5;
  4295. adjacentDamage = 2;
  4296. }
  4297. //mage###############################################################################
  4298. if (c.name == "icelance")
  4299. {
  4300. if (target >= 0 && target <= 19)
  4301. {
  4302. if (m.frozen)
  4303. {
  4304. damage = 4;
  4305. }
  4306. else { frozen = true; }
  4307. }
  4308. else
  4309. {
  4310. if (target ==100)
  4311. {
  4312. if (this.ownHeroFrozen)
  4313. {
  4314. damage = 4;
  4315. }
  4316. else
  4317. {
  4318. frozen = true;
  4319. }
  4320. }
  4321. if (target == 200)
  4322. {
  4323. if (this.enemyHeroFrozen)
  4324. {
  4325. damage = 4;
  4326. }
  4327. else
  4328. {
  4329. frozen = true;
  4330. }
  4331. }
  4332. }
  4333. }
  4334. if (c.name == "coneofcold")
  4335. {
  4336. damage = 1;
  4337. adjacentDamage = 1;
  4338. frozen = true;
  4339. }
  4340. if (c.name == "fireball")
  4341. {
  4342. damage = 6;
  4343. }
  4344. if (c.name == "polymorph")
  4345. {
  4346. sheep = true;
  4347. }
  4348. if (c.name == "pyroblast")
  4349. {
  4350. damage = 10;
  4351. }
  4352. if (c.name == "frostbolt")
  4353. {
  4354. damage = 3;
  4355. frozen = true;
  4356. }
  4357. //pala######################################################################
  4358. if (c.name == "humility")
  4359. {
  4360. m.Angr = 1;
  4361. }
  4362. if (c.name == "handofprotection")
  4363. {
  4364. divineshild = true;
  4365. }
  4366. if (c.name == "blessingofmight")
  4367. {
  4368. attackbuff = 3;
  4369. }
  4370. if (c.name == "holylight")
  4371. {
  4372. heal = 6;
  4373. }
  4374. if (c.name == "hammerofwrath")
  4375. {
  4376. damage = 3;
  4377. //this.owncarddraw++;
  4378. drawACard("", true);
  4379. }
  4380. if (c.name == "blessingofkings")
  4381. {
  4382. attackbuff = 4;
  4383. hpbuff = 4;
  4384. }
  4385. if (c.name == "blessingofwisdom")
  4386. {
  4387. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_363e2");
  4388. e.creator = hc.entity;
  4389. e.controllerOfCreator = this.ownController;
  4390. m.enchantments.Add(e);
  4391. }
  4392. if (c.name == "blessedchampion")
  4393. {
  4394. m.Angr *= 2;
  4395. }
  4396. if (c.name == "holywrath")
  4397. {
  4398. damage = 3;
  4399. //this.owncarddraw++;
  4400. drawACard("", true);
  4401. }
  4402. if (c.name == "layonhands")
  4403. {
  4404. for (int i = 0; i < 3; i++)
  4405. {
  4406. //this.owncarddraw++;
  4407. drawACard("", true);
  4408. }
  4409. heal = 8;
  4410. }
  4411. //priest ##########################################
  4412. if (c.name == "shadowmadness")
  4413. {
  4414. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_334e");
  4415. e.creator = hc.entity;
  4416. e.controllerOfCreator = this.ownController;
  4417. addEffectToMinionNoDoubles(m, e, own);
  4418. this.minionGetControlled(m, true, true);
  4419. }
  4420. if (c.name == "mindcontrol")
  4421. {
  4422. this.minionGetControlled(m, true, false);
  4423. }
  4424. if (c.name == "holysmite")
  4425. {
  4426. damage = 2;
  4427. }
  4428. if (c.name == "powerwordshield")
  4429. {
  4430. hpbuff = 2;
  4431. //this.owncarddraw++;
  4432. drawACard("", true);
  4433. }
  4434. if (c.name == "silence")
  4435. {
  4436. silence = true;
  4437. }
  4438. if (c.name == "divinespirit")
  4439. {
  4440. hpbuff = m.Hp;
  4441. }
  4442. if (c.name == "innerfire")
  4443. {
  4444. m.Angr = m.Hp;
  4445. }
  4446. if (c.name == "holyfire")
  4447. {
  4448. damage = 5;
  4449. int ownheal = getSpellHeal(5);
  4450. attackOrHealHero(-ownheal, true);
  4451. }
  4452. if (c.name == "shadowwordpain")
  4453. {
  4454. destroy = true;
  4455. }
  4456. if (c.name == "shadowworddeath")
  4457. {
  4458. destroy = true;
  4459. }
  4460. //rogue ##########################################
  4461. if (c.name == "shadowstep")
  4462. {
  4463. backtohand = true;
  4464. backtoHandManaChange = -2;
  4465. //m.handcard.card.cost = Math.Max(0, m.handcard.card.cost -= 2);
  4466. }
  4467. if (c.name == "sap")
  4468. {
  4469. backtohand = true;
  4470. backtoHandManaChange = 0;
  4471. }
  4472. if (c.name == "shiv")
  4473. {
  4474. damage = 1;
  4475. //this.owncarddraw++;
  4476. drawACard("", true);
  4477. }
  4478. if (c.name == "coldblood")
  4479. {
  4480. attackbuff = 2;
  4481. if (this.cardsPlayedThisTurn >= 1) attackbuff = 4;
  4482. }
  4483. if (c.name == "conceal")
  4484. {
  4485. stealth = true;
  4486. }
  4487. if (c.name == "eviscerate")
  4488. {
  4489. damage = 2;
  4490. if (this.cardsPlayedThisTurn >= 1) damage = 4;
  4491. }
  4492. if (c.name == "betrayal")
  4493. {
  4494. //attack right neightbor
  4495. if (target >= 10 && target < 20 && target < this.enemyMinions.Count + 10 - 1)
  4496. {
  4497. attack(target, target + 1, true);
  4498. }
  4499. if (target < 10 && target < this.ownMinions.Count - 1)
  4500. {
  4501. attack(target, target + 1, true);
  4502. }
  4503. //attack left neightbor
  4504. if (target >= 11 || (target < 10 && target >= 1))
  4505. {
  4506. attack(target, target - 1, true);
  4507. }
  4508. }
  4509. if (c.name == "perditionsblade")
  4510. {
  4511. damage = 1;
  4512. if (this.cardsPlayedThisTurn >= 1) damage = 2;
  4513. }
  4514. if (c.name == "backstab")
  4515. {
  4516. damage = 2;
  4517. }
  4518. if (c.name == "assassinate")
  4519. {
  4520. destroy = true;
  4521. }
  4522. //shaman ##########################################
  4523. if (c.name == "lightningbolt")
  4524. {
  4525. damage = 3;
  4526. }
  4527. if (c.name == "frostshock")
  4528. {
  4529. frozen = true;
  4530. damage = 1;
  4531. }
  4532. if (c.name == "rockbiterweapon")
  4533. {
  4534. if (target <= 20)
  4535. {
  4536. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_045e");
  4537. e.creator = hc.entity;
  4538. e.controllerOfCreator = this.ownController;
  4539. addEffectToMinionNoDoubles(m, e, own);
  4540. }
  4541. else
  4542. {
  4543. if (target == 100)
  4544. {
  4545. this.ownheroAngr += 3;
  4546. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  4547. {
  4548. this.ownHeroReady = true;
  4549. }
  4550. }
  4551. }
  4552. }
  4553. if (c.name == "windfury")
  4554. {
  4555. windfury = true;
  4556. }
  4557. if (c.name == "hex")
  4558. {
  4559. frogg = true;
  4560. }
  4561. if (c.name == "earthshock")
  4562. {
  4563. silence = true;
  4564. damage = 1;
  4565. }
  4566. if (c.name == "ancestralspirit")
  4567. {
  4568. geistderahnen = true;
  4569. }
  4570. if (c.name == "lavaburst")
  4571. {
  4572. damage = 5;
  4573. }
  4574. if (c.name == "ancestralhealing")
  4575. {
  4576. heal = 1000;
  4577. spott = true;
  4578. }
  4579. //hexenmeister ##########################################
  4580. if (c.name == "sacrificialpact")
  4581. {
  4582. destroy = true;
  4583. this.attackOrHealHero(getSpellHeal(5), true); // heal own hero
  4584. }
  4585. if (c.name == "soulfire")
  4586. {
  4587. damage = 4;
  4588. this.owncarddraw--;
  4589. this.owncards.RemoveRange(0, Math.Min(1, this.owncards.Count));
  4590. }
  4591. if (c.name == "poweroverwhelming")
  4592. {
  4593. //only to own mininos
  4594. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_316e");
  4595. e.creator = hc.entity;
  4596. e.controllerOfCreator = this.ownController;
  4597. addEffectToMinionNoDoubles(m, e, true);
  4598. }
  4599. if (c.name == "corruption")
  4600. {
  4601. //only to enemy mininos
  4602. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_063e");
  4603. e.creator = hc.entity;
  4604. e.controllerOfCreator = this.ownController;
  4605. addEffectToMinionNoDoubles(m, e, false);
  4606. }
  4607. if (c.name == "mortalcoil")
  4608. {
  4609. damage = 1;
  4610. if (getSpellDamageDamage(1) >= m.Hp && !m.divineshild && !m.immune)
  4611. {
  4612. //this.owncarddraw++;
  4613. drawACard("", true);
  4614. }
  4615. }
  4616. if (c.name == "drainlife")
  4617. {
  4618. damage = 2;
  4619. attackOrHealHero(2, true);
  4620. }
  4621. if (c.name == "shadowbolt")
  4622. {
  4623. damage = 4;
  4624. }
  4625. if (c.name == "shadowflame")
  4626. {
  4627. int damage1 = getSpellDamageDamage(m.Angr);
  4628. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4629. foreach (Minion mnn in temp)
  4630. {
  4631. minionGetDamagedOrHealed(mnn, damage1, 0, false);
  4632. }
  4633. //destroy own mininon
  4634. destroy = true;
  4635. }
  4636. if (c.name == "demonfire")
  4637. {
  4638. if (m.handcard.card.race == 15 && own)
  4639. {
  4640. attackbuff = 2;
  4641. hpbuff = 2;
  4642. }
  4643. else
  4644. {
  4645. damage = 2;
  4646. }
  4647. }
  4648. if (c.name == "baneofdoom")
  4649. {
  4650. damage = 2;
  4651. if (getSpellDamageDamage(2) >= m.Hp && !m.divineshild && !m.immune)
  4652. {
  4653. int posi = this.ownMinions.Count - 1;
  4654. CardDB.Card kid = CardDB.Instance.getCardData("bloodimp");
  4655. callKid(kid, posi, true);
  4656. }
  4657. }
  4658. if (c.name == "siphonsoul")
  4659. {
  4660. destroy = true;
  4661. attackOrHealHero(3, true);
  4662. }
  4663. //druid #######################################################################
  4664. if (c.name == "moonfire" && c.CardID == "CS2_008")// nicht zu verwechseln mit cenarius choice nummer 1
  4665. {
  4666. damage = 1;
  4667. }
  4668. if (c.name == "markofthewild")
  4669. {
  4670. spott = true;
  4671. attackbuff = 2;
  4672. hpbuff = 2;
  4673. }
  4674. if (c.name == "healingtouch")
  4675. {
  4676. heal = 8;
  4677. }
  4678. if (c.name == "starfire")
  4679. {
  4680. damage = 5;
  4681. //this.owncarddraw++;
  4682. drawACard("", true);
  4683. }
  4684. if (c.name == "naturalize")
  4685. {
  4686. destroy = true;
  4687. this.enemycarddraw += 2;
  4688. }
  4689. if (c.name == "savagery")
  4690. {
  4691. damage = this.ownheroAngr;
  4692. }
  4693. if (c.name == "swipe")
  4694. {
  4695. damage = 4;
  4696. // all others get 1 spelldamage
  4697. int damage1 = getSpellDamageDamage(1);
  4698. if (target != 200)
  4699. {
  4700. attackOrHealHero(damage1, false);
  4701. }
  4702. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4703. foreach (Minion mnn in temp)
  4704. {
  4705. if (mnn.id + 10 != target)
  4706. {
  4707. minionGetDamagedOrHealed(mnn, damage1, 0, false);
  4708. }
  4709. }
  4710. }
  4711. //druid choices##################################################################################
  4712. if (c.name == "wrath")
  4713. {
  4714. if (choice == 1)
  4715. {
  4716. damage = 3;
  4717. }
  4718. if (choice == 2)
  4719. {
  4720. damage = 1;
  4721. //this.owncarddraw++;
  4722. drawACard("", true);
  4723. }
  4724. }
  4725. if (c.name == "markofnature")
  4726. {
  4727. if (choice == 1)
  4728. {
  4729. attackbuff = 4;
  4730. }
  4731. if (choice == 2)
  4732. {
  4733. spott = true;
  4734. hpbuff = 4;
  4735. }
  4736. }
  4737. if (c.name == "starfall")
  4738. {
  4739. if (choice == 1)
  4740. {
  4741. damage = 5;
  4742. }
  4743. }
  4744. //special cards#########################################################################################
  4745. if (c.name == "nightmare")
  4746. {
  4747. //only to own mininos
  4748. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_316e");
  4749. e.creator = hc.entity;
  4750. e.controllerOfCreator = this.ownController;
  4751. addEffectToMinionNoDoubles(m, e, true);
  4752. }
  4753. if (c.name == "dream")
  4754. {
  4755. backtohand = true;
  4756. backtoHandManaChange = 0;
  4757. }
  4758. if (c.name == "bananas")
  4759. {
  4760. attackbuff = 1;
  4761. hpbuff = 1;
  4762. }
  4763. if (c.name == "barreltoss")
  4764. {
  4765. damage = 2;
  4766. }
  4767. if (c.CardID == "PRO_001b")// i am murloc
  4768. {
  4769. damage = 4;
  4770. //this.owncarddraw++;
  4771. drawACard("", true);
  4772. } if (c.name == "willofmukla")
  4773. {
  4774. heal = 6 ;
  4775. }
  4776. //NaxxCards###################################################################################
  4777. if (c.name == "reincarnation")
  4778. {
  4779. int place = m.id;
  4780. if(place >=10) place -=10;
  4781. CardDB.Card d = m.handcard.card;
  4782. minionGetDestroyed(m, own);
  4783. callKid(d, place, own);
  4784. }
  4785. //make effect on target
  4786. //ownminion
  4787. if (damage >= 1) damage = getSpellDamageDamage(damage);
  4788. if (adjacentDamage >= 1) adjacentDamage = getSpellDamageDamage(adjacentDamage);
  4789. if (heal >= 1 && heal < 1000) heal = getSpellHeal(heal);
  4790. if (target < 10)
  4791. {
  4792. if (silence) minionGetSilenced(m, true);
  4793. minionGetBuffed(m, attackbuff, hpbuff, true);
  4794. minionGetDamagedOrHealed(m, damage, heal, true);
  4795. if (spott) m.taunt = true;
  4796. if (charge) minionGetCharge(m);
  4797. if (windfury) minionGetWindfurry(m);
  4798. if (divineshild) m.divineshild = true;
  4799. if (destroy) minionGetDestroyed(m, true);
  4800. if (frozen) m.frozen = true;
  4801. if (stealth) m.stealth = true;
  4802. if (backtohand) minionReturnToHand(m, true,backtoHandManaChange );
  4803. if (immune) m.immune = true;
  4804. if (adjacentDamage >= 1)
  4805. {
  4806. List<Minion> tempolist = new List<Minion>(this.ownMinions);
  4807. foreach (Minion mnn in tempolist)
  4808. {
  4809. if (mnn.id == target + 1 || mnn.id == target - 1)
  4810. {
  4811. minionGetDamagedOrHealed(m, adjacentDamage, 0, own);
  4812. if (frozen) mnn.frozen = true;
  4813. }
  4814. }
  4815. }
  4816. if (sheep) minionTransform(m, CardDB.Instance.getCardDataFromID("CS2_tk1"), own);
  4817. if (frogg) minionTransform(m, CardDB.Instance.getCardDataFromID("hexfrog"), own);
  4818. if (setHPtoONE)
  4819. {
  4820. m.Hp = 1; m.maxHp = 1;
  4821. }
  4822. if (geistderahnen)
  4823. {
  4824. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_038e");
  4825. e.creator = hc.entity;
  4826. e.controllerOfCreator = this.ownController;
  4827. addEffectToMinionNoDoubles(m, e, true);
  4828. }
  4829. }
  4830. //enemyminion
  4831. if (target >= 10 && target < 20)
  4832. {
  4833. if (silence) minionGetSilenced(m, false);
  4834. minionGetBuffed(m, attackbuff, hpbuff, false);
  4835. minionGetDamagedOrHealed(m, damage, heal, false);
  4836. if (spott) m.taunt = true;
  4837. if (charge) minionGetCharge(m);
  4838. if (windfury) minionGetWindfurry(m);
  4839. if (divineshild) m.divineshild = true;
  4840. if (destroy) minionGetDestroyed(m, false);
  4841. if (frozen) m.frozen = true;
  4842. if (stealth) m.stealth = true;
  4843. if (backtohand) minionReturnToHand(m, false,backtoHandManaChange);
  4844. if (immune) m.immune = true;
  4845. if (adjacentDamage >= 1)
  4846. {
  4847. List<Minion> tempolist = new List<Minion>(this.enemyMinions);
  4848. foreach (Minion mnn in tempolist)
  4849. {
  4850. if (mnn.id + 10 == target + 1 || mnn.id + 10 == target - 1)
  4851. {
  4852. minionGetDamagedOrHealed(m, adjacentDamage, 0, own);
  4853. if (frozen) mnn.frozen = true;
  4854. }
  4855. }
  4856. }
  4857. if (sheep) minionTransform(m, CardDB.Instance.getCardDataFromID("CS2_tk1"), own);
  4858. if (frogg) minionTransform(m, CardDB.Instance.getCardDataFromID("hexfrog"), own);
  4859. if (setHPtoONE)
  4860. {
  4861. m.Hp = 1; m.maxHp = 1;
  4862. }
  4863. if (geistderahnen)
  4864. {
  4865. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_038e");
  4866. e.creator = hc.entity;
  4867. e.controllerOfCreator = this.ownController;
  4868. addEffectToMinionNoDoubles(m, e, false);
  4869. }
  4870. }
  4871. if (target == 100)
  4872. {
  4873. if (frozen) this.ownHeroFrozen = true;
  4874. if (damage >= 1) attackOrHealHero(damage, true);
  4875. if (heal >= 1) attackOrHealHero(-heal, true);
  4876. }
  4877. if (target == 200)
  4878. {
  4879. if (frozen) this.enemyHeroFrozen = true;
  4880. if (damage >= 1) attackOrHealHero(damage, false);
  4881. if (heal >= 1) attackOrHealHero(-heal, false);
  4882. }
  4883. }
  4884. private void playCardWithoutTarget(Handmanager.Handcard hc, int choice)
  4885. {
  4886. CardDB.Card c = hc.card;
  4887. //todo faehrtenlesen!
  4888. //play card without target
  4889. if (c.name == "thecoin")
  4890. {
  4891. this.mana++;
  4892. }
  4893. //hunter#########################################################################
  4894. if (c.name == "multi-shot" && this.enemyMinions.Count >= 2)
  4895. {
  4896. List<Minion> temp = new List<Minion>();
  4897. int damage = getSpellDamageDamage(3);
  4898. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  4899. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));//damage the strongest
  4900. temp.AddRange(Helpfunctions.TakeList(temp2, 2));
  4901. foreach (Minion enemy in temp)
  4902. {
  4903. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4904. }
  4905. }
  4906. if (c.name == "animalcompanion")
  4907. {
  4908. CardDB.Card c2 = CardDB.Instance.getCardData("misha");
  4909. int placeoffather = this.ownMinions.Count - 1;
  4910. callKid(c2, placeoffather, true);
  4911. }
  4912. if (c.name == "flare")
  4913. {
  4914. foreach (Minion m in this.ownMinions)
  4915. {
  4916. m.stealth = false;
  4917. }
  4918. foreach (Minion m in this.enemyMinions)
  4919. {
  4920. m.stealth = false;
  4921. }
  4922. //this.owncarddraw++;
  4923. drawACard("", true);
  4924. this.enemySecretCount = 0;
  4925. }
  4926. if (c.name == "unleashthehounds")
  4927. {
  4928. int anz = this.enemyMinions.Count;
  4929. int posi = this.ownMinions.Count - 1;
  4930. CardDB.Card kid = CardDB.Instance.getCardData("hound");
  4931. for (int i = 0; i < anz; i++)
  4932. {
  4933. callKid(kid, posi, true);
  4934. }
  4935. }
  4936. if (c.name == "deadlyshot" && this.enemyMinions.Count >= 1)
  4937. {
  4938. List<Minion> temp = new List<Minion>();
  4939. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  4940. temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));
  4941. temp.AddRange(Helpfunctions.TakeList(temp2, 1));
  4942. foreach (Minion enemy in temp)
  4943. {
  4944. minionGetDestroyed(enemy, false);
  4945. }
  4946. }
  4947. //warrior#########################################################################
  4948. if (c.name == "commandingshout")
  4949. {
  4950. List<Minion> temp = new List<Minion>(this.ownMinions);
  4951. Enchantment e1 = CardDB.getEnchantmentFromCardID("NEW1_036e");
  4952. e1.creator = hc.entity;
  4953. e1.controllerOfCreator = this.ownController;
  4954. Enchantment e2 = CardDB.getEnchantmentFromCardID("NEW1_036e2");
  4955. e2.creator = hc.entity;
  4956. e2.controllerOfCreator = this.ownController;
  4957. foreach (Minion mnn in temp)
  4958. {//cantLowerHPbelowONE
  4959. addEffectToMinionNoDoubles(mnn, e1, true);
  4960. addEffectToMinionNoDoubles(mnn, e2, true);
  4961. mnn.cantLowerHPbelowONE = true;
  4962. }
  4963. }
  4964. if (c.name == "battlerage")
  4965. {
  4966. foreach (Minion mnn in this.ownMinions)
  4967. {
  4968. if (mnn.wounded)
  4969. {
  4970. //this.owncarddraw++;
  4971. drawACard("", true);
  4972. }
  4973. }
  4974. }
  4975. if (c.name == "brawl")
  4976. {
  4977. List<Minion> temp = new List<Minion>(this.ownMinions);
  4978. foreach (Minion mnn in temp)
  4979. {
  4980. minionGetDestroyed(mnn, true);
  4981. }
  4982. temp.Clear();
  4983. temp.AddRange(this.enemyMinions);
  4984. foreach (Minion mnn in temp)
  4985. {
  4986. minionGetDestroyed(mnn,false);
  4987. }
  4988. }
  4989. if (c.name == "cleave" && this.enemyMinions.Count >= 2)
  4990. {
  4991. List<Minion> temp = new List<Minion>();
  4992. int damage = getSpellDamageDamage(2);
  4993. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  4994. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  4995. temp.AddRange(Helpfunctions.TakeList(temp2, 2));
  4996. foreach (Minion enemy in temp)
  4997. {
  4998. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4999. }
  5000. }
  5001. if (c.name == "upgrade")
  5002. {
  5003. if (this.ownWeaponName != "")
  5004. {
  5005. this.ownWeaponAttack++;
  5006. this.ownheroAngr++;
  5007. this.ownWeaponDurability++;
  5008. }
  5009. else
  5010. {
  5011. CardDB.Card wcard = CardDB.Instance.getCardData("heavyaxe");
  5012. this.equipWeapon(wcard);
  5013. }
  5014. }
  5015. if (c.name == "whirlwind")
  5016. {
  5017. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5018. int damage = getSpellDamageDamage(1);
  5019. foreach (Minion enemy in temp)
  5020. {
  5021. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5022. }
  5023. temp.Clear();
  5024. temp = new List<Minion>(this.ownMinions);
  5025. foreach (Minion enemy in temp)
  5026. {
  5027. minionGetDamagedOrHealed(enemy, damage, 0, true);
  5028. }
  5029. }
  5030. if (c.name == "heroicstrike")
  5031. {
  5032. this.ownheroAngr = this.ownheroAngr + 4;
  5033. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  5034. {
  5035. this.ownHeroReady = true;
  5036. }
  5037. }
  5038. if (c.name == "shieldblock")
  5039. {
  5040. this.ownHeroDefence = this.ownHeroDefence + 5;
  5041. //this.owncarddraw++;
  5042. drawACard("", true);
  5043. }
  5044. //mage#########################################################################################
  5045. if (c.name == "blizzard")
  5046. {
  5047. int damage = getSpellDamageDamage(2);
  5048. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5049. int maxHp = 0;
  5050. foreach (Minion enemy in temp)
  5051. {
  5052. enemy.frozen = true;
  5053. if (maxHp < enemy.Hp) maxHp = enemy.Hp;
  5054. minionGetDamagedOrHealed(enemy, damage, 0, false, true);
  5055. }
  5056. this.lostDamage += Math.Max(0, damage - maxHp);
  5057. }
  5058. if (c.name == "arcanemissiles")
  5059. {
  5060. /*List<Minion> temp = new List<Minion>(this.enemyMinions);
  5061. temp.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  5062. int damage = 1;
  5063. int ammount = getSpellDamageDamage(3);
  5064. int i = 0;
  5065. int hp = 0;
  5066. foreach (Minion enemy in temp)
  5067. {
  5068. if (enemy.Hp >= 2)
  5069. {
  5070. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5071. i++;
  5072. hp += enemy.Hp;
  5073. if (i == ammount) break;
  5074. }
  5075. }
  5076. if (i < ammount) attackOrHealHero(ammount - i, false);*/
  5077. int damage = 1;
  5078. int i = 0;
  5079. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5080. int times = this.getSpellDamageDamage(3);
  5081. while (i < times)
  5082. {
  5083. if (temp.Count >= 1)
  5084. {
  5085. temp.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  5086. if (temp[0].Hp == 1 && this.enemyHeroHp >= 2)
  5087. {
  5088. attackOrHealHero(damage, false);
  5089. }
  5090. else
  5091. {
  5092. minionGetDamagedOrHealed(temp[0], damage, 0, false);
  5093. }
  5094. }
  5095. else
  5096. {
  5097. attackOrHealHero(damage, false);
  5098. }
  5099. i++;
  5100. }
  5101. }
  5102. if (c.name == "arcaneintellect")
  5103. {
  5104. //this.owncarddraw++;
  5105. drawACard("", true);
  5106. drawACard("", true);
  5107. }
  5108. if (c.name == "mirrorimage")
  5109. {
  5110. int posi = this.ownMinions.Count - 1;
  5111. CardDB.Card kid = CardDB.Instance.getCardDataFromID("CS2_mirror");
  5112. callKid(kid, posi, true);
  5113. callKid(kid, posi, true);
  5114. }
  5115. if (c.name == "arcaneexplosion")
  5116. {
  5117. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5118. int damage = getSpellDamageDamage(1);
  5119. foreach (Minion enemy in temp)
  5120. {
  5121. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5122. }
  5123. }
  5124. if (c.name == "frostnova")
  5125. {
  5126. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5127. foreach (Minion enemy in temp)
  5128. {
  5129. enemy.frozen = true;
  5130. }
  5131. }
  5132. if (c.name == "flamestrike")
  5133. {
  5134. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5135. int damage = getSpellDamageDamage(4);
  5136. int maxHp = 0;
  5137. foreach (Minion enemy in temp)
  5138. {
  5139. if (maxHp < enemy.Hp) maxHp = enemy.Hp;
  5140. minionGetDamagedOrHealed(enemy, damage, 0, false, true);
  5141. }
  5142. this.lostDamage += Math.Max(0, damage - maxHp);
  5143. }
  5144. //pala#################################################################
  5145. if (c.name == "consecration")
  5146. {
  5147. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5148. int damage = getSpellDamageDamage(2);
  5149. foreach (Minion enemy in temp)
  5150. {
  5151. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5152. }
  5153. attackOrHealHero(damage, false);
  5154. }
  5155. if (c.name == "equality")
  5156. {
  5157. foreach (Minion m in this.ownMinions)
  5158. {
  5159. m.Hp = 1;
  5160. m.maxHp = 1;
  5161. }
  5162. foreach (Minion m in this.enemyMinions)
  5163. {
  5164. m.Hp = 1;
  5165. m.maxHp = 1;
  5166. }
  5167. }
  5168. if (c.name == "divinefavor")
  5169. {
  5170. int enemcardsanz = this.enemyAnzCards + this.enemycarddraw;
  5171. int diff = enemcardsanz - this.owncards.Count;
  5172. if (diff >= 1)
  5173. {
  5174. for (int i = 0; i < diff; i++)
  5175. {
  5176. //this.owncarddraw++;
  5177. drawACard("", true);
  5178. }
  5179. }
  5180. }
  5181. if (c.name == "avengingwrath")
  5182. {
  5183. int damage = 1;
  5184. int i = 0;
  5185. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5186. int times = this.getSpellDamageDamage(8);
  5187. while (i < times)
  5188. {
  5189. if (temp.Count >= 1)
  5190. {
  5191. temp.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  5192. if (temp[0].Hp == 1 && this.enemyHeroHp >= 2)
  5193. {
  5194. attackOrHealHero(damage, false);
  5195. }
  5196. else
  5197. {
  5198. minionGetDamagedOrHealed(temp[0], damage, 0, false);
  5199. }
  5200. }
  5201. else
  5202. {
  5203. attackOrHealHero(damage, false);
  5204. }
  5205. i++;
  5206. }
  5207. }
  5208. //priest ####################################################
  5209. if (c.name == "circleofhealing")
  5210. {
  5211. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5212. int heal = getSpellHeal(4);
  5213. foreach (Minion enemy in temp)
  5214. {
  5215. minionGetDamagedOrHealed(enemy, 0, heal, false);
  5216. }
  5217. temp.Clear();
  5218. temp.AddRange(this.ownMinions);
  5219. foreach (Minion enemy in temp)
  5220. {
  5221. minionGetDamagedOrHealed(enemy, 0, heal, true);
  5222. }
  5223. }
  5224. if (c.name == "thoughtsteal")
  5225. {
  5226. //this.owncarddraw++;
  5227. this.drawACard("enemycard",true);
  5228. //this.owncarddraw++;
  5229. this.drawACard("enemycard",true);
  5230. }
  5231. if (c.name == "mindvision")
  5232. {
  5233. if (this.enemyAnzCards+this.enemycarddraw >= 1)
  5234. {
  5235. //this.owncarddraw++;
  5236. this.drawACard("enemycard",true);
  5237. }
  5238. }
  5239. if (c.name == "shadowform")
  5240. {
  5241. if (this.ownHeroAblility.CardID == "CS1h_001") // lesser heal becomes mind spike
  5242. {
  5243. this.ownHeroAblility = CardDB.Instance.getCardDataFromID("EX1_625t");
  5244. this.ownAbilityReady = true;
  5245. }
  5246. else
  5247. {
  5248. this.ownHeroAblility = CardDB.Instance.getCardDataFromID("EX1_625t2"); // mindspike becomes mind shatter
  5249. this.ownAbilityReady = true;
  5250. }
  5251. }
  5252. if (c.name == "mindgames")
  5253. {
  5254. CardDB.Card copymin = CardDB.Instance.getCardDataFromID("CS2_152"); //we draw a knappe :D (worst case)
  5255. callKid(copymin, this.ownMinions.Count - 1, true);
  5256. }
  5257. if (c.name == "massdispel")
  5258. {
  5259. foreach (Minion m in this.enemyMinions)
  5260. {
  5261. minionGetSilenced(m, false);
  5262. }
  5263. }
  5264. if (c.name == "mindblast")
  5265. {
  5266. int damage = getSpellDamageDamage(5);
  5267. attackOrHealHero(damage, false);
  5268. }
  5269. if (c.name == "holynova")
  5270. {
  5271. List<Minion> temp = new List<Minion>(this.ownMinions);
  5272. int heal = getSpellHeal(2);
  5273. int damage = getSpellDamageDamage(2);
  5274. foreach (Minion enemy in temp)
  5275. {
  5276. minionGetDamagedOrHealed(enemy, 0, heal,true,true);
  5277. }
  5278. attackOrHealHero(-heal, true);
  5279. temp.Clear();
  5280. temp.AddRange(this.enemyMinions);
  5281. foreach (Minion enemy in temp)
  5282. {
  5283. minionGetDamagedOrHealed(enemy, damage, 0, false,true);
  5284. }
  5285. attackOrHealHero(damage, false);
  5286. }
  5287. //rogue #################################################
  5288. if (c.name == "preparation")
  5289. {
  5290. this.playedPreparation = true;
  5291. }
  5292. if (c.name == "bladeflurry")
  5293. {
  5294. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5295. int damage = this.getSpellDamageDamage(this.ownWeaponAttack);
  5296. foreach (Minion enemy in temp)
  5297. {
  5298. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5299. }
  5300. attackOrHealHero(damage, false);
  5301. //destroy own weapon
  5302. this.lowerWeaponDurability(1000, true);
  5303. }
  5304. if (c.name == "headcrack")
  5305. {
  5306. int damage = getSpellDamageDamage(2);
  5307. attackOrHealHero(damage, false);
  5308. if (this.cardsPlayedThisTurn >= 1) this.owncarddraw++; // DONT DRAW A CARD WITH (drawAcard()) because we get this NEXT turn
  5309. }
  5310. if (c.name == "sinisterstrike")
  5311. {
  5312. int damage = getSpellDamageDamage(3);
  5313. attackOrHealHero(damage, false);
  5314. }
  5315. if (c.name == "deadlypoison")
  5316. {
  5317. if (this.ownWeaponName != "")
  5318. {
  5319. this.ownWeaponAttack += 2;
  5320. this.ownheroAngr += 2;
  5321. }
  5322. }
  5323. if (c.name == "fanofknives")
  5324. {
  5325. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5326. int damage = getSpellDamageDamage(1);
  5327. foreach (Minion enemy in temp)
  5328. {
  5329. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5330. }
  5331. drawACard("", true);
  5332. }
  5333. if (c.name == "sprint")
  5334. {
  5335. for (int i = 0; i < 4; i++)
  5336. {
  5337. //this.owncarddraw++;
  5338. drawACard("", true);
  5339. }
  5340. }
  5341. if (c.name == "vanish")
  5342. {
  5343. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5344. int heal = getSpellHeal(4);
  5345. foreach (Minion enemy in temp)
  5346. {
  5347. minionReturnToHand(enemy, false, 0);
  5348. }
  5349. temp.Clear();
  5350. temp.AddRange(this.ownMinions);
  5351. foreach (Minion enemy in temp)
  5352. {
  5353. minionReturnToHand(enemy, true, 0);
  5354. }
  5355. }
  5356. //shaman #################################################
  5357. if (c.name == "forkedlightning" && this.enemyMinions.Count >= 2)
  5358. {
  5359. List<Minion> temp = new List<Minion>();
  5360. int damage = getSpellDamageDamage(2);
  5361. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  5362. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  5363. temp.AddRange(Helpfunctions.TakeList(temp2, 2));
  5364. foreach (Minion enemy in temp)
  5365. {
  5366. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5367. }
  5368. }
  5369. if (c.name == "farsight")
  5370. {
  5371. //this.owncarddraw++;
  5372. drawACard("", true);
  5373. }
  5374. if (c.name == "lightningstorm")
  5375. {
  5376. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5377. int damage = getSpellDamageDamage(2);
  5378. int maxHp = 0;
  5379. foreach (Minion enemy in temp)
  5380. {
  5381. if (maxHp < enemy.Hp) maxHp = enemy.Hp;
  5382. minionGetDamagedOrHealed(enemy, damage, 0, false,true);
  5383. }
  5384. this.lostDamage += Math.Max(0, damage - maxHp);
  5385. }
  5386. if (c.name == "feralspirit")
  5387. {
  5388. int posi = this.ownMinions.Count - 1;
  5389. CardDB.Card kid = CardDB.Instance.getCardData("spiritwolf");
  5390. callKid(kid, posi, true);
  5391. callKid(kid, posi, true);
  5392. }
  5393. if (c.name == "totemicmight")
  5394. {
  5395. List<Minion> temp = new List<Minion>(this.ownMinions);
  5396. foreach (Minion m in temp)
  5397. {
  5398. if (m.handcard.card.race == 21) // if minion is a totem, buff it
  5399. {
  5400. minionGetBuffed(m, 0, 2, true);
  5401. }
  5402. }
  5403. }
  5404. if (c.name == "bloodlust")
  5405. {
  5406. List<Minion> temp = new List<Minion>(this.ownMinions);
  5407. foreach (Minion m in temp)
  5408. {
  5409. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_046e");
  5410. e.creator = this.ownController;
  5411. e.controllerOfCreator = this.ownController;
  5412. addEffectToMinionNoDoubles(m, e, true);
  5413. }
  5414. }
  5415. //hexenmeister #################################################
  5416. if (c.name == "sensedemons")
  5417. {
  5418. //this.owncarddraw += 2;
  5419. this.drawACard("", true);
  5420. this.drawACard("", true);
  5421. }
  5422. if (c.name == "twistingnether")
  5423. {
  5424. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5425. foreach (Minion enemy in temp)
  5426. {
  5427. minionGetDestroyed(enemy, false);
  5428. }
  5429. temp.Clear();
  5430. temp.AddRange(this.ownMinions);
  5431. foreach (Minion enemy in temp)
  5432. {
  5433. minionGetDestroyed(enemy, true);
  5434. }
  5435. }
  5436. if (c.name == "hellfire")
  5437. {
  5438. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5439. int damage = getSpellDamageDamage(3);
  5440. foreach (Minion enemy in temp)
  5441. {
  5442. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5443. }
  5444. temp.Clear();
  5445. temp.AddRange(this.ownMinions);
  5446. foreach (Minion enemy in temp)
  5447. {
  5448. minionGetDamagedOrHealed(enemy, damage, 0, true);
  5449. }
  5450. attackOrHealHero(damage, true);
  5451. attackOrHealHero(damage, false);
  5452. }
  5453. //druid #################################################
  5454. if (c.name == "souloftheforest")
  5455. {
  5456. List<Minion> temp = new List<Minion>(this.ownMinions);
  5457. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_158e");
  5458. e.creator = hc.entity;
  5459. e.controllerOfCreator = this.ownController;
  5460. foreach (Minion enemy in temp)
  5461. {
  5462. addEffectToMinionNoDoubles(enemy, e, true);
  5463. }
  5464. }
  5465. if (c.name == "innervate")
  5466. {
  5467. this.mana = Math.Min(this.mana + 2 ,10);
  5468. }
  5469. if (c.name == "bite")
  5470. {
  5471. this.ownheroAngr += 4;
  5472. this.ownHeroDefence += 4;
  5473. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  5474. {
  5475. this.ownHeroReady = true;
  5476. }
  5477. }
  5478. if (c.name == "claw")
  5479. {
  5480. this.ownheroAngr += 2;
  5481. this.ownHeroDefence += 2;
  5482. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  5483. {
  5484. this.ownHeroReady = true;
  5485. }
  5486. }
  5487. if (c.name == "forceofnature")
  5488. {
  5489. int posi = this.ownMinions.Count - 1;
  5490. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_tk9");//Treant
  5491. callKid(kid, posi, true);
  5492. callKid(kid, posi, true);
  5493. callKid(kid, posi, true);
  5494. }
  5495. if (c.name == "powerofthewild")// macht der wildnis with summoning
  5496. {
  5497. if (choice == 1)
  5498. {
  5499. foreach (Minion m in this.ownMinions)
  5500. {
  5501. minionGetBuffed(m, 1, 1, true);
  5502. }
  5503. }
  5504. if (choice == 2)
  5505. {
  5506. int posi = this.ownMinions.Count - 1;
  5507. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_160t");//panther
  5508. callKid(kid, posi, true);
  5509. }
  5510. }
  5511. if (c.name == "starfall")
  5512. {
  5513. if (choice == 2)
  5514. {
  5515. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5516. int damage = getSpellDamageDamage(2);
  5517. foreach (Minion enemy in temp)
  5518. {
  5519. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5520. }
  5521. }
  5522. }
  5523. if (c.name == "nourish")
  5524. {
  5525. if (choice == 1)
  5526. {
  5527. if (this.ownMaxMana == 10)
  5528. {
  5529. //this.owncarddraw++;
  5530. this.drawACard("excessmana",true);
  5531. }
  5532. else
  5533. {
  5534. this.ownMaxMana++;
  5535. this.mana++;
  5536. }
  5537. if (this.ownMaxMana == 10)
  5538. {
  5539. //this.owncarddraw++;
  5540. this.drawACard("excessmana",true);
  5541. }
  5542. else
  5543. {
  5544. this.ownMaxMana++;
  5545. this.mana++;
  5546. }
  5547. }
  5548. if (choice == 2)
  5549. {
  5550. //this.owncarddraw+=3;
  5551. this.drawACard("", true);
  5552. this.drawACard("", true);
  5553. this.drawACard("", true);
  5554. }
  5555. }
  5556. if (c.name == "savageroar")
  5557. {
  5558. List<Minion> temp = new List<Minion>(this.ownMinions);
  5559. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_011o");
  5560. e.creator = hc.entity;
  5561. e.controllerOfCreator = this.ownController;
  5562. foreach (Minion m in temp)
  5563. {
  5564. addEffectToMinionNoDoubles(m, e, true);
  5565. }
  5566. this.ownheroAngr += 2;
  5567. }
  5568. //special cards#######################
  5569. if (c.CardID == "PRO_001a")// i am murloc
  5570. {
  5571. int posi = this.ownMinions.Count - 1;
  5572. CardDB.Card kid = CardDB.Instance.getCardDataFromID("PRO_001at");//panther
  5573. callKid(kid, posi, true);
  5574. callKid(kid, posi, true);
  5575. callKid(kid, posi, true);
  5576. }
  5577. if (c.CardID == "PRO_001c")// i am murloc
  5578. {
  5579. int posi = this.ownMinions.Count - 1;
  5580. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_021");//scharfseher
  5581. callKid(kid, posi, true);
  5582. }
  5583. if (c.name == "wildgrowth")
  5584. {
  5585. if (this.ownMaxMana == 10)
  5586. {
  5587. //this.owncarddraw++;
  5588. this.drawACard("excessmana",true);
  5589. }
  5590. else
  5591. {
  5592. this.ownMaxMana++;
  5593. }
  5594. }
  5595. if (c.name == "excessmana")
  5596. {
  5597. //this.owncarddraw++;
  5598. this.drawACard("", true);
  5599. }
  5600. if (c.name == "yseraawakens")
  5601. {
  5602. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5603. int damage = getSpellDamageDamage(5);
  5604. foreach (Minion enemy in temp)
  5605. {
  5606. if (enemy.name != "ysera")// dont attack ysera
  5607. {
  5608. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5609. }
  5610. }
  5611. temp.Clear();
  5612. temp.AddRange(this.ownMinions);
  5613. foreach (Minion enemy in temp)
  5614. {
  5615. if (enemy.name != "ysera")//dont attack ysera
  5616. {
  5617. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5618. }
  5619. }
  5620. attackOrHealHero(damage, true);
  5621. attackOrHealHero(damage, false);
  5622. }
  5623. if (c.name == "stomp")
  5624. {
  5625. List<Minion> temp = new List<Minion>(this.enemyMinions);
  5626. int damage = getSpellDamageDamage(2);
  5627. foreach (Minion enemy in temp)
  5628. {
  5629. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5630. }
  5631. }
  5632. //NaxxCards###################################################################################
  5633. if (c.name == "poisonseeds")
  5634. {
  5635. int ownanz= this.ownMinions.Count;
  5636. int enemanz = this.enemyMinions.Count;
  5637. foreach (Minion mnn in this.ownMinions)
  5638. {
  5639. minionGetDestroyed(mnn, true);
  5640. }
  5641. foreach (Minion mnn in this.enemyMinions)
  5642. {
  5643. minionGetDestroyed(mnn, false);
  5644. }
  5645. for (int i = 0; i < ownanz; i++)
  5646. {
  5647. CardDB.Card d = CardDB.Instance.getCardDataFromID("EX1_158t");
  5648. callKid(d, 0, true);
  5649. }
  5650. for (int i = 0; i < enemanz; i++)
  5651. {
  5652. CardDB.Card d = CardDB.Instance.getCardDataFromID("EX1_158t");
  5653. callKid(d, 0, false);
  5654. }
  5655. }
  5656. }
  5657. private void drawACard(string ss, bool own)
  5658. {
  5659. string s = ss;
  5660. if (s == "") s = "unknown";
  5661. if (s == "enemycard") s = "unknown"; // NO PENALITY FOR DRAWING TO MUCH CARDS
  5662. // cant hold more than 10 cards
  5663. if (own)
  5664. {
  5665. if (s == "unknown") // draw a card from deck :D
  5666. {
  5667. if (ownDeckSize == 0)
  5668. {
  5669. this.ownHeroFatigue++;
  5670. this.attackOrHealHero(this.ownHeroFatigue, true);
  5671. }
  5672. else
  5673. {
  5674. this.ownDeckSize--;
  5675. if (this.owncards.Count >= 10)
  5676. {
  5677. this.evaluatePenality += 5;
  5678. return;
  5679. }
  5680. this.owncarddraw++;
  5681. }
  5682. }
  5683. else
  5684. {
  5685. if (this.owncards.Count >= 10)
  5686. {
  5687. this.evaluatePenality += 5;
  5688. return;
  5689. }
  5690. this.owncarddraw++;
  5691. }
  5692. }
  5693. else
  5694. {
  5695. if (s == "unknown") // draw a card from deck :D
  5696. {
  5697. if (enemyDeckSize == 0)
  5698. {
  5699. this.enemyHeroFatigue++;
  5700. this.attackOrHealHero(this.enemyHeroFatigue, false);
  5701. }
  5702. else
  5703. {
  5704. this.enemyDeckSize--;
  5705. if (this.enemyAnzCards + this.enemycarddraw >= 10)
  5706. {
  5707. this.evaluatePenality += 5;
  5708. return;
  5709. }
  5710. this.enemycarddraw++;
  5711. }
  5712. }
  5713. else
  5714. {
  5715. if (this.enemyAnzCards + this.enemycarddraw >= 10)
  5716. {
  5717. this.evaluatePenality += 5;
  5718. return;
  5719. }
  5720. this.enemycarddraw++;
  5721. }
  5722. return;
  5723. }
  5724. if (s == "unknown")
  5725. {
  5726. CardDB.Card plchldr = new CardDB.Card();
  5727. plchldr.name = "unknown";
  5728. Handmanager.Handcard hc = new Handmanager.Handcard();
  5729. hc.card = plchldr;
  5730. hc.position = this.owncards.Count + 1;
  5731. hc.manacost = 1000;
  5732. this.owncards.Add(hc);
  5733. }
  5734. else
  5735. {
  5736. CardDB.Card c = CardDB.Instance.getCardData(s);
  5737. Handmanager.Handcard hc = new Handmanager.Handcard();
  5738. hc.card = c;
  5739. hc.position = this.owncards.Count + 1;
  5740. hc.manacost = c.calculateManaCost(this);
  5741. this.owncards.Add(hc);
  5742. }
  5743. }
  5744. private void triggerPlayedAMinion(Handmanager.Handcard hc, bool own)
  5745. {
  5746. if (own) // effects only for OWN minons
  5747. {
  5748. List<Minion> tempo = new List<Minion>(this.ownMinions);
  5749. foreach (Minion m in tempo)
  5750. {
  5751. if (m.silenced) continue;
  5752. if (m.handcard.card.specialMin == CardDB.specialMinions.knifejuggler && m.entitiyID != hc.entity)
  5753. {
  5754. if (this.enemyMinions.Count >= 1)
  5755. {
  5756. List<Minion> temp = new List<Minion>();
  5757. int damage = 1;
  5758. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  5759. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  5760. temp.AddRange(Helpfunctions.TakeList(temp2, 1));
  5761. foreach (Minion enemy in temp)
  5762. {
  5763. minionGetDamagedOrHealed(enemy, damage, 0, false);
  5764. }
  5765. }
  5766. else
  5767. {
  5768. this.attackOrHealHero(1, false);
  5769. }
  5770. }
  5771. if (own && m.handcard.card.specialMin == CardDB.specialMinions.starvingbuzzard && (TAG_RACE)hc.card.race == TAG_RACE.PET && m.entitiyID != hc.entity)
  5772. {
  5773. //this.owncarddraw++;
  5774. this.drawACard("", true);
  5775. }
  5776. if (own && m.handcard.card.specialMin == CardDB.specialMinions.undertaker && hc.card.deathrattle)
  5777. {
  5778. minionGetBuffed(m, 1, 1, own);
  5779. }
  5780. }
  5781. }
  5782. //effects for ALL minons
  5783. List<Minion> tempoo = new List<Minion>(this.ownMinions);
  5784. foreach (Minion m in tempoo)
  5785. {
  5786. if (m.silenced) continue;
  5787. if (m.handcard.card.specialMin== CardDB.specialMinions.murloctidecaller && hc.card.race == 14 && m.entitiyID != hc.entity)
  5788. {
  5789. minionGetBuffed(m, 1, 0, true);
  5790. }
  5791. if (m.handcard.card.specialMin == CardDB.specialMinions.oldmurkeye && hc.card.race == 14 && m.entitiyID != hc.entity)
  5792. {
  5793. minionGetBuffed(m, 1, 0, true);
  5794. }
  5795. }
  5796. tempoo.Clear();
  5797. tempoo.AddRange(this.enemyMinions);
  5798. foreach (Minion m in tempoo)
  5799. {
  5800. if (m.silenced) continue;
  5801. //truebaugederalte
  5802. if (m.handcard.card.specialMin == CardDB.specialMinions.murloctidecaller && hc.card.race == 14 && m.entitiyID != hc.entity)
  5803. {
  5804. minionGetBuffed(m, 1, 0, false);
  5805. }
  5806. if (m.handcard.card.specialMin == CardDB.specialMinions.oldmurkeye && hc.card.race == 14 && m.entitiyID != hc.entity)
  5807. {
  5808. minionGetBuffed(m, 1, 0, false);
  5809. }
  5810. }
  5811. }
  5812. private void triggerPlayedASpell(CardDB.Card c)
  5813. {
  5814. bool wilderpyro = false;
  5815. List<Minion> temp = new List<Minion>(this.ownMinions);
  5816. foreach (Minion m in temp)
  5817. {
  5818. if (m.silenced) continue;
  5819. if (m.handcard.card.specialMin == CardDB.specialMinions.manawyrm)
  5820. {
  5821. minionGetBuffed(m, 1, 0, true);
  5822. }
  5823. if (m.handcard.card.specialMin == CardDB.specialMinions.manaaddict)
  5824. {
  5825. minionGetBuffed(m, 2, 0, true);
  5826. }
  5827. if (m.handcard.card.specialMin == CardDB.specialMinions.secretkeeper && c.Secret)
  5828. {
  5829. minionGetBuffed(m, 1, 1, true);
  5830. }
  5831. if (m.handcard.card.specialMin == CardDB.specialMinions.archmageantonidas)
  5832. {
  5833. drawACard("fireball",true);
  5834. }
  5835. if (m.handcard.card.specialMin == CardDB.specialMinions.violetteacher)
  5836. {
  5837. CardDB.Card d = CardDB.Instance.getCardData("violetapprentice");
  5838. callKid(d, m.id, true);
  5839. }
  5840. if (m.handcard.card.specialMin == CardDB.specialMinions.gadgetzanauctioneer)
  5841. {
  5842. //this.owncarddraw++;
  5843. drawACard("",true);
  5844. }
  5845. if (m.handcard.card.specialMin == CardDB.specialMinions.wildpyromancer)
  5846. {
  5847. wilderpyro = true;
  5848. }
  5849. }
  5850. foreach (Minion m in this.enemyMinions)
  5851. {
  5852. if (m.handcard.card.specialMin == CardDB.specialMinions.secretkeeper && c.Secret)
  5853. {
  5854. minionGetBuffed(m, 1, 1, true);
  5855. }
  5856. }
  5857. if (wilderpyro)
  5858. {
  5859. temp.Clear();
  5860. temp.AddRange(this.ownMinions);
  5861. foreach (Minion m in temp)
  5862. {
  5863. if (m.silenced) continue;
  5864. if (m.handcard.card.specialMin == CardDB.specialMinions.wildpyromancer)
  5865. {
  5866. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  5867. foreach (Minion mnn in temp2)
  5868. {
  5869. minionGetDamagedOrHealed(mnn, 1, 0, true);
  5870. }
  5871. temp2.Clear();
  5872. temp2.AddRange(this.enemyMinions);
  5873. foreach (Minion mnn in temp2)
  5874. {
  5875. minionGetDamagedOrHealed(mnn, 1, 0, false);
  5876. }
  5877. }
  5878. }
  5879. }
  5880. }
  5881. public void removeCard(Handmanager.Handcard hcc)
  5882. {
  5883. this.owncards.RemoveAll(x => x.entity == hcc.entity);
  5884. int i = 1;
  5885. foreach (Handmanager.Handcard hc in this.owncards)
  5886. {
  5887. hc.position = i;
  5888. i++;
  5889. }
  5890. }
  5891. public void playCard(Handmanager.Handcard hc, int cardpos, int cardEntity, int target, int targetEntity, int choice, int placepos, int penality)
  5892. {
  5893. CardDB.Card c = hc.card;
  5894. this.evaluatePenality += penality;
  5895. // lock at frostnova (click) / frostblitz (no click)
  5896. this.mana = this.mana - hc.getManaCost(this);
  5897. removeCard(hc);// remove card
  5898. if (c.Secret)
  5899. {
  5900. this.ownSecretsIDList.Add(c.CardID);
  5901. this.playedmagierinderkirintor = false;
  5902. }
  5903. if (c.type == CardDB.cardtype.SPELL) this.playedPreparation = false;
  5904. //Helpfunctions.Instance.logg("play crd " + c.name + " entitiy# " + cardEntity + " mana " + hc.getManaCost(this) + " trgt " + target);
  5905. if (logging) Helpfunctions.Instance.logg("play crd " + c.name + " entitiy# " + cardEntity + " mana " + hc.getManaCost(this) + " trgt " + target);
  5906. if (c.type == CardDB.cardtype.MOB)
  5907. {
  5908. Action b = this.placeAmobSomewhere(hc, cardpos, target, choice,placepos);
  5909. b.handcard = new Handmanager.Handcard(hc);
  5910. b.druidchoice = choice;
  5911. b.owntarget = placepos;
  5912. b.enemyEntitiy = targetEntity;
  5913. b.cardEntitiy = cardEntity;
  5914. this.playactions.Add(b);
  5915. this.mobsplayedThisTurn++;
  5916. if (c.name == "kirintormage") this.playedmagierinderkirintor = true;
  5917. }
  5918. else
  5919. {
  5920. Action a = new Action();
  5921. a.cardplay = true;
  5922. a.handcard = new Handmanager.Handcard(hc);
  5923. a.cardEntitiy = cardEntity;
  5924. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  5925. a.comboBeforePlayed = (this.cardsPlayedThisTurn >= 1) ? true : false;
  5926. a.owntarget = 0;
  5927. if (target >= 0)
  5928. {
  5929. a.owntarget = -1;
  5930. }
  5931. a.enemytarget = target;
  5932. a.enemyEntitiy = targetEntity;
  5933. a.druidchoice = choice;
  5934. if (target == -1)
  5935. {
  5936. //card with no target
  5937. if (c.type == CardDB.cardtype.WEAPON)
  5938. {
  5939. equipWeapon(c);
  5940. }
  5941. playCardWithoutTarget(hc, choice);
  5942. }
  5943. else //before : if(target >=0 && target < 20)
  5944. {
  5945. if (c.type == CardDB.cardtype.WEAPON)
  5946. {
  5947. equipWeapon(c);
  5948. }
  5949. playCardWithTarget(hc, target, choice);
  5950. }
  5951. this.playactions.Add(a);
  5952. if (c.type == CardDB.cardtype.SPELL)
  5953. {
  5954. this.triggerPlayedASpell(c);
  5955. }
  5956. }
  5957. triggerACardGetPlayed(c);
  5958. this.ueberladung += c.recallValue;
  5959. this.cardsPlayedThisTurn++;
  5960. }
  5961. private void triggerACardGetPlayed(CardDB.Card c)
  5962. {
  5963. List<Minion> temp = new List<Minion>(this.ownMinions);
  5964. foreach (Minion mnn in temp)
  5965. {
  5966. if (mnn.silenced) continue;
  5967. if (mnn.handcard.card.specialMin == CardDB.specialMinions.illidanstormrage)
  5968. {
  5969. CardDB.Card d = CardDB.Instance.getCardData("flameofazzinoth");
  5970. callKid(d, mnn.id, true);
  5971. }
  5972. if (mnn.handcard.card.specialMin == CardDB.specialMinions.questingadventurer)
  5973. {
  5974. minionGetBuffed(mnn, 1, 1, true);
  5975. }
  5976. if (mnn.handcard.card.specialMin == CardDB.specialMinions.unboundelemental && c.recallValue >= 1)
  5977. {
  5978. minionGetBuffed(mnn, 1, 1, true);
  5979. }
  5980. }
  5981. }
  5982. public void attackWithWeapon(int target, int targetEntity, int penality)
  5983. {
  5984. //this.ownHeroAttackedInRound = true;
  5985. this.ownHeroNumAttackThisTurn++;
  5986. if ((this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 2) || (!this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1))
  5987. {
  5988. this.ownHeroReady = false;
  5989. }
  5990. Action a = new Action();
  5991. a.heroattack = true;
  5992. a.enemytarget = target;
  5993. a.enemyEntitiy = targetEntity;
  5994. a.owntarget = 100;
  5995. a.ownEntitiy = this.ownHeroEntity;
  5996. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  5997. a.comboBeforePlayed = (this.cardsPlayedThisTurn >= 1) ? true : false;
  5998. this.playactions.Add(a);
  5999. if (this.ownWeaponName == "truesilverchampion")
  6000. {
  6001. this.attackOrHealHero(-2, true);
  6002. }
  6003. if (logging) Helpfunctions.Instance.logg("attck with weapon " + a.owntarget + " " + a.ownEntitiy + " trgt: " + a.enemytarget + " " + a.enemyEntitiy);
  6004. if (target == 200)
  6005. {
  6006. attackOrHealHero(this.ownheroAngr, false);
  6007. }
  6008. else
  6009. {
  6010. Minion enemy = this.enemyMinions[target - 10];
  6011. minionGetDamagedOrHealed(enemy, this.ownheroAngr, 0, false);
  6012. if (!this.heroImmuneWhileAttacking)
  6013. {
  6014. attackOrHealHero(enemy.Angr, true);
  6015. if (!enemy.silenced && enemy.handcard.card.specialMin == CardDB.specialMinions.waterelemental)
  6016. {
  6017. this.ownHeroFrozen = true;
  6018. }
  6019. }
  6020. }
  6021. //todo
  6022. if (ownWeaponName == "gorehowl" && target != 200)
  6023. {
  6024. this.ownWeaponAttack--;
  6025. this.ownheroAngr--;
  6026. }
  6027. else
  6028. {
  6029. this.lowerWeaponDurability(1, true);
  6030. }
  6031. }
  6032. public void ENEMYattackWithWeapon(int target, int targetEntity, int penality)
  6033. {
  6034. //this.ownHeroAttackedInRound = true;
  6035. this.enemyHeroNumAttackThisTurn++;
  6036. if ((this.enemyHeroWindfury && this.enemyHeroNumAttackThisTurn == 2) || (!this.enemyHeroWindfury && this.enemyHeroNumAttackThisTurn == 1))
  6037. {
  6038. this.enemyHeroReady = false;
  6039. }
  6040. if (this.enemyWeaponName == "truesilverchampion")
  6041. {
  6042. this.attackOrHealHero(-2,false);
  6043. }
  6044. if (logging) Helpfunctions.Instance.logg("enemy attck with weapon trgt: " + target + " " + targetEntity);
  6045. if (target == 100)
  6046. {
  6047. attackOrHealHero(this.enemyheroAngr,true);
  6048. }
  6049. else
  6050. {
  6051. Minion enemy = this.ownMinions[target];
  6052. minionGetDamagedOrHealed(enemy, this.enemyheroAngr, 0,true);
  6053. if (!this.enemyheroImmuneWhileAttacking)
  6054. {
  6055. attackOrHealHero(enemy.Angr, false);
  6056. if (!enemy.silenced && enemy.handcard.card.specialMin == CardDB.specialMinions.waterelemental)
  6057. {
  6058. this.enemyHeroFrozen = true;
  6059. }
  6060. }
  6061. }
  6062. //todo
  6063. if (enemyWeaponName == "gorehowl" && target != 100)
  6064. {
  6065. this.enemyWeaponAttack--;
  6066. this.enemyheroAngr--;
  6067. }
  6068. else
  6069. {
  6070. this.lowerWeaponDurability(1, false);
  6071. }
  6072. }
  6073. public void activateAbility(CardDB.Card c, int target, int targetEntity, int penality)
  6074. {
  6075. this.evaluatePenality += penality;
  6076. HeroEnum heroname = this.ownHeroName;
  6077. this.ownAbilityReady = false;
  6078. this.mana -= 2;
  6079. Action a = new Action();
  6080. a.useability = true;
  6081. a.handcard = new Handmanager.Handcard(c);
  6082. a.enemytarget = target;
  6083. a.enemyEntitiy = targetEntity;
  6084. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  6085. a.comboBeforePlayed = (this.cardsPlayedThisTurn >= 1) ? true : false;
  6086. this.playactions.Add(a);
  6087. if (logging) Helpfunctions.Instance.logg("play ability on target " + target);
  6088. if (heroname == HeroEnum.mage)
  6089. {
  6090. int damage = 1;
  6091. if (target == 100)
  6092. {
  6093. attackOrHealHero(damage, true);
  6094. }
  6095. else
  6096. {
  6097. if (target == 200)
  6098. {
  6099. attackOrHealHero(damage, false);
  6100. }
  6101. else
  6102. {
  6103. if (target < 10)
  6104. {
  6105. Minion m = this.ownMinions[target];
  6106. this.minionGetDamagedOrHealed(m, damage, 0, true);
  6107. }
  6108. if (target >= 10 && target < 20)
  6109. {
  6110. Minion m = this.enemyMinions[target - 10];
  6111. this.minionGetDamagedOrHealed(m, damage, 0, false);
  6112. }
  6113. }
  6114. }
  6115. }
  6116. if (heroname == HeroEnum.priest)
  6117. {
  6118. int heal = 2;
  6119. if (this.auchenaiseelenpriesterin) heal = -2;
  6120. if (c.name == "mindspike")
  6121. {
  6122. heal = -1 * 2;
  6123. }
  6124. if (c.name == "mindshatter")
  6125. {
  6126. heal = -1 * 3;
  6127. }
  6128. if (target == 100)
  6129. {
  6130. attackOrHealHero(-1 * heal, true);
  6131. }
  6132. else
  6133. {
  6134. if (target == 200)
  6135. {
  6136. attackOrHealHero(-1 * heal, false);
  6137. }
  6138. else
  6139. {
  6140. if (target < 10)
  6141. {
  6142. Minion m = this.ownMinions[target];
  6143. this.minionGetDamagedOrHealed(m, 0, heal, true);
  6144. }
  6145. if (target >= 10 && target < 20)
  6146. {
  6147. Minion m = this.enemyMinions[target - 10];
  6148. this.minionGetDamagedOrHealed(m, 0, heal, false);
  6149. }
  6150. }
  6151. }
  6152. }
  6153. if (heroname == HeroEnum.warrior)
  6154. {
  6155. this.ownHeroDefence += 2;
  6156. }
  6157. if (heroname == HeroEnum.warlock)
  6158. {
  6159. //this.owncarddraw++;
  6160. this.drawACard("", true);
  6161. this.attackOrHealHero(2, true);
  6162. }
  6163. if (heroname == HeroEnum.thief)
  6164. {
  6165. CardDB.Card wcard = CardDB.Instance.getCardData("wickedknife");
  6166. this.equipWeapon(wcard);
  6167. }
  6168. if (heroname == HeroEnum.druid)
  6169. {
  6170. this.ownheroAngr += 1;
  6171. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  6172. {
  6173. this.ownHeroReady = true;
  6174. }
  6175. this.ownHeroDefence += 1;
  6176. }
  6177. if (heroname == HeroEnum.hunter)
  6178. {
  6179. this.attackOrHealHero(2, false);
  6180. }
  6181. if (heroname == HeroEnum.pala)
  6182. {
  6183. int posi = this.ownMinions.Count - 1;
  6184. CardDB.Card kid = CardDB.Instance.getCardData("silverhandrecruit");
  6185. callKid(kid, posi, true);
  6186. }
  6187. if (heroname == HeroEnum.shaman)
  6188. {
  6189. int posi = this.ownMinions.Count - 1;
  6190. CardDB.Card kid = CardDB.Instance.getCardData("healingtotem");
  6191. callKid(kid, posi, true);
  6192. }
  6193. if (heroname == HeroEnum.lordjaraxxus)
  6194. {
  6195. int posi = this.ownMinions.Count - 1;
  6196. CardDB.Card kid = CardDB.Instance.getCardData("infernal");
  6197. callKid(kid, posi, true);
  6198. }
  6199. }
  6200. public void ENEMYactivateAbility(CardDB.Card c, int target, int targetEntity)
  6201. {
  6202. HeroEnum heroname = this.enemyHeroName;
  6203. this.enemyAbilityReady = false;
  6204. if (logging) Helpfunctions.Instance.logg("enemy play ability on target " + target);
  6205. if (heroname == HeroEnum.mage)
  6206. {
  6207. int damage = 1;
  6208. if (target == 100)
  6209. {
  6210. attackOrHealHero(damage, true);
  6211. }
  6212. else
  6213. {
  6214. if (target == 200)
  6215. {
  6216. attackOrHealHero(damage, false);
  6217. }
  6218. else
  6219. {
  6220. if (target < 10)
  6221. {
  6222. Minion m = this.ownMinions[target];
  6223. this.minionGetDamagedOrHealed(m, damage, 0, true);
  6224. }
  6225. if (target >= 10 && target < 20)
  6226. {
  6227. Minion m = this.enemyMinions[target - 10];
  6228. this.minionGetDamagedOrHealed(m, damage, 0, false);
  6229. }
  6230. }
  6231. }
  6232. }
  6233. if (heroname == HeroEnum.priest)
  6234. {
  6235. int heal = 2;
  6236. if (this.auchenaiseelenpriesterin) heal = -2;
  6237. if (c.name == "mindspike")
  6238. {
  6239. heal = -1 * 2;
  6240. }
  6241. if (c.name == "mindshatter")
  6242. {
  6243. heal = -1 * 3;
  6244. }
  6245. if (target == 100)
  6246. {
  6247. if (heal >= 1) return;
  6248. attackOrHealHero(-1 * heal, true);
  6249. }
  6250. else
  6251. {
  6252. if (target == 200)
  6253. {
  6254. if (heal >= 1)
  6255. {
  6256. bool haslightwarden = false;
  6257. foreach (Minion mnn in this.enemyMinions)
  6258. {
  6259. if (mnn.handcard.card.specialMin == CardDB.specialMinions.lightwarden)
  6260. {
  6261. haslightwarden = true;
  6262. break;
  6263. }
  6264. }
  6265. if (!haslightwarden) return;
  6266. }
  6267. attackOrHealHero(-1 * heal, false);
  6268. }
  6269. else
  6270. {
  6271. if (target < 10)
  6272. {
  6273. Minion m = this.ownMinions[target];
  6274. this.minionGetDamagedOrHealed(m, 0, heal, true);
  6275. }
  6276. if (target >= 10 && target < 20)
  6277. {
  6278. Minion m = this.enemyMinions[target - 10];
  6279. this.minionGetDamagedOrHealed(m, 0, heal, false);
  6280. }
  6281. }
  6282. }
  6283. }
  6284. if (heroname == HeroEnum.warrior)
  6285. {
  6286. this.enemyHeroDefence += 2;
  6287. }
  6288. if (heroname == HeroEnum.warlock)
  6289. {
  6290. //this.owncarddraw++;
  6291. this.drawACard("", false);
  6292. this.attackOrHealHero(2, false);
  6293. }
  6294. if (heroname == HeroEnum.thief)
  6295. {
  6296. CardDB.Card wcard = CardDB.Instance.getCardData("wickedknife");
  6297. this.enemyheroAngr = wcard.Attack;
  6298. this.enemyWeaponAttack = wcard.Attack;
  6299. this.enemyWeaponDurability = wcard.Durability;
  6300. this.enemyHeroWindfury = false;
  6301. if ((this.enemyHeroNumAttackThisTurn == 0 || (this.enemyHeroWindfury && this.enemyHeroNumAttackThisTurn == 1)) && !this.enemyHeroFrozen)
  6302. {
  6303. this.enemyHeroReady = true;
  6304. }
  6305. }
  6306. if (heroname == HeroEnum.druid)
  6307. {
  6308. this.enemyheroAngr += 1;
  6309. if ((this.enemyHeroNumAttackThisTurn == 0 || (this.enemyHeroWindfury && this.enemyHeroNumAttackThisTurn == 1)) && !this.enemyHeroFrozen)
  6310. {
  6311. this.enemyHeroReady = true;
  6312. }
  6313. this.enemyHeroDefence += 1;
  6314. }
  6315. if (heroname == HeroEnum.hunter)
  6316. {
  6317. this.attackOrHealHero(2, true);
  6318. }
  6319. if (heroname == HeroEnum.pala)
  6320. {
  6321. int posi = this.enemyMinions.Count - 1;
  6322. CardDB.Card kid = CardDB.Instance.getCardData("silverhandrecruit");
  6323. callKid(kid, posi, false);
  6324. }
  6325. if (heroname == HeroEnum.shaman)
  6326. {
  6327. int posi = this.enemyMinions.Count - 1;
  6328. CardDB.Card kid = CardDB.Instance.getCardData("healingtotem");
  6329. callKid(kid, posi, false);
  6330. }
  6331. if (heroname == HeroEnum.lordjaraxxus)
  6332. {
  6333. int posi = this.enemyMinions.Count - 1;
  6334. CardDB.Card kid = CardDB.Instance.getCardData("infernal");
  6335. callKid(kid, posi, false);
  6336. }
  6337. }
  6338. public void doAction()
  6339. {
  6340. /*if (this.playactions.Count >= 1)
  6341. {
  6342. Action a = this.playactions[0];
  6343. if (a.cardplay)
  6344. {
  6345. if (logging) help.logg("play " + a.handcard.card.name);
  6346. if (logging) help.logg("with position " + a.cardplace.X + "," + a.cardplace.Y);
  6347. help.clicklauf(a.cardplace.X, a.cardplace.Y);
  6348. if (a.owntarget >= 0)
  6349. {
  6350. if (logging) help.logg("on position " + a.ownplace.X + "," + a.ownplace.Y);
  6351. help.clicklauf(a.ownplace.X, a.ownplace.Y);
  6352. }
  6353. if (a.enemytarget >= 0)
  6354. {
  6355. if (logging) help.logg("and target to " + a.enemytarget + ": on " + a.targetplace.X + ", " + a.targetplace.Y);
  6356. help.clicklauf(a.targetplace.X, a.targetplace.Y);
  6357. }
  6358. }
  6359. if (a.minionplay)
  6360. {
  6361. if (logging) help.logg("attacker: " + a.owntarget + " enemy: " + a.enemytarget);
  6362. help.clicklauf(a.ownplace.X, a.ownplace.Y);
  6363. System.Threading.Thread.Sleep(500);
  6364. if (logging) help.logg("targetplace " + a.targetplace.X + ", " + a.targetplace.Y);
  6365. help.clicklauf(a.targetplace.X, a.targetplace.Y);
  6366. }
  6367. if (a.heroattack)
  6368. {
  6369. if (logging) help.logg("attack with hero, enemy: " + a.enemytarget);
  6370. help.clicklauf(a.ownplace.X, a.ownplace.Y);
  6371. if (logging) help.logg("targetplace " + a.targetplace.X + ", " + a.targetplace.Y);
  6372. help.clicklauf(a.targetplace.X, a.targetplace.Y);
  6373. }
  6374. if (a.useability)
  6375. {
  6376. if (logging) help.logg("useability ");
  6377. help.clicklauf(a.ownplace.X, a.ownplace.Y);
  6378. if (a.enemytarget >= 0)
  6379. {
  6380. if (logging) help.logg("on enemy: " + a.enemytarget + "targetplace " + a.targetplace.X + ", " + a.targetplace.Y);
  6381. help.clicklauf(a.targetplace.X, a.targetplace.Y);
  6382. }
  6383. }
  6384. }
  6385. else
  6386. {
  6387. // click endturnbutton
  6388. help.clicklauf(939, 353);
  6389. }
  6390. help.laufmaus(915, 400, 6);
  6391. */
  6392. }
  6393. private void debugMinions()
  6394. {
  6395. Helpfunctions.Instance.logg("OWN MINIONS################");
  6396. foreach (Minion m in this.ownMinions)
  6397. {
  6398. Helpfunctions.Instance.logg("name,ang, hp, maxhp: " + m.name + ", " + m.Angr + ", " + m.Hp + ", " + m.maxHp);
  6399. foreach (Enchantment e in m.enchantments)
  6400. {
  6401. Helpfunctions.Instance.logg("enchment: " + e.CARDID + " " + e.creator + " " + e.controllerOfCreator);
  6402. }
  6403. }
  6404. Helpfunctions.Instance.logg("ENEMY MINIONS############");
  6405. foreach (Minion m in this.enemyMinions)
  6406. {
  6407. Helpfunctions.Instance.logg("name,ang, hp: " + m.name + ", " + m.Angr + ", " + m.Hp);
  6408. }
  6409. }
  6410. public void printBoard()
  6411. {
  6412. Helpfunctions.Instance.logg("board: " + value);
  6413. Helpfunctions.Instance.logg("cardsplayed: " + this.cardsPlayedThisTurn + " handsize: " + this.owncards.Count);
  6414. Helpfunctions.Instance.logg("ownhero: ");
  6415. Helpfunctions.Instance.logg("ownherohp: " + this.ownHeroHp + " + " + this.ownHeroDefence);
  6416. Helpfunctions.Instance.logg("ownheroattac: " + this.ownheroAngr);
  6417. Helpfunctions.Instance.logg("ownheroweapon: " + this.ownWeaponAttack + " " + this.ownWeaponDurability + " " + this.ownWeaponName);
  6418. Helpfunctions.Instance.logg("ownherostatus: frozen" + this.ownHeroFrozen + " ");
  6419. Helpfunctions.Instance.logg("enemyherohp: " + this.enemyHeroHp + " + " + this.enemyHeroDefence);
  6420. Helpfunctions.Instance.logg("OWN MINIONS################");
  6421. foreach (Minion m in this.ownMinions)
  6422. {
  6423. Helpfunctions.Instance.logg("name,ang, hp: " + m.name + ", " + m.Angr + ", " + m.Hp);
  6424. foreach (Enchantment e in m.enchantments)
  6425. {
  6426. Helpfunctions.Instance.logg("enchment " + e.CARDID + " " + e.creator + " " + e.controllerOfCreator);
  6427. }
  6428. }
  6429. Helpfunctions.Instance.logg("ENEMY MINIONS############");
  6430. foreach (Minion m in this.enemyMinions)
  6431. {
  6432. Helpfunctions.Instance.logg("name,ang, hp: " + m.name + ", " + m.Angr + ", " + m.Hp);
  6433. }
  6434. Helpfunctions.Instance.logg("");
  6435. }
  6436. public Action getNextAction()
  6437. {
  6438. if (this.playactions.Count >= 1) return this.playactions[0];
  6439. return null;
  6440. }
  6441. public void printActions()
  6442. {
  6443. foreach (Action a in this.playactions)
  6444. {
  6445. if (a.cardplay)
  6446. {
  6447. Helpfunctions.Instance.logg("play " + a.handcard.card.name);
  6448. if (a.druidchoice >= 1) Helpfunctions.Instance.logg("choose choise " + a.druidchoice);
  6449. Helpfunctions.Instance.logg("with entity " + a.cardEntitiy);
  6450. if (a.owntarget >= 0)
  6451. {
  6452. Helpfunctions.Instance.logg("on position " + a.owntarget);
  6453. }
  6454. if (a.enemytarget >= 0)
  6455. {
  6456. Helpfunctions.Instance.logg("and target to " + a.enemytarget + " " + a.enemyEntitiy);
  6457. }
  6458. }
  6459. if (a.minionplay)
  6460. {
  6461. Helpfunctions.Instance.logg("attacker: " + a.owntarget + " enemy: " + a.enemytarget);
  6462. Helpfunctions.Instance.logg("targetplace " + a.enemyEntitiy);
  6463. }
  6464. if (a.heroattack)
  6465. {
  6466. Helpfunctions.Instance.logg("attack with hero, enemy: " + a.enemytarget);
  6467. Helpfunctions.Instance.logg("targetplace " + a.enemyEntitiy);
  6468. }
  6469. if (a.useability)
  6470. {
  6471. Helpfunctions.Instance.logg("useability ");
  6472. if (a.enemytarget >= 0)
  6473. {
  6474. Helpfunctions.Instance.logg("on enemy: " + a.enemytarget + "targetplace " + a.enemyEntitiy);
  6475. }
  6476. }
  6477. Helpfunctions.Instance.logg("");
  6478. }
  6479. }
  6480. }
  6481. }