PageRenderTime 89ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/ai/action-copy.cs

https://github.com/revolutioncom/HRCustomClasses
C# | 5956 lines | 4973 code | 779 blank | 204 comment | 1813 complexity | b6f681dcd5a41ac720cb2689f495f489 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. //test wichtelmeisterin, befehlsruf
  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. namespace HREngine.Bots
  15. {
  16. public class Action
  17. {
  18. public bool cardplay = false;
  19. public bool heroattack = false;
  20. public bool useability = false;
  21. public bool minionplay = false;
  22. public CardDB.Card card;
  23. public int cardEntitiy = -1;
  24. public int owntarget = -1; //= target where card/minion is placed
  25. public int ownEntitiy = -1;
  26. public int enemytarget = -1; // target where red arrow is placed
  27. public int enemyEntitiy = -1;
  28. public int druidchoice = 0; // 1 left card, 2 right card
  29. public int numEnemysBeforePlayed = 0;
  30. public void print()
  31. {
  32. Helpfunctions help = Helpfunctions.Instance;
  33. help.logg("current Action: ");
  34. if (this.cardplay)
  35. {
  36. help.logg("play " + this.card.name);
  37. if (this.druidchoice >= 1) help.logg("choose choise " + this.druidchoice);
  38. help.logg("with position " + this.cardEntitiy);
  39. if (this.owntarget >= 0)
  40. {
  41. help.logg("on position " + this.ownEntitiy);
  42. }
  43. if (this.enemytarget >= 0)
  44. {
  45. help.logg("and target to " + this.enemytarget + " " + this.enemyEntitiy);
  46. }
  47. }
  48. if (this.minionplay)
  49. {
  50. help.logg("attacker: " + this.owntarget + " enemy: " + this.enemytarget);
  51. help.logg("targetplace " + this.enemyEntitiy);
  52. }
  53. if (this.heroattack)
  54. {
  55. help.logg("attack with hero, enemy: " + this.enemytarget);
  56. help.logg("targetplace " + this.enemyEntitiy);
  57. }
  58. if (this.useability)
  59. {
  60. help.logg("useability ");
  61. if (this.enemytarget >= 0)
  62. {
  63. help.logg("on enemy: " + this.enemytarget + "targetplace " + this.enemyEntitiy);
  64. }
  65. }
  66. help.logg("");
  67. }
  68. }
  69. public class Playfield
  70. {
  71. public bool logging = false;
  72. public int evaluatePenality = 0;
  73. public int ownController = 0;
  74. public int ownHeroEntity = -1;
  75. public int enemyHeroEntity = -1;
  76. public int value = Int32.MinValue;
  77. public int guessingHeroDamage = 0;
  78. public int mana = 0;
  79. public int enemyHeroHp = 30;
  80. public string ownHeroName = "";
  81. public string enemyHeroName = "";
  82. public bool ownHeroReady = false;
  83. public int ownHeroNumAttackThisTurn = 0;
  84. public bool ownHeroWindfury = false;
  85. public List<string> ownSecretsIDList = new List<string>();
  86. public int enemySecretCount = 0;
  87. public int ownHeroHp = 30;
  88. public int ownheroAngr = 0;
  89. public bool ownHeroFrozen = false;
  90. public bool enemyHeroFrozen = false;
  91. public bool heroImmuneWhileAttacking = false;
  92. public int ownWeaponDurability = 0;
  93. public int ownWeaponAttack = 0;
  94. public string ownWeaponName = "";
  95. public int enemyWeaponAttack = 0;
  96. public int enemyWeaponDurability = 0;
  97. public List<Minion> ownMinions = new List<Minion>();
  98. public List<Minion> enemyMinions = new List<Minion>();
  99. public List<Handmanager.Handcard> owncards = new List<Handmanager.Handcard>();
  100. public List<Action> playactions = new List<Action>();
  101. public bool complete = false;
  102. public int owncarddraw = 0;
  103. public int ownHeroDefence = 0;
  104. public int enemycarddraw = 0;
  105. public int enemyAnzCards = 0;
  106. public int enemyHeroDefence = 0;
  107. public bool ownAbilityReady = false;
  108. public int doublepriest = 0;
  109. public int spellpower = 0;
  110. public bool auchenaiseelenpriesterin = false;
  111. public bool playedmagierinderkirintor = false;
  112. public bool playedPreparation = false;
  113. public int winzigebeschwoererin = 0;
  114. public int startedWithWinzigebeschwoererin = 0;
  115. public int zauberlehrling = 0;
  116. public int startedWithZauberlehrling = 0;
  117. public int managespenst = 0;
  118. public int startedWithManagespenst = 0;
  119. public int soeldnerDerVenture = 0;
  120. public int startedWithsoeldnerDerVenture = 0;
  121. public int beschwoerungsportal = 0;
  122. public int startedWithbeschwoerungsportal = 0;
  123. public int ownWeaponAttackStarted = 0;
  124. public int ownMobsCountStarted = 0;
  125. public int ownCardsCountStarted = 0;
  126. public int ownHeroHpStarted = 30;
  127. public int mobsplayedThisTurn = 0;
  128. public int startedWithMobsPlayedThisTurn = 0;
  129. public int cardsPlayedThisTurn = 0;
  130. public int ueberladung = 0; //=recall
  131. public int ownMaxMana = 0;
  132. public int enemyMaxMana = 0;
  133. public int lostDamage = 0;
  134. public int lostHealth = 0;
  135. public int lostWeaponDamage = 0;
  136. public CardDB.Card ownHeroAblility;
  137. Helpfunctions help = Helpfunctions.Instance;
  138. private void addMinionsReal(List<Minion> source, List<Minion> trgt)
  139. {
  140. foreach (Minion m in source)
  141. {
  142. Minion mc = new Minion(m);
  143. trgt.Add(mc);
  144. }
  145. }
  146. private void addCardsReal(List<Handmanager.Handcard> source)
  147. {
  148. foreach (Handmanager.Handcard m in source)
  149. {
  150. Handmanager.Handcard mc = new Handmanager.Handcard();
  151. mc.card = new CardDB.Card(m.card);
  152. mc.position = m.position;
  153. mc.entity = m.entity;
  154. this.owncards.Add(mc);
  155. }
  156. }
  157. public Playfield()
  158. {
  159. this.ownController = Hrtprozis.Instance.getOwnController();
  160. this.ownHeroEntity = Hrtprozis.Instance.ownHeroEntity;
  161. this.enemyHeroEntity = Hrtprozis.Instance.enemyHeroEntitiy;
  162. this.mana = Hrtprozis.Instance.currentMana;
  163. this.ownMaxMana = Hrtprozis.Instance.ownMaxMana;
  164. this.enemyMaxMana = Hrtprozis.Instance.enemyMaxMana;
  165. this.evaluatePenality = 0;
  166. this.ownSecretsIDList = Hrtprozis.Instance.ownSecretList;
  167. this.enemySecretCount = Hrtprozis.Instance.enemySecretCount;
  168. addMinionsReal(Hrtprozis.Instance.ownMinions, ownMinions);
  169. addMinionsReal(Hrtprozis.Instance.enemyMinions, enemyMinions);
  170. addCardsReal(Handmanager.Instance.handCards);
  171. this.enemyHeroHp = Hrtprozis.Instance.enemyHp;
  172. this.ownHeroName = Hrtprozis.Instance.heroname;
  173. this.enemyHeroName = Hrtprozis.Instance.enemyHeroname;
  174. this.ownHeroHp = Hrtprozis.Instance.heroHp;
  175. this.complete = false;
  176. this.ownHeroReady = Hrtprozis.Instance.ownheroisread;
  177. this.ownHeroWindfury = Hrtprozis.Instance.ownHeroWindfury;
  178. this.ownHeroNumAttackThisTurn = Hrtprozis.Instance.ownHeroNumAttacksThisTurn;
  179. this.ownHeroFrozen = Hrtprozis.Instance.herofrozen;
  180. this.enemyHeroFrozen = Hrtprozis.Instance.enemyfrozen;
  181. this.ownheroAngr = Hrtprozis.Instance.heroAtk;
  182. this.heroImmuneWhileAttacking = Hrtprozis.Instance.heroImmuneToDamageWhileAttacking;
  183. this.ownWeaponDurability = Hrtprozis.Instance.heroWeaponDurability;
  184. this.ownWeaponAttack = Hrtprozis.Instance.heroWeaponAttack;
  185. this.ownWeaponName = Hrtprozis.Instance.ownHeroWeapon;
  186. this.owncarddraw = 0;
  187. this.ownHeroDefence = 0;
  188. this.enemyHeroDefence = 0;
  189. this.enemyWeaponAttack = 0;//dont know jet
  190. this.enemyWeaponDurability = Hrtprozis.Instance.enemyWeaponDurability;
  191. this.enemycarddraw = 0;
  192. this.enemyAnzCards = Handmanager.Instance.enemyAnzCards;
  193. this.ownAbilityReady = Hrtprozis.Instance.ownAbilityisReady;
  194. this.ownHeroAblility = Hrtprozis.Instance.heroAbility;
  195. this.doublepriest = 0;
  196. this.spellpower = 0;
  197. value = -1000000;
  198. this.mobsplayedThisTurn = Hrtprozis.Instance.numMinionsPlayedThisTurn;
  199. this.startedWithMobsPlayedThisTurn = Hrtprozis.Instance.numMinionsPlayedThisTurn;// only change mobsplayedthisturm
  200. this.cardsPlayedThisTurn = Hrtprozis.Instance.cardsPlayedThisTurn;
  201. this.ueberladung = Hrtprozis.Instance.ueberladung;
  202. //need the following for manacost-calculation
  203. this.ownHeroHpStarted = this.ownHeroHp;
  204. this.ownWeaponAttackStarted = this.ownWeaponAttack;
  205. this.ownCardsCountStarted = this.owncards.Count;
  206. this.ownMobsCountStarted = this.ownMinions.Count;
  207. this.playedmagierinderkirintor = false;
  208. this.playedPreparation = false;
  209. this.zauberlehrling = 0;
  210. this.winzigebeschwoererin = 0;
  211. this.managespenst = 0;
  212. this.soeldnerDerVenture = 0;
  213. this.beschwoerungsportal = 0;
  214. this.startedWithbeschwoerungsportal = 0;
  215. this.startedWithManagespenst = 0;
  216. this.startedWithWinzigebeschwoererin = 0;
  217. this.startedWithZauberlehrling = 0;
  218. this.startedWithsoeldnerDerVenture = 0;
  219. foreach (Minion m in this.ownMinions)
  220. {
  221. if (m.silenced) continue;
  222. if (m.name == "prophetvelen") this.doublepriest++;
  223. spellpower = spellpower + m.card.spellpowervalue;
  224. if (m.name == "auchenaiseelenpriesterin") this.auchenaiseelenpriesterin = true;
  225. if (m.name == "winzigebeschwoererin")
  226. {
  227. this.winzigebeschwoererin++;
  228. this.startedWithWinzigebeschwoererin++;
  229. }
  230. if (m.name == "zauberlehrling")
  231. {
  232. this.zauberlehrling++;
  233. this.startedWithZauberlehrling++;
  234. }
  235. if (m.name == "managespenst")
  236. {
  237. this.managespenst++;
  238. this.startedWithManagespenst++;
  239. }
  240. if (m.name == "soeldnerderventureco")
  241. {
  242. this.soeldnerDerVenture++;
  243. this.startedWithsoeldnerDerVenture++;
  244. }
  245. if (m.name == "beschwoerungsportal")
  246. {
  247. this.beschwoerungsportal++;
  248. this.startedWithbeschwoerungsportal++;
  249. }
  250. foreach (Enchantment e in m.enchantments)// only at first init needed, after that its copied
  251. {
  252. if (e.CARDID == "NEW1_036e" || e.CARDID == "NEW1_036e2") m.cantLowerHPbelowONE = true;
  253. }
  254. }
  255. foreach (Minion m in this.enemyMinions)
  256. {
  257. if (m.silenced) continue;
  258. if (m.name == "managespenst")
  259. {
  260. this.managespenst++;
  261. this.startedWithManagespenst++;
  262. }
  263. }
  264. }
  265. public Playfield(Playfield p)
  266. {
  267. this.ownController = p.ownController;
  268. this.ownHeroEntity = p.ownHeroEntity;
  269. this.enemyHeroEntity = p.enemyHeroEntity;
  270. this.evaluatePenality = p.evaluatePenality;
  271. foreach(string s in p.ownSecretsIDList)
  272. { this.ownSecretsIDList.Add(s); }
  273. this.enemySecretCount = p.enemySecretCount;
  274. this.mana = p.mana;
  275. this.ownMaxMana = p.ownMaxMana;
  276. this.enemyMaxMana = p.enemyMaxMana;
  277. addMinionsReal(p.ownMinions, ownMinions);
  278. addMinionsReal(p.enemyMinions, enemyMinions);
  279. addCardsReal(p.owncards);
  280. this.enemyHeroHp = p.enemyHeroHp;
  281. this.ownHeroName = p.ownHeroName;
  282. this.enemyHeroName = p.enemyHeroName;
  283. this.ownHeroHp = p.ownHeroHp;
  284. this.playactions.AddRange(p.playactions);
  285. this.complete = false;
  286. this.ownHeroReady = p.ownHeroReady;
  287. this.ownHeroNumAttackThisTurn = p.ownHeroNumAttackThisTurn;
  288. this.ownHeroWindfury = p.ownHeroWindfury;
  289. this.ownheroAngr = p.ownheroAngr;
  290. this.ownHeroFrozen = p.ownHeroFrozen;
  291. this.enemyHeroFrozen = p.enemyHeroFrozen;
  292. this.heroImmuneWhileAttacking = p.heroImmuneWhileAttacking;
  293. this.owncarddraw = p.owncarddraw;
  294. this.ownHeroDefence = p.ownHeroDefence;
  295. this.enemyWeaponAttack = p.enemyWeaponAttack;
  296. this.enemycarddraw = p.enemycarddraw;
  297. this.enemyAnzCards = p.enemyAnzCards;
  298. this.enemyHeroDefence = p.enemyHeroDefence;
  299. this.ownWeaponDurability = p.ownWeaponDurability;
  300. this.ownWeaponAttack = p.ownWeaponAttack;
  301. this.ownWeaponName = p.ownWeaponName;
  302. this.lostDamage = p.lostDamage;
  303. this.lostWeaponDamage = p.lostWeaponDamage;
  304. this.lostHealth = p.lostHealth;
  305. this.ownAbilityReady = p.ownAbilityReady;
  306. this.ownHeroAblility = p.ownHeroAblility;
  307. this.doublepriest = 0;
  308. this.spellpower = 0;
  309. value = -1000000;
  310. this.mobsplayedThisTurn = p.mobsplayedThisTurn;
  311. this.startedWithMobsPlayedThisTurn = p.startedWithMobsPlayedThisTurn;
  312. this.cardsPlayedThisTurn = p.cardsPlayedThisTurn;
  313. this.ueberladung = p.ueberladung;
  314. //need the following for manacost-calculation
  315. this.ownHeroHpStarted = p.ownHeroHpStarted;
  316. this.ownWeaponAttackStarted = p.ownWeaponAttackStarted;
  317. this.ownCardsCountStarted = p.ownCardsCountStarted;
  318. this.ownMobsCountStarted = p.ownMobsCountStarted;
  319. this.startedWithWinzigebeschwoererin = p.startedWithWinzigebeschwoererin;
  320. this.playedmagierinderkirintor = p.playedmagierinderkirintor;
  321. this.startedWithZauberlehrling = p.startedWithZauberlehrling;
  322. this.startedWithWinzigebeschwoererin = p.startedWithWinzigebeschwoererin;
  323. this.startedWithManagespenst = p.startedWithManagespenst;
  324. this.startedWithsoeldnerDerVenture = p.startedWithsoeldnerDerVenture;
  325. this.startedWithbeschwoerungsportal = p.startedWithbeschwoerungsportal;
  326. this.zauberlehrling = 0;
  327. this.winzigebeschwoererin = 0;
  328. this.managespenst = 0;
  329. this.soeldnerDerVenture = 0;
  330. foreach (Minion m in this.ownMinions)
  331. {
  332. if (m.silenced) continue;
  333. if (m.name == "prophetvelen") this.doublepriest++;
  334. spellpower = spellpower + m.card.spellpowervalue;
  335. if (m.name == "auchenaiseelenpriesterin") this.auchenaiseelenpriesterin = true;
  336. if (m.name == "winzigebeschwoererin") this.winzigebeschwoererin++;
  337. if (m.name == "zauberlehrling") this.zauberlehrling++;
  338. if (m.name == "managespenst") this.managespenst++;
  339. if (m.name == "soeldnerderventureco") this.soeldnerDerVenture++;
  340. if (m.name == "beschwoerungsportal") this.beschwoerungsportal++;
  341. }
  342. foreach (Minion m in this.enemyMinions)
  343. {
  344. if (m.silenced) continue;
  345. if (m.name == "managespenst") this.managespenst++;
  346. }
  347. }
  348. public int getValuee()
  349. {
  350. //if (value >= -200000) return value;
  351. int retval = 0;
  352. retval += owncards.Count * 1;
  353. retval += ownMinions.Count * 10;
  354. retval -= enemyMinions.Count * 10;
  355. retval += ownHeroHp + ownHeroDefence;
  356. retval += -enemyHeroHp - enemyHeroDefence;
  357. retval += ownheroAngr;// +ownWeaponDurability;
  358. retval -= enemyWeaponDurability;
  359. retval += owncarddraw * 5;
  360. retval -= enemycarddraw * 5;
  361. retval += this.ownMaxMana;
  362. if (enemyMinions.Count >= 0)
  363. {
  364. int anz = enemyMinions.Count;
  365. int owntaunt = ownMinions.FindAll(x => x.taunt == true).Count;
  366. int froggs = ownMinions.FindAll(x => x.name == "frosch").Count;
  367. owntaunt -= froggs;
  368. if (owntaunt == 0) retval -= 10 * anz;
  369. retval += owntaunt * 10 - 11 * anz;
  370. }
  371. foreach (Minion m in this.ownMinions)
  372. {
  373. retval += m.Hp * 1;
  374. retval += m.Angr * 2;
  375. if (m.Angr >= m.maxHp + 1)
  376. {
  377. //is a tanky minion
  378. retval += m.Hp;
  379. }
  380. if (m.windfury) retval += m.Angr;
  381. }
  382. foreach (Minion m in this.enemyMinions)
  383. {
  384. retval -= m.Hp;
  385. retval -= m.Angr*2;
  386. if (m.Angr >= m.maxHp + 1)
  387. {
  388. //is a tanky minion
  389. retval -= m.Hp;
  390. }
  391. if (m.windfury) retval -= m.Angr;
  392. if (m.taunt) retval -= 5;
  393. if (m.name == "schlachtzugsleiter") retval -= 5;
  394. if (m.name == "grimmschuppenorakel") retval -= 5;
  395. if (m.name == "terrorwolfalpha") retval -= 2;
  396. if (m.name == "murlocanfuehrer") retval -= 5;
  397. if (m.name == "suedmeerkapitaen") retval -= 5;
  398. if (m.name == "championvonsturmwind") retval -= 10;
  399. if (m.name == "waldwolf") retval -= 5;
  400. if (m.name == "leokk") retval -= 5;
  401. if (m.name == "klerikerinvonnordhain") retval -= 5;
  402. if (m.name == "zauberlehrling") retval -= 3;
  403. if (m.name == "winzigebeschwoererin") retval -= 3;
  404. }
  405. retval -= lostDamage;//damage which was to high (like killing a 2/1 with an 3/3 -> => lostdamage =2
  406. retval -= lostWeaponDamage;
  407. if (ownMinions.Count == 0) retval -= 20;
  408. if (enemyMinions.Count == 0) retval += 20;
  409. if (enemyHeroHp <= 0) retval = 10000;
  410. if (ownHeroHp <= 0) retval = -10000;
  411. this.value = retval;
  412. return retval;
  413. }
  414. public List<targett> getAttackTargets()
  415. {
  416. List<targett> trgts = new List<targett>();
  417. List<targett> trgts2 = new List<targett>();
  418. trgts2.Add(new targett(200, this.enemyHeroEntity));
  419. bool hastanks = false;
  420. foreach (Minion m in this.enemyMinions)
  421. {
  422. if (m.stealth) continue; // cant target stealth
  423. if (m.taunt)
  424. {
  425. hastanks = true;
  426. trgts.Add(new targett(m.id + 10, m.entitiyID));
  427. }
  428. else
  429. {
  430. trgts2.Add(new targett(m.id + 10, m.entitiyID));
  431. }
  432. }
  433. if (hastanks) return trgts;
  434. return trgts2;
  435. }
  436. public int getBestPlace(CardDB.Card card)
  437. {
  438. if (card.type != CardDB.cardtype.MOB) return 0;
  439. if (this.ownMinions.Count <= 1) return 0;
  440. int[] places = new int[this.ownMinions.Count];
  441. int i = 0;
  442. int tempval = 0;
  443. if (card.name == "sonnenzornbeschuetzerin" || card.name == "verteidigervonargus") // bestplace, if right and left minions have no taunt + lots of hp, dont make priority-minions to taunt
  444. {
  445. i = 0;
  446. foreach (Minion m in this.ownMinions)
  447. {
  448. places[i] = 0;
  449. tempval = 0;
  450. if (!m.taunt)
  451. {
  452. tempval -= m.Hp;
  453. }
  454. else
  455. {
  456. tempval = 30;
  457. }
  458. if (m.name == "flammenzungentotem") tempval += 50;
  459. if (m.name == "schlachtzugsleiter") tempval += 30;
  460. if (m.name == "grimmschuppenorakel") tempval += 30;
  461. if (m.name == "terrorwolfalpha") tempval += 50;
  462. if (m.name == "murlocanfuehrer") tempval += 30;
  463. if (m.name == "suedmeerkapitaen") tempval += 30;
  464. if (m.name == "championvonsturmwind") tempval += 30;
  465. if (m.name == "waldwolf") tempval += 30;
  466. if (m.name == "leokk") tempval += 30;
  467. if (m.name == "klerikerinvonnordhain") tempval += 30;
  468. if (m.name == "zauberlehrling") tempval += 20;
  469. if (m.name == "winzigebeschwoererin") tempval += 10;
  470. if (m.name == "beschwoerungsportal") tempval += 20;
  471. if (m.name == "aasfressendehyaene") tempval += 20;
  472. places[i] = tempval;
  473. i++;
  474. }
  475. i = 0;
  476. int bestpl = 7;
  477. int bestval = 10000;
  478. foreach (Minion m in this.ownMinions)
  479. {
  480. int prev = 0;
  481. int next = 0;
  482. if (i >= 1) prev = places[i - 1];
  483. next = places[i];
  484. if(bestval > prev + next)
  485. {
  486. bestval = prev + next;
  487. bestpl = i;
  488. }
  489. i++;
  490. }
  491. return bestpl;
  492. }
  493. // normal placement
  494. int cardvalue = card.Attack * 2 + card.Health;
  495. if (card.tank)
  496. {
  497. cardvalue += 5;
  498. cardvalue += card.Health;
  499. }
  500. if (card.name == "flammenzungentotem") cardvalue += 50;
  501. if (card.name == "schlachtzugsleiter") cardvalue += 10;
  502. if (card.name == "grimmschuppenorakel") cardvalue += 10;
  503. if (card.name == "terrorwolfalpha") cardvalue += 50;
  504. if (card.name == "murlocanfuehrer") cardvalue += 10;
  505. if (card.name == "suedmeerkapitaen") cardvalue += 10;
  506. if (card.name == "championvonsturmwind") cardvalue += 10;
  507. if (card.name == "waldwolf") cardvalue += 10;
  508. if (card.name == "leokk") cardvalue += 10;
  509. if (card.name == "cardvalue") cardvalue += 10;
  510. if (card.name == "zauberlehrling") cardvalue += 10;
  511. if (card.name == "winzigebeschwoererin") cardvalue += 10;
  512. if (card.name == "beschwoerungsportal") cardvalue += 10;
  513. if (card.name == "aasfressendehyaene") cardvalue += 10;
  514. i = 0;
  515. foreach(Minion m in this.ownMinions)
  516. {
  517. places[i] = 0;
  518. tempval = m.Angr * 2 + m.maxHp;
  519. if (m.taunt)
  520. {
  521. tempval += 6;
  522. tempval += m.maxHp;
  523. }
  524. if (m.name == "flammenzungentotem") tempval += 50;
  525. if (m.name == "schlachtzugsleiter") tempval += 10;
  526. if (m.name == "grimmschuppenorakel") tempval += 10;
  527. if (m.name == "terrorwolfalpha") tempval += 50;
  528. if (m.name == "murlocanfuehrer") tempval += 10;
  529. if (m.name == "suedmeerkapitaen") tempval += 10;
  530. if (m.name == "championvonsturmwind") tempval += 10;
  531. if (m.name == "waldwolf") tempval += 10;
  532. if (m.name == "leokk") tempval += 10;
  533. if (m.name == "klerikerinvonnordhain") tempval += 10;
  534. if (m.name == "zauberlehrling") tempval += 10;
  535. if (m.name == "winzigebeschwoererin") tempval += 10;
  536. if (m.name == "beschwoerungsportal") tempval += 10;
  537. if (m.name == "aasfressendehyaene") tempval += 10;
  538. places[i] = tempval;
  539. i++;
  540. }
  541. //bigminion if >=10
  542. int bestplace = 0;
  543. int bestvale = 0;
  544. tempval=0;
  545. i=0;
  546. for (int j = 0; j <= this.ownMinions.Count; j++ )
  547. {
  548. int prev = cardvalue;
  549. int next = cardvalue;
  550. if (i >= 1) prev = places[i - 1];
  551. if (i < this.ownMinions.Count) next = places[i];
  552. if (cardvalue >= prev && cardvalue >= next)
  553. {
  554. tempval = 2 * cardvalue - prev - next;
  555. if (tempval > bestvale)
  556. {
  557. bestplace = i;
  558. bestvale = tempval;
  559. }
  560. }
  561. if (cardvalue <= prev && cardvalue <= next)
  562. {
  563. tempval = -2 * cardvalue + prev + next;
  564. if (tempval > bestvale)
  565. {
  566. bestplace = i ;
  567. bestvale = tempval;
  568. }
  569. }
  570. i++;
  571. }
  572. return bestplace;
  573. }
  574. public int getBestPlacePrint(CardDB.Card card)
  575. {
  576. if (card.type != CardDB.cardtype.MOB) return 0;
  577. if (this.ownMinions.Count <= 1) return 0;
  578. int[] places = new int[this.ownMinions.Count];
  579. int i = 0;
  580. int tempval = 0;
  581. if (card.name == "sonnenzornbeschuetzerin" || card.name == "verteidigervonargus") // bestplace, if right and left minions have no taunt + lots of hp, dont make priority-minions to taunt
  582. {
  583. i = 0;
  584. foreach (Minion m in this.ownMinions)
  585. {
  586. places[i] = 0;
  587. tempval = 0;
  588. if (!m.taunt)
  589. {
  590. tempval -= m.Hp;
  591. }
  592. else
  593. {
  594. tempval = 30;
  595. }
  596. if (m.name == "flammenzungentotem") tempval += 50;
  597. if (m.name == "schlachtzugsleiter") tempval += 30;
  598. if (m.name == "grimmschuppenorakel") tempval += 30;
  599. if (m.name == "terrorwolfalpha") tempval += 50;
  600. if (m.name == "murlocanfuehrer") tempval += 30;
  601. if (m.name == "suedmeerkapitaen") tempval += 30;
  602. if (m.name == "championvonsturmwind") tempval += 30;
  603. if (m.name == "waldwolf") tempval += 30;
  604. if (m.name == "leokk") tempval += 30;
  605. if (m.name == "klerikerinvonnordhain") tempval += 30;
  606. if (m.name == "zauberlehrling") tempval += 20;
  607. if (m.name == "winzigebeschwoererin") tempval += 10;
  608. if (m.name == "beschwoerungsportal") tempval += 20;
  609. if (m.name == "aasfressendehyaene") tempval += 20;
  610. places[i] = tempval;
  611. i++;
  612. }
  613. i = 0;
  614. int bestpl = 7;
  615. int bestval = 10000;
  616. foreach (Minion m in this.ownMinions)
  617. {
  618. help.logg(places[i]+"");
  619. int prev = 0;
  620. int next = 0;
  621. if (i >= 1) prev = places[i - 1];
  622. next = places[i];
  623. if (bestval > prev + next)
  624. {
  625. bestval = prev + next;
  626. bestpl = i ;
  627. }
  628. i++;
  629. }
  630. return bestpl;
  631. }
  632. // normal placement
  633. int cardvalue = card.Attack * 2 + card.Health;
  634. if (card.tank)
  635. {
  636. cardvalue += 5;
  637. cardvalue += card.Health;
  638. }
  639. if (card.name == "flammenzungentotem") tempval += 50;
  640. if (card.name == "schlachtzugsleiter") cardvalue += 10;
  641. if (card.name == "grimmschuppenorakel") cardvalue += 10;
  642. if (card.name == "terrorwolfalpha") cardvalue += 50;
  643. if (card.name == "murlocanfuehrer") cardvalue += 10;
  644. if (card.name == "suedmeerkapitaen") cardvalue += 10;
  645. if (card.name == "championvonsturmwind") cardvalue += 10;
  646. if (card.name == "waldwolf") cardvalue += 10;
  647. if (card.name == "leokk") cardvalue += 10;
  648. if (card.name == "cardvalue") cardvalue += 10;
  649. if (card.name == "zauberlehrling") cardvalue += 10;
  650. if (card.name == "winzigebeschwoererin") cardvalue += 10;
  651. if (card.name == "beschwoerungsportal") cardvalue += 10;
  652. if (card.name == "aasfressendehyaene") cardvalue += 10;
  653. i = 0;
  654. foreach (Minion m in this.ownMinions)
  655. {
  656. places[i] = 0;
  657. tempval = m.Angr * 2 + m.maxHp;
  658. if (m.taunt)
  659. {
  660. tempval += 6;
  661. tempval += m.maxHp;
  662. }
  663. if (m.name == "flammenzungentotem") tempval += 50;
  664. if (m.name == "schlachtzugsleiter") tempval += 10;
  665. if (m.name == "grimmschuppenorakel") tempval += 10;
  666. if (m.name == "terrorwolfalpha") tempval += 50;
  667. if (m.name == "murlocanfuehrer") tempval += 10;
  668. if (m.name == "suedmeerkapitaen") tempval += 10;
  669. if (m.name == "championvonsturmwind") tempval += 10;
  670. if (m.name == "waldwolf") tempval += 10;
  671. if (m.name == "leokk") tempval += 10;
  672. if (m.name == "klerikerinvonnordhain") tempval += 10;
  673. if (m.name == "zauberlehrling") tempval += 10;
  674. if (m.name == "winzigebeschwoererin") tempval += 10;
  675. if (m.name == "beschwoerungsportal") tempval += 10;
  676. if (m.name == "aasfressendehyaene") tempval += 10;
  677. places[i] = tempval;
  678. help.logg(places[i] + "");
  679. i++;
  680. }
  681. //bigminion if >=10
  682. int bestplace = 0;
  683. int bestvale = 0;
  684. tempval = 0;
  685. i = 0;
  686. help.logg(cardvalue + " (own)");
  687. i = 0;
  688. for (int j = 0; j <= this.ownMinions.Count; j++)
  689. {
  690. int prev = cardvalue;
  691. int next = cardvalue;
  692. if (i >= 1) prev = places[i - 1];
  693. if (i < this.ownMinions.Count)
  694. {
  695. next = places[i];
  696. }
  697. if (cardvalue >= prev && cardvalue >= next)
  698. {
  699. tempval = 2 * cardvalue - prev - next;
  700. if (tempval > bestvale)
  701. {
  702. bestplace = i ;
  703. bestvale = tempval;
  704. }
  705. }
  706. if (cardvalue <= prev && cardvalue <= next)
  707. {
  708. tempval = -2 * cardvalue + prev + next;
  709. if (tempval > bestvale)
  710. {
  711. bestplace = i;
  712. bestvale = tempval;
  713. }
  714. }
  715. i++;
  716. }
  717. help.logg(bestplace + " (best)");
  718. return bestplace;
  719. }
  720. public void endTurn()
  721. {
  722. this.complete = true;
  723. endTurnBuffs(true);//end own buffs
  724. endTurnEffect(true);//own turn ends
  725. startTurnEffect(false);//enemy turn begins
  726. guessHeroDamage();
  727. simulateTraps();
  728. }
  729. private void guessHeroDamage()
  730. {
  731. int ghd = 0;
  732. foreach (Minion m in this.enemyMinions)
  733. {
  734. if (m.frozen) continue;
  735. ghd += m.Angr;
  736. if (m.windfury) ghd += m.Angr;
  737. }
  738. if (this.enemyHeroName == "druid") ghd++;
  739. if (this.enemyHeroName == "mage") ghd++;
  740. if (this.enemyHeroName == "thief") ghd++;
  741. if (this.enemyHeroName == "hunter") ghd += 2;
  742. ghd += enemyWeaponAttack;
  743. foreach (Minion m in this.ownMinions)
  744. {
  745. if (m.frozen) continue;
  746. if (m.taunt) ghd -= m.Hp;
  747. if (m.taunt && m.divineshild) ghd -= 1;
  748. }
  749. this.guessingHeroDamage = Math.Max(0, ghd);
  750. }
  751. private void simulateTraps()
  752. {
  753. // DONT KILL ENEMY HERO (cause its only guessing)
  754. foreach (string secretID in this.ownSecretsIDList)
  755. {
  756. //hunter secrets############
  757. if (secretID == "EX1_554") //snaketrap
  758. {
  759. //call 3 snakes (if possible)
  760. int posi = this.ownMinions.Count - 1;
  761. CardDB.Card kid = CardDB.Instance.getCardData("schlange");
  762. callKid(kid, posi, true);
  763. callKid(kid, posi, true);
  764. callKid(kid, posi, true);
  765. }
  766. if (secretID == "EX1_609") //snipe
  767. {
  768. //kill weakest minion of enemy
  769. List<Minion> temp = new List<Minion>(this.enemyMinions);
  770. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  771. if (temp.Count == 0) continue;
  772. Minion m = temp[0];
  773. minionGetDamagedOrHealed(m, 4, 0, false);
  774. }
  775. if (secretID == "EX1_610") //explosive trap
  776. {
  777. //take 2 damage to each enemy
  778. List<Minion> temp = new List<Minion>(this.enemyMinions);
  779. foreach (Minion m in temp)
  780. {
  781. minionGetDamagedOrHealed(m, 2, 0, false);
  782. }
  783. attackEnemyHeroWithoutKill(2);
  784. }
  785. if (secretID == "EX1_611") //freezing trap
  786. {
  787. //return weakest enemy minion to hand
  788. List<Minion> temp = new List<Minion>(this.enemyMinions);
  789. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  790. if (temp.Count == 0) continue;
  791. Minion m = temp[0];
  792. minionReturnToHand(m, false);
  793. }
  794. if (secretID == "EX1_533") // missdirection
  795. {
  796. // first damage to your hero is nulled -> lower guessingHeroDamage
  797. List<Minion> temp = new List<Minion>(this.enemyMinions);
  798. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  799. if (temp.Count == 0) continue;
  800. Minion m = temp[0];
  801. this.guessingHeroDamage = Math.Max(0, this.guessingHeroDamage -= Math.Max(m.Angr,1));
  802. this.ownHeroDefence += this.enemyMinions.Count;// the more the enemy minions has on board, the more the posibility to destroy something other :D
  803. }
  804. //mage secrets############
  805. if (secretID == "EX1_287") //counterspell
  806. {
  807. // what should we do?
  808. this.ownHeroDefence += 5;
  809. }
  810. if (secretID == "EX1_289") //ice barrier
  811. {
  812. this.ownHeroDefence += 8;
  813. }
  814. if (secretID == "EX1_295") //ice barrier
  815. {
  816. //set the guessed Damage to zero
  817. this.guessingHeroDamage = 0;
  818. }
  819. if (secretID == "EX1_294") //mirror entity
  820. {
  821. //summon snake ( a weak minion)
  822. int posi = this.ownMinions.Count - 1;
  823. CardDB.Card kid = CardDB.Instance.getCardData("schlange");
  824. callKid(kid, posi, true);
  825. }
  826. if (secretID == "tt_010") //spellbender
  827. {
  828. //whut???
  829. // add 2 to your defence (most attack-buffs give +2, lots of damage spells too)
  830. this.ownHeroDefence += 2;
  831. }
  832. if (secretID == "EX1_594") // vaporize
  833. {
  834. // first damage to your hero is nulled -> lower guessingHeroDamage and destroy weakest minion
  835. List<Minion> temp = new List<Minion>(this.enemyMinions);
  836. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  837. if (temp.Count == 0) continue;
  838. Minion m = temp[0];
  839. this.guessingHeroDamage = Math.Max(0, this.guessingHeroDamage -= Math.Max(m.Angr, 1));
  840. minionGetDestroyed(m, false);
  841. }
  842. //pala secrets############
  843. if (secretID == "EX1_132") // eye for an eye
  844. {
  845. // enemy takes one damage
  846. attackEnemyHeroWithoutKill(1);
  847. }
  848. if (secretID == "EX1_130") // noble sacrifice
  849. {
  850. //lower guessed hero damage
  851. List<Minion> temp = new List<Minion>(this.enemyMinions);
  852. temp.Sort((a, b) => a.Angr.CompareTo(b.Angr));//take the weakest
  853. if (temp.Count == 0) continue;
  854. Minion m = temp[0];
  855. this.guessingHeroDamage = Math.Max(0, this.guessingHeroDamage -= Math.Max(m.Angr, 1));
  856. }
  857. if (secretID == "EX1_136") // redemption
  858. {
  859. // we give our weakest minion a divine shield :D
  860. List<Minion> temp = new List<Minion>(this.ownMinions);
  861. temp.Sort((a, b) => a.Hp.CompareTo(b.Hp));//take the weakest
  862. if (temp.Count == 0) continue;
  863. foreach (Minion m in temp)
  864. {
  865. if (m.divineshild) continue;
  866. m.divineshild = true;
  867. break;
  868. }
  869. }
  870. if (secretID == "EX1_379") // repentance
  871. {
  872. // set his current lowest hp minion to x/1
  873. List<Minion> temp = new List<Minion>(this.enemyMinions);
  874. temp.Sort((a, b) => a.Hp.CompareTo(b.Hp));//take the weakest
  875. if (temp.Count == 0) continue;
  876. Minion m = temp[0];
  877. m.Hp = 1;
  878. m.maxHp = 1;
  879. }
  880. }
  881. }
  882. private void endTurnBuffs(bool own)
  883. {
  884. List<Minion> temp = new List<Minion>();
  885. if (own)
  886. {
  887. temp.AddRange(this.ownMinions);
  888. }
  889. else
  890. {
  891. temp.AddRange(this.enemyMinions);
  892. }
  893. // end buffs
  894. foreach (Minion m in temp)
  895. {
  896. m.cantLowerHPbelowONE = false;
  897. m.immune = false;
  898. List<Enchantment> tempench = new List<Enchantment>(m.enchantments);
  899. foreach (Enchantment e in tempench)
  900. {
  901. if (e.CARDID == "EX1_316e")//ueberwaeltigende macht
  902. {
  903. minionGetDestroyed(m, own);
  904. }
  905. if (e.CARDID == "CS2_046e")//kampfrausch
  906. {
  907. debuff(m, e);
  908. }
  909. if (e.CARDID == "CS2_045e")// waffe felsbeiser
  910. {
  911. debuff(m, e);
  912. }
  913. if (e.CARDID == "EX1_046e")// dunkeleisenzwerg
  914. {
  915. debuff(m, e);
  916. }
  917. if (e.CARDID == "CS2_188o")// ruchloserunteroffizier
  918. {
  919. debuff(m, e);
  920. }
  921. if (e.CARDID == "EX1_055o")// manasuechtige
  922. {
  923. debuff(m, e);
  924. }
  925. if (e.CARDID == "EX1_549o")//zorn des wildtiers
  926. {
  927. debuff(m, e);
  928. }
  929. if (e.CARDID == "EX1_334e")// dunkler wahnsin (control minion till end of turn)
  930. {
  931. //"uncontrol minion"
  932. minionGetControlled(m, false, true);
  933. }
  934. }
  935. }
  936. }
  937. private void endTurnEffect(bool own)
  938. {
  939. List<Minion> temp = new List<Minion>();
  940. List<Minion> ownmins = new List<Minion>();
  941. List<Minion> enemymins = new List<Minion>();
  942. if (own)
  943. {
  944. temp.AddRange(this.ownMinions);
  945. ownmins.AddRange(this.ownMinions);
  946. enemymins.AddRange(this.enemyMinions);
  947. }
  948. else
  949. {
  950. temp.AddRange(this.enemyMinions);
  951. ownmins.AddRange(this.enemyMinions);
  952. enemymins.AddRange(this.ownMinions);
  953. }
  954. foreach (Minion m in temp)
  955. {
  956. if (m.silenced) continue;
  957. if (m.name == "barongeddon") // all other chards get dmg get 2 dmg
  958. {
  959. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  960. foreach (Minion mm in temp2)
  961. {
  962. if (mm.entitiyID != m.entitiyID)
  963. {
  964. minionGetDamagedOrHealed(mm, 2, 0, true);
  965. }
  966. }
  967. temp2.Clear();
  968. temp2.AddRange(this.enemyMinions);
  969. foreach (Minion mm in temp2)
  970. {
  971. if (mm.entitiyID != m.entitiyID)
  972. {
  973. minionGetDamagedOrHealed(mm, 2, 0, false);
  974. }
  975. }
  976. attackOrHealHero(2, true);
  977. attackOrHealHero(2, false);
  978. }
  979. if (m.name == "blutwichtel" || m.name == "jungepriesterin") // buff a minion
  980. {
  981. List<Minion> temp2 = new List<Minion>(ownmins);
  982. temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));//buff the weakest
  983. foreach (Minion mins in Helpfunctions.TakeList(temp2, 1))
  984. {
  985. minionGetBuffed(mins, 0, 1, own);
  986. }
  987. }
  988. if (m.name == "meisterschwertschmied") // buff a minion
  989. {
  990. List<Minion> temp2 = new List<Minion>(ownmins);
  991. temp2.Sort((a, b) => a.Angr.CompareTo(b.Angr));//buff the weakest
  992. foreach (Minion mins in Helpfunctions.TakeList(temp2, 1))
  993. {
  994. minionGetBuffed(mins, 1, 0, own);
  995. }
  996. }
  997. if (m.name == "kraftverstaerker3000") // buff a minion
  998. {
  999. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  1000. temp2.Sort((a, b) => -a.Angr.CompareTo(b.Angr));//buff the strongest enemy
  1001. foreach (Minion mins in Helpfunctions.TakeList(temp2, 1))
  1002. {
  1003. minionGetBuffed(mins, 1, 0, false);//buff alyways enemy :D
  1004. }
  1005. }
  1006. if (m.name == "gruul") // gain +1/+1
  1007. {
  1008. minionGetBuffed(m, 1, 1, own);
  1009. }
  1010. if (m.name == "astralerarkanist") // gain +2/+2
  1011. {
  1012. if (own && this.ownSecretsIDList.Count>=1)
  1013. {
  1014. minionGetBuffed(m, 2, 2, own);
  1015. }
  1016. if (!own && this.enemySecretCount >= 1)
  1017. {
  1018. minionGetBuffed(m, 2, 2, own);
  1019. }
  1020. }
  1021. if (m.name == "manafluttotem") // draw card
  1022. {
  1023. if (own)
  1024. {
  1025. this.owncarddraw++;
  1026. this.drawACard("");
  1027. }
  1028. else
  1029. {
  1030. this.enemycarddraw++;
  1031. }
  1032. }
  1033. if (m.name == "heiltotem") // heal
  1034. {
  1035. List<Minion> temp2 = new List<Minion>(ownmins);
  1036. foreach (Minion mins in temp2)
  1037. {
  1038. minionGetDamagedOrHealed(mins, 0, 1, own);
  1039. }
  1040. }
  1041. if (m.name == "hogger") // summon
  1042. {
  1043. int posi = m.id;
  1044. CardDB.Card kid = CardDB.Instance.getCardData("gnoll");
  1045. callKid(kid, posi, own);
  1046. }
  1047. if (m.name == "wichtelmeisterin") // damage itself and summon
  1048. {
  1049. int posi = m.id;
  1050. if (m.Hp == 1) posi--;
  1051. minionGetDamagedOrHealed(m, 1, 0, own);
  1052. CardDB.Card kid = CardDB.Instance.getCardData("wichtel");
  1053. callKid(kid, posi, own);
  1054. }
  1055. if (m.name == "natpagle") // draw card
  1056. {
  1057. if (own)
  1058. {
  1059. this.owncarddraw++;
  1060. this.drawACard("");
  1061. }
  1062. else
  1063. {
  1064. this.enemycarddraw++;
  1065. }
  1066. }
  1067. if (m.name == "ragnarosderfeuerfuerst") // summon
  1068. {
  1069. if (this.enemyMinions.Count >= 1)
  1070. {
  1071. List<Minion> temp2 = new List<Minion>(enemymins);
  1072. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));//damage the stronges
  1073. foreach (Minion mins in Helpfunctions.TakeList(temp2, 1))
  1074. {
  1075. minionGetDamagedOrHealed(mins, 8, 0, !own);
  1076. }
  1077. }
  1078. else
  1079. {
  1080. attackOrHealHero(8, !own);
  1081. }
  1082. }
  1083. if (m.name == "reparaturbot") // heal damaged char
  1084. {
  1085. attackOrHealHero(-6, false);
  1086. }
  1087. if (m.card.CardID == "EX1_tk9") //treant which is destroyed
  1088. {
  1089. minionGetDestroyed(m, own);
  1090. }
  1091. if (m.name == "ysera") // draw card
  1092. {
  1093. if (own)
  1094. {
  1095. this.owncarddraw++;
  1096. this.drawACard("yseraerwacht");
  1097. }
  1098. else
  1099. {
  1100. this.enemycarddraw++;
  1101. }
  1102. }
  1103. }
  1104. }
  1105. private void startTurnEffect(bool own)
  1106. {
  1107. List<Minion> temp = new List<Minion>();
  1108. List<Minion> ownmins = new List<Minion>();
  1109. List<Minion> enemymins = new List<Minion>();
  1110. if (own)
  1111. {
  1112. temp.AddRange(this.ownMinions);
  1113. ownmins.AddRange(this.ownMinions);
  1114. enemymins.AddRange(this.enemyMinions);
  1115. }
  1116. else
  1117. {
  1118. temp.AddRange(this.enemyMinions);
  1119. ownmins.AddRange(this.enemyMinions);
  1120. enemymins.AddRange(this.ownMinions);
  1121. }
  1122. bool untergang=false;
  1123. foreach (Minion m in temp)
  1124. {
  1125. if (m.silenced) continue;
  1126. if (m.name == "verwuester") // deal 2 dmg
  1127. {
  1128. List<Minion> temp2 = new List<Minion>(enemymins);
  1129. foreach (Minion mins in temp2)
  1130. {
  1131. minionGetDamagedOrHealed(mins, 2, 0, !own);
  1132. }
  1133. }
  1134. if (m.name == "untergangsverkuender") // destroy
  1135. {
  1136. untergang = true;
  1137. }
  1138. if (m.name == "zielsuchendeshuhn") // ok
  1139. {
  1140. minionGetDestroyed(m, own);
  1141. if (own)
  1142. {
  1143. this.owncarddraw += 3;
  1144. this.drawACard("");
  1145. this.drawACard("");
  1146. this.drawACard("");
  1147. }
  1148. else
  1149. {
  1150. this.enemycarddraw += 3 ;
  1151. }
  1152. }
  1153. if (m.name == "lichtbrunnen") // heal
  1154. {
  1155. if (ownmins.Count >= 1)
  1156. {
  1157. List<Minion> temp2 = new List<Minion>(ownmins);
  1158. bool healed = false;
  1159. foreach (Minion mins in temp2)
  1160. {
  1161. if (mins.wounded)
  1162. {
  1163. minionGetDamagedOrHealed(mins, 0, 3, own);
  1164. healed = true;
  1165. break;
  1166. }
  1167. }
  1168. if (!healed) attackOrHealHero(-3, own);
  1169. }
  1170. else
  1171. {
  1172. attackOrHealHero(-3, own);
  1173. }
  1174. }
  1175. if (m.name == "gefluegelisierer") //
  1176. {
  1177. if (this.ownMinions.Count >= 1)
  1178. {
  1179. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  1180. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));//damage the stronges
  1181. foreach (Minion mins in temp2)
  1182. {
  1183. CardDB.Card c = CardDB.Instance.getCardDataFromID("Mekka4t");
  1184. minionTransform(mins, c, true);
  1185. break;
  1186. }
  1187. }
  1188. else
  1189. {
  1190. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  1191. temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));//damage the lowest
  1192. foreach (Minion mins in temp2)
  1193. {
  1194. CardDB.Card c = CardDB.Instance.getCardDataFromID("Mekka4t");
  1195. minionTransform(mins, c, false);
  1196. break;
  1197. }
  1198. }
  1199. }
  1200. }
  1201. foreach (Minion m in enemymins) // search for corruption in other minions
  1202. {
  1203. List<Enchantment> elist = new List<Enchantment>(m.enchantments);
  1204. foreach (Enchantment e in elist)
  1205. {
  1206. if (e.CARDID == "CS2_063e")//corruption
  1207. {
  1208. if (own && e.controllerOfCreator == this.ownController) // own turn + we owner of curruption
  1209. {
  1210. minionGetDestroyed(m, false);
  1211. }
  1212. if (!own && e.controllerOfCreator != this.ownController)
  1213. {
  1214. minionGetDestroyed(m, true);
  1215. }
  1216. }
  1217. }
  1218. }
  1219. if (untergang)
  1220. {
  1221. foreach (Minion mins in ownmins)
  1222. {
  1223. minionGetDestroyed(mins, own);
  1224. }
  1225. foreach (Minion mins in enemymins)
  1226. {
  1227. minionGetDestroyed(mins, !own);
  1228. }
  1229. }
  1230. }
  1231. private int getSpellDamageDamage(int dmg)
  1232. {
  1233. int retval = dmg;
  1234. retval += this.spellpower;
  1235. if (this.doublepriest >= 1) retval *= (2 * this.doublepriest);
  1236. return retval;
  1237. }
  1238. private int getSpellHeal(int heal)
  1239. {
  1240. int retval = heal;
  1241. retval += this.spellpower;
  1242. if (this.auchenaiseelenpriesterin) retval *= -1;
  1243. if (this.doublepriest >= 1) retval *= (2 * this.doublepriest);
  1244. return retval;
  1245. }
  1246. private void attackEnemyHeroWithoutKill(int dmg)
  1247. {
  1248. int oldHp = this.enemyHeroHp;
  1249. if (this.enemyHeroDefence <= 0)
  1250. {
  1251. this.enemyHeroHp = Math.Min(30, this.enemyHeroHp - dmg);
  1252. }
  1253. else
  1254. {
  1255. if (this.enemyHeroDefence > 0)
  1256. {
  1257. int rest = enemyHeroDefence - dmg;
  1258. if (rest < 0)
  1259. {
  1260. this.enemyHeroHp += rest;
  1261. }
  1262. ownHeroDefence = Math.Max(0, enemyHeroDefence - dmg);
  1263. }
  1264. }
  1265. if (oldHp >= 1 && this.enemyHeroHp == 0) this.enemyHeroHp = 1;
  1266. }
  1267. private void attackOrHealHero(int dmg, bool own) // negative damage is heal
  1268. {
  1269. if (own)
  1270. {
  1271. if (dmg < 0 || this.ownHeroDefence <= 0)
  1272. {
  1273. //heal
  1274. int copy = this.ownHeroHp;
  1275. this.ownHeroHp = Math.Min(30, this.ownHeroHp - dmg);
  1276. if (copy < this.ownHeroHp)
  1277. {
  1278. triggerAHeroGetHealed(own);
  1279. }
  1280. }
  1281. else
  1282. {
  1283. if (this.ownHeroDefence > 0)
  1284. {
  1285. int rest = ownHeroDefence - dmg;
  1286. if (rest < 0)
  1287. {
  1288. this.ownHeroHp += rest;
  1289. }
  1290. ownHeroDefence = Math.Max(0, ownHeroDefence - dmg);
  1291. }
  1292. }
  1293. }
  1294. else
  1295. {
  1296. if (dmg < 0 || this.enemyHeroDefence <= 0)
  1297. {
  1298. int copy = this.enemyHeroHp;
  1299. this.enemyHeroHp = Math.Min(30, this.enemyHeroHp - dmg);
  1300. if (copy < this.enemyHeroHp)
  1301. {
  1302. triggerAHeroGetHealed(own);
  1303. }
  1304. }
  1305. else
  1306. {
  1307. if (this.enemyHeroDefence > 0)
  1308. {
  1309. int rest = enemyHeroDefence - dmg;
  1310. if (rest < 0)
  1311. {
  1312. this.enemyHeroHp += rest;
  1313. }
  1314. ownHeroDefence = Math.Max(0, enemyHeroDefence - dmg);
  1315. }
  1316. }
  1317. }
  1318. }
  1319. private void debuff(Minion m, Enchantment e)
  1320. {
  1321. int anz = m.enchantments.RemoveAll(x => x.creator == e.creator && x.CARDID == e.CARDID);
  1322. if (anz >= 1)
  1323. {
  1324. for (int i = 0; i < anz; i++)
  1325. {
  1326. if (e.charge && !m.card.Charge && m.enchantments.FindAll(x => x.charge == true).Count == 0)
  1327. {
  1328. m.charge = false;
  1329. }
  1330. if (e.taunt && !m.card.tank && m.enchantments.FindAll(x => x.taunt == true).Count == 0)
  1331. {
  1332. m.taunt = false;
  1333. }
  1334. if (e.divineshild && m.enchantments.FindAll(x => x.divineshild == true).Count == 0)
  1335. {
  1336. m.divineshild = false;
  1337. }
  1338. if (e.windfury && !m.card.windfury && m.enchantments.FindAll(x => x.windfury == true).Count == 0)
  1339. {
  1340. m.divineshild = false;
  1341. }
  1342. if (e.imune && m.enchantments.FindAll(x => x.imune == true).Count == 0)
  1343. {
  1344. m.immune = false;
  1345. }
  1346. minionGetBuffed(m, -e.angrbuff, -e.hpbuff, true);
  1347. }
  1348. }
  1349. }
  1350. private void deleteEffectOf(string CardID, int creator)
  1351. {
  1352. // deletes the effect of the cardID with creator from all minions
  1353. Enchantment e = CardDB.getEnchantmentFromCardID(CardID);
  1354. e.creator = creator;
  1355. List<Minion> temp = new List<Minion>(this.ownMinions);
  1356. foreach (Minion m in temp)
  1357. {
  1358. debuff(m, e);
  1359. }
  1360. temp.Clear();
  1361. temp.AddRange(this.enemyMinions);
  1362. foreach (Minion m in temp)
  1363. {
  1364. debuff(m, e);
  1365. }
  1366. }
  1367. private void deleteEffectOfWithExceptions(string CardID, int creator, List<int> exeptions)
  1368. {
  1369. // deletes the effect of the cardID with creator from all minions
  1370. Enchantment e = CardDB.getEnchantmentFromCardID(CardID);
  1371. e.creator = creator;
  1372. foreach (Minion m in this.ownMinions)
  1373. {
  1374. if (!exeptions.Contains(m.id))
  1375. {
  1376. debuff(m, e);
  1377. }
  1378. }
  1379. foreach (Minion m in this.enemyMinions)
  1380. {
  1381. if (!exeptions.Contains(m.id))
  1382. {
  1383. debuff(m, e);
  1384. }
  1385. }
  1386. }
  1387. private void addEffectToMinionNoDoubles(Minion m, Enchantment e, bool own)
  1388. {
  1389. foreach (Enchantment es in m.enchantments)
  1390. {
  1391. if ( es.CARDID == e.CARDID && es.creator == e.creator) return;
  1392. }
  1393. m.enchantments.Add(e);
  1394. if (e.angrbuff >= 1 || e.hpbuff >= 1)
  1395. {
  1396. minionGetBuffed(m, e.angrbuff, e.hpbuff, own);
  1397. }
  1398. if (e.charge) minionGetCharge(m);
  1399. if (e.divineshild) m.divineshild = true;
  1400. if (e.taunt) m.taunt = true;
  1401. if (e.windfury) minionGetWindfurry(m);
  1402. if (e.imune) m.immune = true;
  1403. }
  1404. private void adjacentBuffer(Minion m, string enchantment, int before, int after, bool own)
  1405. {
  1406. List<Minion> lm = new List<Minion>();
  1407. if (own)
  1408. {
  1409. lm.AddRange(this.ownMinions);
  1410. }
  1411. else
  1412. {
  1413. lm.AddRange(this.enemyMinions);
  1414. }
  1415. List<int> exeptions = new List<int>();
  1416. exeptions.Add(before);
  1417. exeptions.Add(after);
  1418. deleteEffectOfWithExceptions(enchantment, m.entitiyID, exeptions);
  1419. Enchantment e = CardDB.getEnchantmentFromCardID(enchantment);
  1420. e.creator = m.entitiyID;
  1421. e.controllerOfCreator = this.ownController;
  1422. if (before >= 0)
  1423. {
  1424. Minion bef = lm[before];
  1425. addEffectToMinionNoDoubles(bef, e, own);
  1426. }
  1427. if (after < lm.Count)
  1428. {
  1429. Minion bef = lm[after];
  1430. addEffectToMinionNoDoubles(bef, e, own);
  1431. }
  1432. }
  1433. private void adjacentBuffUpdate(bool own)
  1434. {
  1435. //int before = -1;
  1436. //int after = 1;
  1437. List<Minion> lm = new List<Minion>();
  1438. if (own)
  1439. {
  1440. lm.AddRange(this.ownMinions);
  1441. }
  1442. else
  1443. {
  1444. lm.AddRange(this.enemyMinions);
  1445. }
  1446. foreach (Minion m in lm)
  1447. {
  1448. /*if (m.name == "terrorwolfalpha")
  1449. {
  1450. string enchantment = "EX1_162o";
  1451. adjacentBuffer(m, enchantment, before, after, own);
  1452. }
  1453. if (m.name == "flammenzungentotem")
  1454. {
  1455. string enchantment = "EX1_565o";
  1456. adjacentBuffer(m, enchantment, before, after, own);
  1457. }
  1458. before++;
  1459. after++;*/
  1460. getNewEffects(m, own, m.id, false);
  1461. }
  1462. }
  1463. private void endEffectsDueToDeath(Minion m, bool own)
  1464. { // minion which grants effect died
  1465. if (m.name == "schlachtzugsleiter") // if he dies, lower attack of all minions of his side
  1466. {
  1467. deleteEffectOf("CS2_122e", m.entitiyID);
  1468. }
  1469. if (m.name == "grimmschuppenorakel")
  1470. {
  1471. deleteEffectOf("EX1_508o", m.entitiyID);
  1472. }
  1473. if (m.name == "terrorwolfalpha")
  1474. {
  1475. deleteEffectOf("EX1_162o", m.entitiyID);
  1476. }
  1477. if (m.name == "murlocanfuehrer")
  1478. {
  1479. deleteEffectOf("EX1_507e", m.entitiyID);
  1480. }
  1481. if (m.name == "suedmeerkapitaen")
  1482. {
  1483. deleteEffectOf("NEW1_027e", m.entitiyID);
  1484. }
  1485. if (m.name == "championvonsturmwind")
  1486. {
  1487. deleteEffectOf("CS2_222o", m.entitiyID);
  1488. }
  1489. if (m.name == "waldwolf")
  1490. {
  1491. deleteEffectOf("DS1_175o", m.entitiyID);
  1492. }
  1493. if (m.name == "leokk")
  1494. {
  1495. deleteEffectOf("NEW1_033o", m.entitiyID);
  1496. }
  1497. //lowering truebaugederalte
  1498. foreach (Minion mnn in this.ownMinions)
  1499. {
  1500. if (mnn.name == "truebaugederalte" && m.card.race == 14)
  1501. {
  1502. minionGetBuffed(mnn, -1, 0, true);
  1503. }
  1504. }
  1505. foreach (Minion mnn in this.enemyMinions)
  1506. {
  1507. if (mnn.name == "truebaugederalte" && m.card.race == 14)
  1508. {
  1509. minionGetBuffed(mnn, -1, 0, false);
  1510. }
  1511. }
  1512. //no deathrattle, but lowering the weapon
  1513. if (m.name == "hasserfuellteschmiedin" && m.wounded)// remove weapon changes form hasserfuelleschmiedin
  1514. {
  1515. if (own && this.ownWeaponDurability >= 1)
  1516. {
  1517. this.ownWeaponAttack -= 2;
  1518. this.ownheroAngr -= 2;
  1519. }
  1520. if (!own && this.enemyWeaponDurability >= 1) this.enemyWeaponAttack -= 2;
  1521. }
  1522. }
  1523. private void getNewEffects(Minion m, bool own, int placeOfNewMob, bool isSummon)
  1524. {
  1525. bool havekriegshymnenanfuehrerin = false;
  1526. List<Minion> temp = new List<Minion>();
  1527. if (own)
  1528. {
  1529. temp.AddRange(this.ownMinions);
  1530. }
  1531. else
  1532. {
  1533. temp.AddRange(this.enemyMinions);
  1534. }
  1535. int ownanz = temp.Count;
  1536. if (own && isSummon && this.ownWeaponName == "schwertdergerechtigkeit")
  1537. {
  1538. minionGetBuffed(m, 1, 1, own);
  1539. this.lowerWeaponDurability(1, true);
  1540. }
  1541. foreach (Minion ownm in temp)
  1542. {
  1543. if (ownm.silenced) continue; // silenced minions dont buff
  1544. if (isSummon && ownm.name == "kriegshymnenanfuehrerin")
  1545. {
  1546. havekriegshymnenanfuehrerin = true;
  1547. }
  1548. if (ownm.name == "schlachtzugsleiter")
  1549. {
  1550. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_122e");
  1551. e.creator = ownm.entitiyID;
  1552. e.controllerOfCreator = this.ownController;
  1553. addEffectToMinionNoDoubles(m, e, own);
  1554. }
  1555. if (ownm.name == "leokk")
  1556. {
  1557. Enchantment e = CardDB.getEnchantmentFromCardID("NEW1_033o");
  1558. e.creator = ownm.entitiyID;
  1559. e.controllerOfCreator = this.ownController;
  1560. addEffectToMinionNoDoubles(m, e, own);
  1561. }
  1562. if (ownm.name == "championvonsturmwind")
  1563. {
  1564. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_222o");
  1565. e.creator = ownm.entitiyID;
  1566. e.controllerOfCreator = this.ownController;
  1567. addEffectToMinionNoDoubles(m, e, own);
  1568. }
  1569. if (ownm.name == "grimmschuppenorakel" && m.card.race == 14)
  1570. {
  1571. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_508o");
  1572. e.creator = ownm.entitiyID;
  1573. e.controllerOfCreator = this.ownController;
  1574. addEffectToMinionNoDoubles(m, e, own);
  1575. }
  1576. if (ownm.name == "murlocanfuehrer" && m.card.race == 14)
  1577. {
  1578. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_507e");
  1579. e.creator = ownm.entitiyID;
  1580. e.controllerOfCreator = this.ownController;
  1581. addEffectToMinionNoDoubles(m, e, own);
  1582. }
  1583. if (ownm.name == "suedmeerkapitaen" && m.card.race == 23)
  1584. {
  1585. Enchantment e = CardDB.getEnchantmentFromCardID("NEW1_027e");
  1586. e.creator = ownm.entitiyID;
  1587. e.controllerOfCreator = this.ownController;
  1588. addEffectToMinionNoDoubles(m, e, own);
  1589. }
  1590. if (ownm.name == "terrorwolfalpha")
  1591. {
  1592. if (ownm.id == placeOfNewMob + 1 || ownm.id == placeOfNewMob - 1)
  1593. {
  1594. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_162o");
  1595. e.creator = ownm.entitiyID;
  1596. e.controllerOfCreator = this.ownController;
  1597. addEffectToMinionNoDoubles(m, e, own);
  1598. }
  1599. }
  1600. if (ownm.name == "flammenzungentotem")
  1601. {
  1602. if (ownm.id == placeOfNewMob + 1 || ownm.id == placeOfNewMob - 1)
  1603. {
  1604. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_565o");
  1605. e.creator = ownm.entitiyID;
  1606. e.controllerOfCreator = this.ownController;
  1607. addEffectToMinionNoDoubles(m, e, own);
  1608. }
  1609. }
  1610. if (ownm.name == "waldwolf" && (TAG_RACE)m.card.race == TAG_RACE.PET)
  1611. {
  1612. Enchantment e = CardDB.getEnchantmentFromCardID("DS1_175o");
  1613. e.creator = ownm.entitiyID;
  1614. e.controllerOfCreator = this.ownController;
  1615. addEffectToMinionNoDoubles(m, e, own);
  1616. }
  1617. if (isSummon && ownm.name == "tundranashorn" && (TAG_RACE)m.card.race == TAG_RACE.PET)
  1618. {
  1619. minionGetCharge(m);
  1620. }
  1621. }
  1622. // minions that gave ALL minions buffs
  1623. temp.Clear();
  1624. if (own)
  1625. {
  1626. temp.AddRange(this.enemyMinions);
  1627. }
  1628. else
  1629. {
  1630. temp.AddRange(this.ownMinions);
  1631. }
  1632. foreach (Minion ownm in temp) // the enemy grimmschuppenorakel!
  1633. {
  1634. if (ownm.silenced) continue; // silenced minions dont buff
  1635. if (ownm.name == "grimmschuppenorakel" && m.card.race == 14)
  1636. {
  1637. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_508o");
  1638. e.creator = ownm.entitiyID;
  1639. addEffectToMinionNoDoubles(m, e, own);
  1640. }
  1641. }
  1642. if (isSummon && havekriegshymnenanfuehrerin && m.Angr <= 3)
  1643. {
  1644. minionGetCharge(m);
  1645. }
  1646. }
  1647. private void deathrattle(Minion m, bool own)
  1648. {
  1649. if (!m.silenced)
  1650. {
  1651. //real deathrattles
  1652. if (m.card.CardID == "EX1_534")//m.name == "savannenhochmaehne"
  1653. {
  1654. CardDB.Card c = CardDB.Instance.getCardData("hyaene");
  1655. callKid(c, m.id - 1, own);
  1656. callKid(c, m.id - 1, own);
  1657. }
  1658. if (m.name == "erntegolem")
  1659. {
  1660. CardDB.Card c = CardDB.Instance.getCardData("beschaedigtergolem");
  1661. callKid(c, m.id - 1, own);
  1662. }
  1663. if (m.name == "cairnebluthuf")
  1664. {
  1665. CardDB.Card c = CardDB.Instance.getCardData("bainebluthuf");
  1666. callKid(c, m.id - 1, own);
  1667. //penaltity for summon this thing :D (so we dont kill it only to have a new minion)
  1668. this.evaluatePenality += 5;
  1669. }
  1670. if (m.name == "diebestie")
  1671. {
  1672. CardDB.Card c = CardDB.Instance.getCardData("finkleeinhorn");
  1673. callKid(c, m.id - 1, own);
  1674. }
  1675. if (m.name == "lepragnom")
  1676. {
  1677. attackOrHealHero(2, !own);
  1678. }
  1679. if (m.name == "beutehamsterer")
  1680. {
  1681. if (own)
  1682. {
  1683. this.owncarddraw++;
  1684. drawACard("unknown");
  1685. }
  1686. else
  1687. {
  1688. this.enemycarddraw++;
  1689. }
  1690. }
  1691. if (m.name == "blutmagierthalnos")
  1692. {
  1693. if (own)
  1694. {
  1695. this.owncarddraw++;
  1696. drawACard("unknown");
  1697. }
  1698. else
  1699. {
  1700. this.enemycarddraw++;
  1701. }
  1702. }
  1703. if (m.name == "monstrositaet")
  1704. {
  1705. if (logging) help.logg("deathrattle monstrositaet:");
  1706. attackOrHealHero(2, false);
  1707. attackOrHealHero(2, true);
  1708. List<Minion> temp = new List<Minion>(this.ownMinions);
  1709. foreach (Minion mnn in temp)
  1710. {
  1711. minionGetDamagedOrHealed(mnn, 2, 0, true);
  1712. }
  1713. temp.Clear();
  1714. temp.AddRange(this.enemyMinions);
  1715. foreach (Minion mnn in temp)
  1716. {
  1717. minionGetDamagedOrHealed(mnn, 2, 0, false);
  1718. }
  1719. }
  1720. if (m.name == "tirionfordring")
  1721. {
  1722. if (own)
  1723. {
  1724. CardDB.Card c = CardDB.Instance.getCardData("aschenbringer");
  1725. this.equipWeapon(c);
  1726. }
  1727. else
  1728. {
  1729. this.enemyWeaponAttack = 5;
  1730. this.enemyWeaponDurability = 3;
  1731. }
  1732. }
  1733. if (m.name == "sylvanaswindlaeufer")
  1734. {
  1735. List<Minion> temp = new List<Minion>();
  1736. if (own)
  1737. {
  1738. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  1739. temp2.Sort((a, b) => a.Angr.CompareTo(b.Angr));
  1740. temp.AddRange(Helpfunctions.TakeList(temp2, Math.Min(2, this.enemyMinions.Count)));
  1741. }
  1742. else
  1743. {
  1744. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  1745. temp2.Sort((a, b) => -a.Angr.CompareTo(b.Angr));
  1746. temp.AddRange(temp2);
  1747. }
  1748. if (temp.Count >= 1)
  1749. {
  1750. if (own)
  1751. {
  1752. Minion target = new Minion();
  1753. target = temp[0];
  1754. if (target.taunt && !temp[1].taunt) target = temp[1];
  1755. minionGetControlled(target, true, false);
  1756. }
  1757. else
  1758. {
  1759. Minion target = new Minion();
  1760. target = temp[0];
  1761. foreach (Minion mnn in temp)
  1762. {
  1763. if (mnn.Ready)
  1764. {
  1765. target = mnn;
  1766. break;
  1767. }
  1768. }
  1769. minionGetControlled(target, false, false);
  1770. }
  1771. }
  1772. }
  1773. }
  1774. //deathrattle enchantments // these can be triggered after an silence (if they are casted after the silence)
  1775. bool geistderahnen = false;
  1776. foreach (Enchantment e in m.enchantments)
  1777. {
  1778. if (e.CARDID == "CS2_038e" && !geistderahnen)
  1779. {
  1780. //revive minion due to "geist der ahnen"
  1781. CardDB.Card kid = m.card;
  1782. int pos = this.ownMinions.Count - 1;
  1783. if (!own) pos = this.enemyMinions.Count - 1;
  1784. callKid(kid, pos, own);
  1785. geistderahnen = true;
  1786. }
  1787. //Seele des Waldes
  1788. if (e.CARDID == "EX1_158e")
  1789. {
  1790. //revive minion due to "geist der ahnen"
  1791. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_158t");//Treant
  1792. int pos = this.ownMinions.Count - 1;
  1793. if (!own) pos = this.enemyMinions.Count - 1;
  1794. callKid(kid, pos, own);
  1795. }
  1796. }
  1797. }
  1798. private void triggerAMinionDied(Minion m, bool own)
  1799. {
  1800. List<Minion> temp = new List<Minion>();
  1801. List<Minion> temp2 = new List<Minion>();
  1802. if (own)
  1803. {
  1804. temp.AddRange(this.ownMinions);
  1805. temp2.AddRange(this.enemyMinions);
  1806. }
  1807. else
  1808. {
  1809. temp.AddRange(this.enemyMinions);
  1810. temp2.AddRange(this.ownMinions);
  1811. }
  1812. foreach (Minion mnn in temp)
  1813. {
  1814. if (mnn.silenced) continue;
  1815. if (mnn.name == "aasfressendehyaene" && m.card.race == 20)
  1816. {
  1817. mnn.Angr += 2; mnn.Hp += 1;
  1818. }
  1819. if (mnn.name == "fleischfressenderghul")
  1820. {
  1821. mnn.Angr += 1;
  1822. }
  1823. if (mnn.name == "kultmeisterin")
  1824. {
  1825. if (own)
  1826. {
  1827. this.owncarddraw++;
  1828. drawACard("unknown");
  1829. }
  1830. else
  1831. {
  1832. this.enemycarddraw++;
  1833. }
  1834. }
  1835. }
  1836. foreach (Minion mnn in temp2)
  1837. {
  1838. if (mnn.silenced) continue;
  1839. if (mnn.name == "fleischfressenderghul")
  1840. {
  1841. mnn.Angr += 1;
  1842. }
  1843. }
  1844. }
  1845. private void minionGetDestroyed(Minion m, bool own)
  1846. {
  1847. if (own)
  1848. {
  1849. removeMinionFromList(m, this.ownMinions, true);
  1850. }
  1851. else
  1852. {
  1853. removeMinionFromList(m, this.enemyMinions, false);
  1854. }
  1855. }
  1856. private void minionReturnToHand(Minion m, bool own)
  1857. {
  1858. if (own)
  1859. {
  1860. removeMinionFromListNoDeath(m, this.ownMinions, true);
  1861. drawACard(m.card.name);
  1862. }
  1863. else
  1864. {
  1865. removeMinionFromListNoDeath(m, this.enemyMinions, false);
  1866. }
  1867. }
  1868. private void minionTransform(Minion m, CardDB.Card c, bool own)
  1869. {
  1870. Minion tranform = createNewMinion(c, m.id, own);
  1871. Minion temp = new Minion();
  1872. temp.setMinionTominion(m);
  1873. m.setMinionTominion(tranform);
  1874. m.entitiyID = -2;
  1875. this.endEffectsDueToDeath(temp, own);
  1876. adjacentBuffUpdate(own);
  1877. if (logging) help.logg("minion got sheep" + m.name + " " + m.Angr);
  1878. }
  1879. private void minionGetSilenced(Minion m, bool own)
  1880. {
  1881. //TODO
  1882. m.taunt = false;
  1883. m.stealth = false;
  1884. m.charge = false;
  1885. m.divineshild = false;
  1886. m.poisonous = false;
  1887. //delete enrage (if minion is silenced the first time)
  1888. if (m.wounded && m.card.Enrage && !m.silenced)
  1889. {
  1890. deleteWutanfall(m, own);
  1891. }
  1892. //delete enrage (if minion is silenced the first time)
  1893. if (m.frozen && m.numAttacksThisTurn == 0 && !(m.name == "uralterwaechter" || m.name == "ragnarosderfeuerfuerst") && !m.playedThisTurn)
  1894. {
  1895. m.Ready = true;
  1896. }
  1897. m.frozen = false;
  1898. if (!m.silenced && (m.name == "uralterwaechter" || m.name == "ragnarosderfeuerfuerst") && !m.playedThisTurn && m.numAttacksThisTurn==0)
  1899. {
  1900. m.Ready = true;
  1901. }
  1902. endEffectsDueToDeath(m, own);//the minion doesnt die, but its effect is ending
  1903. m.enchantments.Clear();
  1904. m.Angr = m.card.Attack;
  1905. if (m.maxHp < m.card.Health)//minion has lower maxHp as his card -> heal his hp
  1906. {
  1907. m.Hp += m.card.Health - m.maxHp; //heal minion
  1908. }
  1909. m.maxHp = m.card.Health;
  1910. if (m.Hp > m.maxHp) m.Hp = m.maxHp;
  1911. getNewEffects(m, own, m.id, false);// minion get effects of others
  1912. m.silenced = true;
  1913. }
  1914. private void minionGetControlled(Minion m, bool newOwner, bool canAttack)
  1915. {
  1916. List<Minion> newOwnerList = new List<Minion>();
  1917. if (newOwner) { newOwnerList = new List<Minion>(this.ownMinions); }
  1918. else { newOwnerList.AddRange(this.enemyMinions); }
  1919. if (newOwnerList.Count >= 7) return;
  1920. if (newOwner)
  1921. {
  1922. removeMinionFromListNoDeath(m, this.enemyMinions, !newOwner);
  1923. m.Ready = false;
  1924. this.getNewEffects(m, newOwner, newOwnerList.Count, false);
  1925. addMiniontoList(m, this.ownMinions, newOwnerList.Count, newOwner);
  1926. if (m.charge || canAttack)
  1927. {
  1928. m.charge = false;
  1929. minionGetCharge(m);
  1930. }
  1931. }
  1932. else
  1933. {
  1934. removeMinionFromListNoDeath(m, this.ownMinions, !newOwner);
  1935. //m.Ready=false;
  1936. addMiniontoList(m, this.enemyMinions, newOwnerList.Count, newOwner);
  1937. //if (m.charge) minionGetCharge(m);
  1938. }
  1939. }
  1940. private void minionGetWindfurry(Minion m)
  1941. {
  1942. if (m.windfury) return;
  1943. m.windfury = true;
  1944. if (!m.playedThisTurn && m.numAttacksThisTurn <= 1)
  1945. {
  1946. m.Ready = true;
  1947. }
  1948. if (!m.charge && m.numAttacksThisTurn <= 1)
  1949. {
  1950. m.Ready = true;
  1951. }
  1952. }
  1953. private void minionGetCharge(Minion m)
  1954. {
  1955. if (m.charge) return;
  1956. m.charge = true;
  1957. if (m.playedThisTurn && (m.numAttacksThisTurn == 0 || (m.numAttacksThisTurn == 1 && m.windfury)))
  1958. {
  1959. m.Ready = true;
  1960. }
  1961. }
  1962. private void minionGetReady(Minion m) // minion get ready due to attack-buff
  1963. {
  1964. if (!m.silenced && (m.name == "uralterwaechter" || m.name == "ragnarosderfeuerfuerst")) return;
  1965. if (!m.playedThisTurn && (m.numAttacksThisTurn == 0 || (m.numAttacksThisTurn == 1 && m.windfury)))
  1966. {
  1967. m.Ready = true;
  1968. }
  1969. }
  1970. private void minionGetBuffed(Minion m, int attackbuff, int hpbuff, bool own)
  1971. {
  1972. if (m.Angr == 0 && attackbuff >= 1) minionGetReady(m);
  1973. m.Angr = Math.Max(0, m.Angr + attackbuff);
  1974. if (hpbuff >= 1)
  1975. {
  1976. m.Hp = m.Hp + hpbuff;
  1977. m.maxHp = m.maxHp + hpbuff;
  1978. }
  1979. else
  1980. {
  1981. //debuffing hp, lower only maxhp (unless maxhp < hp)
  1982. m.maxHp = m.maxHp + hpbuff;
  1983. if (m.maxHp < m.Hp)
  1984. {
  1985. m.Hp = m.maxHp;
  1986. }
  1987. }
  1988. if (m.maxHp == m.Hp)
  1989. {
  1990. m.wounded = false;
  1991. }
  1992. else
  1993. {
  1994. m.wounded = true;
  1995. }
  1996. if (m.name == "lichtbrut" && !m.silenced)
  1997. {
  1998. m.Angr = m.Hp;
  1999. }
  2000. if (m.Hp <= 0)
  2001. {
  2002. if (own)
  2003. {
  2004. this.removeMinionFromList(m, this.ownMinions, true);
  2005. if (logging) help.logg("own " + m.name + " died");
  2006. }
  2007. else
  2008. {
  2009. this.removeMinionFromList(m, this.enemyMinions, false);
  2010. if (logging) help.logg("enemy " + m.name + " died");
  2011. }
  2012. }
  2013. }
  2014. private void deleteWutanfall(Minion m, bool own)
  2015. {
  2016. if (m.name == "wuetendeshuhn")
  2017. {
  2018. minionGetBuffed(m, -5, 0, own);
  2019. }
  2020. if (m.name == "amaniberserker")
  2021. {
  2022. minionGetBuffed(m, -3, 0, own);
  2023. }
  2024. if (m.name == "taurenkrieger")
  2025. {
  2026. minionGetBuffed(m, -3, 0, own);
  2027. }
  2028. if (m.name == "grommashhoellschrei")
  2029. {
  2030. minionGetBuffed(m, -6, 0, own);
  2031. }
  2032. if (m.name == "tobenderworgen")
  2033. {
  2034. minionGetBuffed(m, -1, 0, own);
  2035. minionGetWindfurry(m);
  2036. }
  2037. if (m.name == "hasserfuellteschmiedin")
  2038. {
  2039. if (own && this.ownWeaponDurability >= 1)
  2040. {
  2041. this.ownWeaponAttack -= 2;
  2042. this.ownheroAngr -= 2;
  2043. }
  2044. if (!own && this.enemyWeaponDurability >= 1) this.enemyWeaponAttack -= 2;
  2045. }
  2046. }
  2047. private void wutanfall(Minion m, bool woundedBefore, bool own) // = enrange effects
  2048. {
  2049. if (!m.card.Enrage) return; // if minion has no enrange, do nothing
  2050. if (woundedBefore == m.wounded || m.silenced) return; // if he was wounded, and still is (or was unwounded) do nothing
  2051. if (m.wounded && m.Hp >= 1) //is wounded, wasnt wounded before, grant wutanfall
  2052. {
  2053. if (m.name == "wuetendeshuhn")
  2054. {
  2055. minionGetBuffed(m, 5, 0, own);
  2056. }
  2057. if (m.name == "amaniberserker")
  2058. {
  2059. minionGetBuffed(m, 3, 0, own);
  2060. }
  2061. if (m.name == "taurenkrieger")
  2062. {
  2063. minionGetBuffed(m, 3, 0, own);
  2064. }
  2065. if (m.name == "grommashhoellschrei")
  2066. {
  2067. minionGetBuffed(m, 6, 0, own);
  2068. }
  2069. if (m.name == "tobenderworgen")
  2070. {
  2071. minionGetBuffed(m, 1, 0, own);
  2072. minionGetWindfurry(m);
  2073. }
  2074. if (m.name == "hasserfuellteschmiedin")
  2075. {
  2076. if (own && this.ownWeaponDurability >= 1)
  2077. {
  2078. this.ownWeaponAttack += 2;
  2079. this.ownheroAngr += 2;
  2080. }
  2081. if (!own && this.enemyWeaponDurability >= 1) this.enemyWeaponAttack += 2;
  2082. }
  2083. }
  2084. if (!m.wounded) // reverse buffs
  2085. {
  2086. deleteWutanfall(m, own);
  2087. }
  2088. }
  2089. private void triggerAHeroGetHealed(bool own)
  2090. {
  2091. foreach (Minion mnn in this.ownMinions)
  2092. {
  2093. if (mnn.silenced) continue;
  2094. if (mnn.name == "lichtwaechterin")
  2095. {
  2096. minionGetBuffed(mnn, 2, 0, true);
  2097. }
  2098. }
  2099. foreach (Minion mnn in this.enemyMinions)
  2100. {
  2101. if (mnn.silenced) continue;
  2102. if (mnn.name == "lichtwaechterin")
  2103. {
  2104. minionGetBuffed(mnn, 2, 0, false);
  2105. }
  2106. }
  2107. }
  2108. private void triggerAMinionGetHealed(Minion m, bool own)
  2109. {
  2110. foreach (Minion mnn in this.ownMinions)
  2111. {
  2112. if (mnn.silenced) continue;
  2113. if (mnn.name == "klerikerinvonnordhain")
  2114. {
  2115. this.owncarddraw++;
  2116. drawACard("unknown");
  2117. }
  2118. if (mnn.name == "lichtwaechterin")
  2119. {
  2120. minionGetBuffed(mnn, 2, 0, true);
  2121. }
  2122. }
  2123. foreach (Minion mnn in this.enemyMinions)
  2124. {
  2125. if (mnn.silenced) continue;
  2126. if (mnn.name == "klerikerinvonnordhain")
  2127. {
  2128. this.enemycarddraw++;
  2129. }
  2130. if (mnn.name == "lichtwaechterin")
  2131. {
  2132. minionGetBuffed(mnn, 2, 0, false);
  2133. }
  2134. }
  2135. }
  2136. private void triggerAMinionGetDamage(Minion m, bool own)
  2137. {
  2138. //minion take dmg
  2139. if (m.name == "akolythdesschmerzes" && !m.silenced)
  2140. {
  2141. if (own)
  2142. {
  2143. this.owncarddraw++;
  2144. drawACard("unknown");
  2145. }
  2146. else
  2147. {
  2148. this.enemycarddraw++;
  2149. }
  2150. }
  2151. if (m.name == "gurubashiberserker" && !m.silenced)
  2152. {
  2153. minionGetBuffed(m, 3, 0, own);
  2154. }
  2155. foreach (Minion mnn in this.ownMinions)
  2156. {
  2157. if (mnn.silenced) continue;
  2158. if (mnn.name == "wuetenderberserker")
  2159. {
  2160. mnn.Angr++;
  2161. }
  2162. if (own)
  2163. {
  2164. if (mnn.name == "ruestungsschmiedin")
  2165. {
  2166. this.ownHeroDefence++;
  2167. }
  2168. }
  2169. }
  2170. foreach (Minion mnn in this.enemyMinions)
  2171. {
  2172. if (mnn.silenced) continue;
  2173. if (mnn.name == "wuetenderberserker")
  2174. {
  2175. mnn.Angr++;
  2176. }
  2177. if (!own)
  2178. {
  2179. if (mnn.name == "ruestungsschmiedin")
  2180. {
  2181. this.enemyHeroDefence++;
  2182. }
  2183. }
  2184. }
  2185. }
  2186. private void minionGetDamagedOrHealed(Minion m, int damages, int heals, bool own)
  2187. {
  2188. minionGetDamagedOrHealed(m, damages, heals, own, false);
  2189. }
  2190. private void minionGetDamagedOrHealed(Minion m, int damages, int heals, bool own, bool dontCalcLostDmg)
  2191. {
  2192. int damage = damages;
  2193. int heal = heals;
  2194. bool woundedbefore = m.wounded;
  2195. if (heal < 0) // heal was shifted in damage
  2196. {
  2197. damage = -1 * heal;
  2198. heal = 0;
  2199. }
  2200. if (damage >= 1 && m.divineshild)
  2201. {
  2202. m.divineshild = false;
  2203. if (!own && !dontCalcLostDmg) this.lostDamage += damage;
  2204. return;
  2205. }
  2206. if (m.cantLowerHPbelowONE && damage >= 1 && damage >= m.Hp) damage = m.Hp - 1;
  2207. if (!own && !dontCalcLostDmg && m.Hp < damage) lostDamage += damage - m.Hp;
  2208. m.Hp = m.Hp - damage;
  2209. int hpcopy = m.Hp;
  2210. if (heal >= 1)
  2211. {
  2212. m.Hp = m.Hp + Math.Min(heal, m.maxHp - m.Hp);
  2213. }
  2214. if (heal >= 1)
  2215. {
  2216. triggerAMinionGetHealed(m, own);
  2217. //minionWasHealed
  2218. }
  2219. if (damage >= 1)
  2220. {
  2221. triggerAMinionGetDamage(m, own);
  2222. }
  2223. if (m.maxHp == m.Hp)
  2224. {
  2225. m.wounded = false;
  2226. }
  2227. else
  2228. {
  2229. m.wounded = true;
  2230. }
  2231. this.wutanfall(m, woundedbefore, own);
  2232. if (m.name == "lichtbrut" && !m.silenced)
  2233. {
  2234. m.Angr = m.Hp;
  2235. }
  2236. if (m.Hp <= 0)
  2237. {
  2238. if (own)
  2239. {
  2240. this.removeMinionFromList(m, this.ownMinions, true);
  2241. if (logging) help.logg("own " + m.name + " died");
  2242. }
  2243. else
  2244. {
  2245. this.removeMinionFromList(m, this.enemyMinions, false);
  2246. if (logging) help.logg("enemy " + m.name + " died");
  2247. }
  2248. }
  2249. }
  2250. private void copyMinion(Minion target, Minion source)
  2251. {
  2252. target.name = source.name;
  2253. target.Angr = source.Angr;
  2254. target.card = CardDB.Instance.getCardDataFromID(source.card.CardID);
  2255. target.charge = source.charge;
  2256. target.divineshild = source.divineshild;
  2257. target.exhausted = source.exhausted;
  2258. target.frozen = source.frozen;
  2259. target.Hp = source.Hp;
  2260. target.immune = source.immune;
  2261. target.maxHp = source.maxHp;
  2262. target.playedThisTurn = source.playedThisTurn;
  2263. target.poisonous = source.poisonous;
  2264. target.silenced = source.silenced;
  2265. target.stealth = source.stealth;
  2266. target.taunt = source.taunt;
  2267. target.windfury = source.windfury;
  2268. target.wounded = source.wounded;
  2269. target.Ready = false;
  2270. if (target.charge) target.Ready = true;
  2271. foreach (Enchantment e in source.enchantments)
  2272. {
  2273. Enchantment ne = CardDB.getEnchantmentFromCardID(e.CARDID);
  2274. target.enchantments.Add(ne);
  2275. }
  2276. }
  2277. private void removeMinionFromListNoDeath(Minion m, List<Minion> l, bool own)
  2278. {
  2279. l.Remove(m);
  2280. int i = 0;
  2281. foreach (Minion mnn in l)
  2282. {
  2283. mnn.id = i;
  2284. mnn.zonepos = i + 1;
  2285. i++;
  2286. }
  2287. this.endEffectsDueToDeath(m, own);
  2288. adjacentBuffUpdate(own);
  2289. }
  2290. private void removeMinionFromList(Minion m, List<Minion> l, bool own)
  2291. {
  2292. l.Remove(m);
  2293. int i = 0;
  2294. foreach (Minion mnn in l)
  2295. {
  2296. mnn.id = i;
  2297. mnn.zonepos = i + 1;
  2298. i++;
  2299. }
  2300. this.endEffectsDueToDeath(m, own);
  2301. this.deathrattle(m, own);
  2302. this.triggerAMinionDied(m, own);
  2303. adjacentBuffUpdate(own);
  2304. }
  2305. private void attack(int attacker, int target, bool dontcount)
  2306. {
  2307. Minion m = new Minion();
  2308. bool attackOwn = true;
  2309. if (attacker < 10)
  2310. {
  2311. m = this.ownMinions[attacker];
  2312. attackOwn = true;
  2313. }
  2314. if (attacker >= 10 && attacker < 20)
  2315. {
  2316. m = this.enemyMinions[attacker - 10];
  2317. attackOwn = false;
  2318. }
  2319. if (!dontcount)
  2320. {
  2321. m.numAttacksThisTurn++;
  2322. if (m.windfury && m.numAttacksThisTurn == 2)
  2323. {
  2324. m.Ready = false;
  2325. }
  2326. if (!m.windfury)
  2327. {
  2328. m.Ready = false;
  2329. }
  2330. }
  2331. if (logging) help.logg(".attck with" + m.name + " A " + m.Angr + " H " + m.Hp);
  2332. if (target == 200)//target is hero
  2333. {
  2334. attackOrHealHero(m.Angr, false);
  2335. return;
  2336. }
  2337. bool enemyOwn = false;
  2338. Minion enemy = new Minion();
  2339. if (target < 10)
  2340. {
  2341. enemy = this.ownMinions[target];
  2342. enemyOwn = true;
  2343. }
  2344. if (target >= 10 && target < 20)
  2345. {
  2346. enemy = this.enemyMinions[target - 10];
  2347. enemyOwn = false;
  2348. }
  2349. int ownAttack = m.Angr;
  2350. int enemyAttack = enemy.Angr;
  2351. // defender take damage
  2352. if (m.card.poisionous)
  2353. {
  2354. minionGetDestroyed(enemy, enemyOwn);
  2355. }
  2356. else
  2357. {
  2358. int oldHP = enemy.Hp;
  2359. minionGetDamagedOrHealed(enemy, ownAttack, 0, enemyOwn);
  2360. if (oldHP > enemy.Hp && m.name == "wasserelementar") enemy.frozen = true;
  2361. }
  2362. //attacker take damage
  2363. if (!m.immune)
  2364. {
  2365. if (enemy.card.poisionous)
  2366. {
  2367. minionGetDestroyed(m, attackOwn);
  2368. }
  2369. else
  2370. {
  2371. int oldHP = m.Hp;
  2372. minionGetDamagedOrHealed(m, enemyAttack, 0, attackOwn);
  2373. if (oldHP > m.Hp && enemy.name == "wasserelementar") m.frozen = true;
  2374. }
  2375. }
  2376. }
  2377. public void attackWithMinion(Minion ownMinion, int target, int targetEntity)
  2378. {
  2379. Action a = new Action();
  2380. a.minionplay = true;
  2381. a.owntarget = ownMinion.id;
  2382. a.ownEntitiy = ownMinion.entitiyID;
  2383. a.enemytarget = target;
  2384. a.enemyEntitiy = targetEntity;
  2385. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  2386. this.playactions.Add(a);
  2387. if (logging) help.logg("attck with" + ownMinion.name + " " + ownMinion.id + " trgt " + target + " A " + ownMinion.Angr + " H " + ownMinion.Hp);
  2388. attack(ownMinion.id, target, false);
  2389. //draw a card if the minion has enchantment from: Segen der weisheit
  2390. int segenderweisheitAnz = 0;
  2391. foreach (Enchantment e in ownMinion.enchantments)
  2392. {
  2393. if (e.CARDID == "EX1_363e2" && e.controllerOfCreator == this.ownController)
  2394. {
  2395. segenderweisheitAnz++;
  2396. }
  2397. }
  2398. this.owncarddraw += segenderweisheitAnz;
  2399. for (int i = 0; i < segenderweisheitAnz; i++)
  2400. {
  2401. drawACard("");
  2402. }
  2403. }
  2404. private void addMiniontoList(Minion m, List<Minion> l, int pos, bool own)
  2405. {
  2406. List<Minion> newmins = new List<Minion>(l);
  2407. l.Clear();
  2408. int i = 0;
  2409. foreach (Minion mnn in newmins)
  2410. {
  2411. if (pos == i)
  2412. {
  2413. m.id = i;
  2414. m.zonepos = i + 1;
  2415. l.Add(m);
  2416. i++;
  2417. }
  2418. mnn.id = i;
  2419. mnn.zonepos = i + 1;
  2420. l.Add(mnn);
  2421. i++;
  2422. }
  2423. // maybe he is last mob
  2424. if (pos == i)
  2425. {
  2426. m.id = i;
  2427. m.zonepos = i + 1;
  2428. l.Add(m);
  2429. i++;
  2430. }
  2431. adjacentBuffUpdate(own);
  2432. triggerPlayedAMinion(m.card, own);
  2433. }
  2434. private Minion createNewMinion(CardDB.Card c, int placeOfNewMob, bool own)
  2435. {
  2436. Minion m = new Minion();
  2437. m.card = c;
  2438. m.entitiyID = c.entityID;
  2439. m.Posix = 0;
  2440. m.Posiy = 0;
  2441. m.Angr = c.Attack;
  2442. m.Hp = c.Health;
  2443. m.maxHp = c.Health;
  2444. m.name = c.name;
  2445. m.playedThisTurn = true;
  2446. m.numAttacksThisTurn = 0;
  2447. m.id = placeOfNewMob;
  2448. m.zonepos = placeOfNewMob + 1;
  2449. if (c.windfury) m.windfury = true;
  2450. if (c.tank) m.taunt = true;
  2451. if (c.Charge)
  2452. {
  2453. m.Ready = true;
  2454. m.charge = true;
  2455. }
  2456. if (c.poisionous) m.poisonous = true;
  2457. if (c.Stealth) m.stealth = true;
  2458. if (m.name == "lichtbrut" && !m.silenced)
  2459. {
  2460. m.Angr = m.Hp;
  2461. }
  2462. this.getNewEffects(m, own, placeOfNewMob, true);
  2463. return m;
  2464. }
  2465. private void doBattleCryWithTargeting(Minion c, int target, int choice)
  2466. {
  2467. //target is the target AFTER spawning mobs
  2468. int attackbuff = 0;
  2469. int hpbuff = 0;
  2470. int heal = 0;
  2471. int damage = 0;
  2472. bool spott = false;
  2473. bool divineshild = false;
  2474. bool windfury = false;
  2475. bool silence = false;
  2476. bool destroy = false;
  2477. bool frozen = false;
  2478. bool stealth = false;
  2479. bool backtohand = false;
  2480. bool own = true;
  2481. if (target >= 10 && target < 20)
  2482. {
  2483. own = false;
  2484. }
  2485. Minion m = new Minion();
  2486. if (target < 10)
  2487. {
  2488. m = this.ownMinions[target];
  2489. }
  2490. if (target >= 10 && target < 20)
  2491. {
  2492. m = this.enemyMinions[target - 10];
  2493. }
  2494. if (c.name == "urtumderlehren")
  2495. {
  2496. if (choice == 2)
  2497. {
  2498. heal = 5;
  2499. }
  2500. }
  2501. if (c.name == "hueterdeshains")
  2502. {
  2503. if (choice == 1)
  2504. {
  2505. damage = 2;
  2506. }
  2507. if (choice == 2)
  2508. {
  2509. silence = true;
  2510. }
  2511. }
  2512. if (c.name == "verrueckteralchemist")
  2513. {
  2514. if (target < 10)
  2515. {
  2516. bool woundedbef = m.wounded;
  2517. int temp = m.Angr;
  2518. m.Angr = m.Hp;
  2519. m.Hp = temp;
  2520. m.maxHp = temp;
  2521. m.wounded = false;
  2522. wutanfall(m, woundedbef, true);
  2523. if (m.Hp <= 0) minionGetDestroyed(m, true);
  2524. }
  2525. if (target >= 10 && target < 20)
  2526. {
  2527. bool woundedbef = m.wounded;
  2528. int temp = m.Angr;
  2529. m.Angr = m.Hp;
  2530. m.Hp = temp;
  2531. m.maxHp = temp;
  2532. m.wounded = false;
  2533. wutanfall(m, woundedbef, false);
  2534. if (m.Hp <= 0) minionGetDestroyed(m, false);
  2535. }
  2536. }
  2537. if (c.name == "si7-agent" && this.cardsPlayedThisTurn >= 1)
  2538. {
  2539. damage = 2;
  2540. }
  2541. if (c.name == "entfuehrer" && this.cardsPlayedThisTurn >= 1)
  2542. {
  2543. backtohand = true;
  2544. }
  2545. if (c.name == "meisterindertarnung")
  2546. {
  2547. stealth = true;
  2548. }
  2549. if (c.name == "kabaleschattenpriesterin")
  2550. {
  2551. minionGetControlled(m, true, false);
  2552. }
  2553. if (c.name == "eisenschnabeleule" || c.name == "zauberbrecher") //eisenschnabeleule, zauberbrecher
  2554. {
  2555. silence = true;
  2556. }
  2557. if (c.name == "blutelfenklerikerin")
  2558. {
  2559. attackbuff = 1;
  2560. hpbuff = 1;
  2561. }
  2562. if (c.name == "uralterbraumeister")
  2563. {
  2564. backtohand = true;
  2565. }
  2566. if (c.name == "jungerbraumeister")
  2567. {
  2568. backtohand = true;
  2569. }
  2570. if (c.name == "dunkeleisenzwerg")
  2571. {
  2572. //attackbuff = 2;
  2573. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_046e");
  2574. e.creator = c.entitiyID;
  2575. e.controllerOfCreator = this.ownController;
  2576. addEffectToMinionNoDoubles(m, e, own);
  2577. }
  2578. if (c.name == "hungrigekrabbe")
  2579. {
  2580. destroy = true;
  2581. /*Enchantment e = CardDB.getEnchantmentFromCardID("NEW1_017e");
  2582. e.creator = c.entitiyID;
  2583. e.controllerOfCreator = this.ownController;
  2584. addEffectToMinionNoDoubles(c, e, true);//buff own hungrige krabbe*/
  2585. minionGetBuffed(c, 2, 2, true);
  2586. }
  2587. if (c.name == "ruchloserunteroffizier")
  2588. {
  2589. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_188o");
  2590. e.creator = c.entitiyID;
  2591. e.controllerOfCreator = this.ownController;
  2592. addEffectToMinionNoDoubles(m, e, own);
  2593. }
  2594. if (c.name == "fieserzuchtmeister")
  2595. {
  2596. attackbuff = 2;
  2597. damage = 1;
  2598. }
  2599. if (c.name == "frostelementar")
  2600. {
  2601. frozen = true;
  2602. }
  2603. if (c.name == "elfenbogenschuetzin")
  2604. {
  2605. damage = 1;
  2606. }
  2607. if (c.name == "voodoodoktor")
  2608. {
  2609. heal = 2;
  2610. }
  2611. if (c.name == "vollstreckerdestempels")
  2612. {
  2613. hpbuff = 3;
  2614. }
  2615. if (c.name == "schuetzevoneisenschmiede")
  2616. {
  2617. damage = 1;
  2618. }
  2619. if (c.name == "sturmlanzenkommando")
  2620. {
  2621. damage = 2;
  2622. }
  2623. if (c.name == "hundemeister")
  2624. {
  2625. attackbuff = 2;
  2626. hpbuff = 2;
  2627. spott = true;
  2628. }
  2629. if (c.name == "friedensbewahrer")
  2630. {
  2631. attackbuff = 1 - m.Angr;
  2632. }
  2633. if (c.name == "derschwarzeritter")
  2634. {
  2635. destroy = true;
  2636. }
  2637. if (c.name == "argentumbeschuetzer")
  2638. {
  2639. divineshild = true; // Grants NO buff
  2640. }
  2641. if (c.name == "windsprecher")
  2642. {
  2643. windfury = true;
  2644. }
  2645. if (c.name == "feuerelementar")
  2646. {
  2647. damage = 3;
  2648. }
  2649. if (c.name == "seherdesirdenenrings")
  2650. {
  2651. heal = 3;
  2652. }
  2653. if (c.name == "grosswildjaeger")
  2654. {
  2655. destroy = true;
  2656. }
  2657. if (c.name == "alexstrasza")
  2658. {
  2659. if (target == 100)
  2660. {
  2661. this.ownHeroHp = 15;
  2662. }
  2663. if (target == 200)
  2664. {
  2665. this.enemyHeroHp = 15;
  2666. }
  2667. }
  2668. if (c.name == "gesichtslosermanipulator")
  2669. {//todo, test this :D
  2670. copyMinion(c, m);
  2671. }
  2672. //make effect on target
  2673. //ownminion
  2674. if (target < 10)
  2675. {
  2676. if (attackbuff != 0 || hpbuff != 0)
  2677. {
  2678. minionGetBuffed(m, attackbuff, hpbuff, true);
  2679. }
  2680. if (damage != 0 || heal != 0)
  2681. {
  2682. minionGetDamagedOrHealed(m, damage, heal, true);
  2683. }
  2684. if (spott) m.taunt = true;
  2685. if (windfury) minionGetWindfurry(m);
  2686. if (divineshild) m.divineshild = true;
  2687. if (destroy) minionGetDestroyed(m, true);
  2688. if (frozen) m.frozen = true;
  2689. if (stealth) m.stealth = true;
  2690. if (backtohand) minionReturnToHand(m, true);
  2691. if (silence) minionGetSilenced(m, true);
  2692. }
  2693. //enemyminion
  2694. if (target >= 10 && target < 20)
  2695. {
  2696. if (attackbuff != 0 || hpbuff != 0)
  2697. {
  2698. minionGetBuffed(m, attackbuff, hpbuff, false);
  2699. }
  2700. if (damage != 0 || heal != 0)
  2701. {
  2702. minionGetDamagedOrHealed(m, damage, heal, false);
  2703. }
  2704. if (spott) m.taunt = true;
  2705. if (windfury) minionGetWindfurry(m);
  2706. if (divineshild) m.divineshild = true;
  2707. if (destroy) minionGetDestroyed(m, false);
  2708. if (frozen) m.frozen = true;
  2709. if (stealth) m.stealth = true;
  2710. if (backtohand) minionReturnToHand(m, false);
  2711. if (silence) minionGetSilenced(m, false);
  2712. }
  2713. if (target == 100)
  2714. {
  2715. if (frozen) this.ownHeroFrozen = true;
  2716. if (damage >= 1) attackOrHealHero(damage, true);
  2717. if (heal >= 1) attackOrHealHero(-heal, true);
  2718. }
  2719. if (target == 200)
  2720. {
  2721. if (frozen) this.enemyHeroFrozen = true;
  2722. if (damage >= 1) attackOrHealHero(damage, false);
  2723. if (heal >= 1) attackOrHealHero(-heal, false);
  2724. }
  2725. }
  2726. private void doBattleCryWithoutTargeting(Minion c, int position, bool own, int choice)
  2727. {
  2728. //only nontargetable battlecrys!
  2729. //druid choices
  2730. //urtum des krieges:
  2731. if (c.name == "urtumdeskrieges")
  2732. {
  2733. if (choice == 1)
  2734. {
  2735. minionGetBuffed(c, 5, 0, true);
  2736. }
  2737. if (choice == 2)
  2738. {
  2739. minionGetBuffed(c, 0, 5, true);
  2740. c.taunt = true;
  2741. }
  2742. }
  2743. if (c.name == "urtumderlehren")
  2744. {
  2745. if (choice == 1)
  2746. {
  2747. this.owncarddraw += 2;
  2748. this.drawACard("");
  2749. this.drawACard("");
  2750. }
  2751. }
  2752. if (c.name == "druidederklaue")
  2753. {
  2754. if (choice == 1)
  2755. {
  2756. minionGetCharge(c);
  2757. }
  2758. if (choice == 2)
  2759. {
  2760. minionGetBuffed(c, 0, 2, true);
  2761. c.taunt = true;
  2762. }
  2763. }
  2764. if (c.name == "cenarius")
  2765. {
  2766. if (choice == 1)
  2767. {
  2768. foreach (Minion m in this.ownMinions)
  2769. {
  2770. minionGetBuffed(m, 2, 2, true);
  2771. }
  2772. }
  2773. //choice 2 = spawn 2 kids
  2774. }
  2775. //normal ones
  2776. if (c.name == "gedankenkontrolleur")
  2777. {
  2778. if (this.enemyMinions.Count >= 4)
  2779. {
  2780. List<Minion> temp = new List<Minion>();
  2781. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  2782. temp2.Sort((a, b) => a.Angr.CompareTo(b.Angr));//we take the weekest
  2783. temp.AddRange(Helpfunctions.TakeList(temp2, 2));
  2784. Minion target = new Minion();
  2785. target = temp[0];
  2786. if (target.taunt && !temp[1].taunt) target = temp[1];
  2787. minionGetControlled(target, true, false);
  2788. }
  2789. }
  2790. if (c.name == "teufelswache")
  2791. {
  2792. this.ownMaxMana--;
  2793. }
  2794. if (c.name == "arkangolem")
  2795. {
  2796. this.enemyMaxMana++;
  2797. }
  2798. if (c.name == "edwinvancleef" && this.cardsPlayedThisTurn >= 1)
  2799. {
  2800. minionGetBuffed(c, this.cardsPlayedThisTurn * 2, this.cardsPlayedThisTurn * 2, own);
  2801. }
  2802. if (c.name == "verdammniswache")
  2803. {
  2804. this.owncarddraw -= Math.Min(2, this.owncards.Count);
  2805. this.owncards.RemoveRange(0, Math.Min(2, this.owncards.Count));
  2806. }
  2807. if (c.name == "sukkubus")
  2808. {
  2809. this.owncarddraw -= Math.Min(1, this.owncards.Count);
  2810. this.owncards.RemoveRange(0, Math.Min(1, this.owncards.Count));
  2811. }
  2812. if (c.name == "lordjaraxxus")
  2813. {
  2814. this.ownHeroAblility = CardDB.Instance.getCardDataFromID("EX1_tk33");
  2815. this.ownHeroName = "lordjaraxxus";
  2816. this.ownHeroHp = c.Hp;
  2817. }
  2818. if (c.name == "flammenwichtel")
  2819. {
  2820. attackOrHealHero(3, own);
  2821. }
  2822. if (c.name == "grubenlord")
  2823. {
  2824. attackOrHealHero(5, own);
  2825. }
  2826. if (c.name == "schreckenderleere")
  2827. {
  2828. List<Minion> temp = new List<Minion>();
  2829. if (own)
  2830. {
  2831. temp.AddRange(this.ownMinions);
  2832. }
  2833. else
  2834. {
  2835. temp.AddRange(this.enemyMinions);
  2836. }
  2837. int angr = 0;
  2838. int hp = 0;
  2839. foreach (Minion m in temp)
  2840. {
  2841. if (m.id == position + 1 || m.id == position - 1)
  2842. {
  2843. angr += m.Angr;
  2844. hp += m.Hp;
  2845. }
  2846. }
  2847. foreach (Minion m in temp)
  2848. {
  2849. if (m.id == position + 1 || m.id == position - 1)
  2850. {
  2851. minionGetDestroyed(m, own);
  2852. }
  2853. }
  2854. minionGetBuffed(c, angr, hp, own);
  2855. }
  2856. if (c.name == "frostwolfkriegsfuerst")
  2857. {
  2858. minionGetBuffed(c, this.ownMinions.Count, this.ownMinions.Count, own);
  2859. }
  2860. if (c.name == "blutsegelraeuberin")
  2861. {
  2862. c.Angr += this.ownWeaponAttack;
  2863. }
  2864. if (c.name == "suedmeerdeckmatrose" && this.ownWeaponDurability >= 1)
  2865. {
  2866. minionGetCharge(c);
  2867. }
  2868. if (c.name == "blutritter")
  2869. {
  2870. int shilds = 0;
  2871. foreach (Minion m in this.ownMinions)
  2872. {
  2873. if (m.divineshild)
  2874. {
  2875. m.divineshild = false;
  2876. shilds++;
  2877. }
  2878. }
  2879. foreach (Minion m in this.enemyMinions)
  2880. {
  2881. if (m.divineshild)
  2882. {
  2883. m.divineshild = false;
  2884. shilds++;
  2885. }
  2886. }
  2887. minionGetBuffed(c, 3 * shilds, 3 * shilds, own);
  2888. }
  2889. if (c.name == "koenigmukla")
  2890. {
  2891. this.enemycarddraw += 2;
  2892. }
  2893. if (c.name == "tiefenlichtorakel")
  2894. {
  2895. this.enemycarddraw += 2;
  2896. this.owncarddraw += 2;
  2897. drawACard("unknown");
  2898. drawACard("unknown");
  2899. }
  2900. if (c.name == "arathiwaffenschmiedin")
  2901. {
  2902. CardDB.Card wcard = CardDB.Instance.getCardData("streitaxt");
  2903. this.equipWeapon(wcard);
  2904. }
  2905. if (c.name == "blutsegelkorsar")
  2906. {
  2907. this.lowerWeaponDurability(1, false);
  2908. }
  2909. if (c.name == "saeurehaltigerschlamm")
  2910. {
  2911. this.lowerWeaponDurability(1000, false);
  2912. }
  2913. if (c.name == "ingenieurslehrling")
  2914. {
  2915. this.owncarddraw++;
  2916. drawACard("unknown");
  2917. }
  2918. if (c.name == "gnomischeerfinderin")
  2919. {
  2920. this.owncarddraw++;
  2921. drawACard("unknown");
  2922. }
  2923. if (c.name == "dunkelschuppenheilerin")
  2924. {
  2925. List<Minion> temp = new List<Minion>(this.ownMinions);
  2926. foreach (Minion m in temp)
  2927. {
  2928. minionGetDamagedOrHealed(m, 0, 2, true);
  2929. }
  2930. attackOrHealHero(-2, true);
  2931. }
  2932. if (c.name == "nachtklinge")
  2933. {
  2934. attackOrHealHero(3, !own);
  2935. }
  2936. if (c.name == "zwielichtdrache")
  2937. {
  2938. minionGetBuffed(c, 0, this.owncards.Count, true);
  2939. }
  2940. if (c.name == "azurblauerdrache")
  2941. {
  2942. this.owncarddraw++;
  2943. drawACard("unknown");
  2944. }
  2945. if (c.name == "harrisonjones")
  2946. {
  2947. this.enemyWeaponAttack = 0;
  2948. this.owncarddraw += enemyWeaponDurability;
  2949. for (int i = 0; i < enemyWeaponDurability; i++)
  2950. {
  2951. drawACard("unknown");
  2952. }
  2953. this.enemyWeaponDurability = 0;
  2954. }
  2955. if (c.name == "waechterderkoenige")
  2956. {
  2957. attackOrHealHero(-6, true);
  2958. }
  2959. if (c.name == "kapitaengruenhaut")
  2960. {
  2961. if (this.ownWeaponName != "")
  2962. {
  2963. this.ownheroAngr += 1;
  2964. this.ownWeaponAttack++;
  2965. this.ownWeaponDurability++;
  2966. }
  2967. }
  2968. if (c.name == "priesteringvonelune")
  2969. {
  2970. attackOrHealHero(-4, true);
  2971. }
  2972. if (c.name == "verletzterklingenmeister")
  2973. {
  2974. minionGetDamagedOrHealed(c, 4, 0, true);
  2975. }
  2976. if (c.name == "schreckenshoellenbestie")
  2977. {
  2978. List<Minion> temp = new List<Minion>(this.ownMinions);
  2979. foreach (Minion m in temp)
  2980. {
  2981. minionGetDamagedOrHealed(m, 1, 0, true);
  2982. }
  2983. temp.Clear();
  2984. temp.AddRange(this.enemyMinions);
  2985. foreach (Minion m in temp)
  2986. {
  2987. minionGetDamagedOrHealed(m, 1, 0, false);
  2988. }
  2989. attackOrHealHero(1, false);
  2990. attackOrHealHero(1, true);
  2991. }
  2992. if (c.name == "tundranashorn")
  2993. {
  2994. minionGetCharge(c);
  2995. List<Minion> temp = new List<Minion>(this.ownMinions);
  2996. foreach (Minion m in temp)
  2997. {
  2998. if ((TAG_RACE)m.card.race == TAG_RACE.PET)
  2999. {
  3000. minionGetCharge(m);
  3001. }
  3002. }
  3003. }
  3004. if (c.name == "panischerkodo")
  3005. {
  3006. List<Minion> temp = new List<Minion>();
  3007. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  3008. temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));//destroys the weakest
  3009. temp.AddRange(temp2);
  3010. foreach (Minion enemy in temp)
  3011. {
  3012. if (enemy.Angr <= 2)
  3013. {
  3014. minionGetDestroyed(enemy, false);
  3015. break;
  3016. }
  3017. }
  3018. }
  3019. if (c.name == "sonnenzornbeschuetzerin")
  3020. {
  3021. List<Minion> temp = new List<Minion>(this.ownMinions);
  3022. foreach (Minion m in temp)
  3023. {
  3024. if (m.id == position - 1 || m.id == position + 1)
  3025. {
  3026. m.taunt = true;
  3027. }
  3028. }
  3029. }
  3030. if (c.name == "uraltermagier")
  3031. {
  3032. List<Minion> temp = new List<Minion>(this.ownMinions);
  3033. foreach (Minion m in temp)
  3034. {
  3035. if (m.id == position - 1 || m.id == position + 1)
  3036. {
  3037. m.card.spellpowervalue++;
  3038. }
  3039. }
  3040. }
  3041. if (c.name == "verteidigervonargus")
  3042. {
  3043. List<Minion> temp = new List<Minion>(this.ownMinions);
  3044. foreach (Minion m in temp)
  3045. {
  3046. if (m.id == position - 1 || m.id == position + 1)
  3047. {
  3048. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_093e");
  3049. e.creator = c.entitiyID;
  3050. e.controllerOfCreator = this.ownController;
  3051. addEffectToMinionNoDoubles(m, e, own);
  3052. }
  3053. }
  3054. }
  3055. if (c.name == "tiefenlichtseher")
  3056. {
  3057. List<Minion> temp = new List<Minion>(this.ownMinions);
  3058. foreach (Minion m in temp)
  3059. {
  3060. if ((TAG_RACE)m.card.race == TAG_RACE.MURLOC)
  3061. {
  3062. minionGetBuffed(m, 0, 2, true);
  3063. }
  3064. }
  3065. temp.Clear();
  3066. temp.AddRange(this.enemyMinions);
  3067. foreach (Minion m in temp)
  3068. {
  3069. if ((TAG_RACE)m.card.race == TAG_RACE.MURLOC)
  3070. {
  3071. minionGetBuffed(m, 0, 2, false);
  3072. }
  3073. }
  3074. }
  3075. if (c.name == "todesschwinge")
  3076. {
  3077. List<Minion> temp = new List<Minion>(this.ownMinions);
  3078. foreach (Minion enemy in temp)
  3079. {
  3080. minionGetDestroyed(enemy, true);
  3081. }
  3082. temp.Clear();
  3083. temp.AddRange(this.enemyMinions);
  3084. foreach (Minion enemy in temp)
  3085. {
  3086. minionGetDestroyed(enemy, false);
  3087. }
  3088. this.owncards.Clear();
  3089. }
  3090. if (c.name == "papageideskapitaens")
  3091. {
  3092. this.owncarddraw++;
  3093. this.drawACard("");
  3094. }
  3095. }
  3096. private int spawnKids(CardDB.Card c, int position, bool own, int choice)
  3097. {
  3098. int kids = 0;
  3099. if (c.name == "murlocgezeitenjaeger")
  3100. {
  3101. kids = 1;
  3102. CardDB.Card kid = CardDB.Instance.getCardData("mulocspaeher");
  3103. callKid(kid, position, own);
  3104. }
  3105. if (c.name == "jaegerderklingenhauer")
  3106. {
  3107. kids = 1;
  3108. CardDB.Card kid = CardDB.Instance.getCardData("eber");
  3109. callKid(kid, position, own);
  3110. }
  3111. if (c.name == "drachlingmechanikerin")
  3112. {
  3113. kids = 1;
  3114. CardDB.Card kid = CardDB.Instance.getCardData("mechanischerdrachling");
  3115. callKid(kid, position, own);
  3116. }
  3117. if (c.name == "leeroyjenkins")
  3118. {
  3119. kids = 2;
  3120. CardDB.Card kid = CardDB.Instance.getCardData("welpling");
  3121. int pos = this.ownMinions.Count - 1;
  3122. if (own) pos = this.enemyMinions.Count - 1;
  3123. callKid(kid, pos, !own);
  3124. callKid(kid, pos, !own);
  3125. }
  3126. if (c.name == "cenarius" && choice == 2)
  3127. {
  3128. kids = 2;
  3129. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_573t"); //special treant
  3130. int pos = this.ownMinions.Count - 1;
  3131. if (!own) pos = this.enemyMinions.Count - 1;
  3132. callKid(kid, pos, own);
  3133. callKid(kid, pos, own);
  3134. }
  3135. if (c.name == "ritterdersilbernenhand")
  3136. {
  3137. kids = 1;
  3138. CardDB.Card kid = CardDB.Instance.getCardData("knappe");
  3139. callKid(kid, position, own);
  3140. }
  3141. if (c.name == "gelbinmekkadrill")
  3142. {
  3143. kids = 1;
  3144. CardDB.Card kid = CardDB.Instance.getCardData("zielsuchendeshuhn");
  3145. callKid(kid, position, own);
  3146. }
  3147. if (c.name == "raedelsfuehrerderdefias" && this.cardsPlayedThisTurn >= 1) //needs combo for spawn
  3148. {
  3149. kids = 1;
  3150. CardDB.Card kid = CardDB.Instance.getCardData("banditderdefias");
  3151. callKid(kid, position, own);
  3152. }
  3153. if (c.name == "onyxia")
  3154. {
  3155. kids = 7 - this.ownMinions.Count;
  3156. CardDB.Card kid = CardDB.Instance.getCardData("Welpling");
  3157. for (int i = 0; i < kids; i++)
  3158. {
  3159. callKid(kid, position, own);
  3160. }
  3161. }
  3162. return kids;
  3163. }
  3164. private void callKid(CardDB.Card c, int placeoffather, bool own)
  3165. {
  3166. if (own && this.ownMinions.Count >= 7) return;
  3167. if (!own && this.enemyMinions.Count >= 7) return;
  3168. int mobplace = placeoffather + 1;
  3169. /*if (own && this.ownMinions.Count >= 1)
  3170. {
  3171. retval.X = ownMinions[mobplace - 1].Posix + 85;
  3172. retval.Y = ownMinions[mobplace - 1].Posiy;
  3173. }
  3174. if (!own && this.enemyMinions.Count >= 1)
  3175. {
  3176. retval.X = enemyMinions[mobplace - 1].Posix + 85;
  3177. retval.Y = enemyMinions[mobplace - 1].Posiy;
  3178. }*/
  3179. Minion m = createNewMinion(c, mobplace, own);
  3180. if (own)
  3181. {
  3182. addMiniontoList(m, this.ownMinions, mobplace, own);// additional minions span next to it!
  3183. }
  3184. else
  3185. {
  3186. addMiniontoList(m, this.enemyMinions, mobplace, own);// additional minions span next to it!
  3187. }
  3188. }
  3189. private Action placeAmobSomewhere(CardDB.Card c, int cardpos, int target, int choice, int placepos)
  3190. {
  3191. Action a = new Action();
  3192. a.cardplay = true;
  3193. a.card = c;
  3194. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  3195. //we place him on the right!
  3196. int mobplace = placepos;
  3197. //create the minion out of the card + effects from other minions, which higher his hp/angr
  3198. Minion m = createNewMinion(c, mobplace, true);
  3199. //make the battlecry (where you dont need a target)
  3200. doBattleCryWithoutTargeting(m, mobplace, true, choice);
  3201. if (target >= 0)
  3202. {
  3203. doBattleCryWithTargeting(m, target, choice);
  3204. }
  3205. //maybe he spawns another minion
  3206. addMiniontoList(m, this.ownMinions, mobplace, true);
  3207. if (logging) help.logg("add " + m.card.name);
  3208. // additional minions span next to it!
  3209. int spawnkids = spawnKids(c, mobplace, true, choice); // if a mob targets something, it doesnt spawn minions!?
  3210. if (target >= 0)
  3211. {
  3212. // the OWNtargets right of the placed mobs are going up :D
  3213. if (target < 10 && target > mobplace + spawnkids) target++;
  3214. }
  3215. a.enemytarget = target;
  3216. a.owntarget = mobplace + 1; //1==before the 1.minion on board , 2 ==before the 2. minion o board (from left)
  3217. return a;
  3218. }
  3219. private void lowerWeaponDurability(int value, bool own)
  3220. {
  3221. if (own)
  3222. {
  3223. this.ownWeaponDurability -= value;
  3224. if (this.ownWeaponDurability <= 0)
  3225. {
  3226. this.ownheroAngr -= this.ownWeaponAttack;
  3227. this.ownWeaponDurability = 0;
  3228. this.ownWeaponAttack = 0;
  3229. this.ownWeaponName = "";
  3230. }
  3231. }
  3232. else
  3233. {
  3234. this.enemyWeaponDurability -= value;
  3235. if (this.enemyWeaponDurability <= 0)
  3236. {
  3237. this.enemyWeaponDurability = 0;
  3238. this.enemyWeaponAttack = 0;
  3239. }
  3240. }
  3241. }
  3242. private void equipWeapon(CardDB.Card c)
  3243. {
  3244. if (this.ownWeaponDurability >= 1) this.lostWeaponDamage += this.ownWeaponDurability * this.ownWeaponAttack;
  3245. this.ownheroAngr = c.Attack;
  3246. this.ownWeaponAttack = c.Attack;
  3247. this.ownWeaponDurability = c.Durability;
  3248. if (c.name == "schicksalshammer")
  3249. {
  3250. this.ownHeroWindfury = true;
  3251. }
  3252. else
  3253. {
  3254. this.ownHeroWindfury = false;
  3255. }
  3256. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  3257. {
  3258. this.ownHeroReady = true;
  3259. }
  3260. if (c.name == "langbogendesgladiators")
  3261. {
  3262. this.heroImmuneWhileAttacking = true;
  3263. }
  3264. else
  3265. {
  3266. this.heroImmuneWhileAttacking = false;
  3267. }
  3268. foreach (Minion m in this.ownMinions)
  3269. {
  3270. if (m.name == "suedmeerdeckmatrose")
  3271. {
  3272. minionGetCharge(m);
  3273. }
  3274. }
  3275. }
  3276. private void playCardWithTarget(CardDB.Card c, int target, int choice)
  3277. {
  3278. //play card with target
  3279. int attackbuff = 0;
  3280. int hpbuff = 0;
  3281. int heal = 0;
  3282. int damage = 0;
  3283. bool spott = false;
  3284. bool divineshild = false;
  3285. bool windfury = false;
  3286. bool silence = false;
  3287. bool destroy = false;
  3288. bool frozen = false;
  3289. bool stealth = false;
  3290. bool backtohand = false;
  3291. bool charge = false;
  3292. bool setHPtoONE = false;
  3293. bool immune = false;
  3294. int adjacentDamage = 0;
  3295. bool sheep = false;
  3296. bool frogg = false;
  3297. //special
  3298. bool geistderahnen = false;
  3299. bool ueberwaeltigendemacht = false;
  3300. bool own = true;
  3301. if (target >= 10 && target < 20)
  3302. {
  3303. own = false;
  3304. }
  3305. Minion m = new Minion();
  3306. if (target < 10)
  3307. {
  3308. m = this.ownMinions[target];
  3309. }
  3310. if (target >= 10 && target < 20)
  3311. {
  3312. m = this.enemyMinions[target - 10];
  3313. }
  3314. //warrior###########################################################################
  3315. if (c.name == "hinrichten")
  3316. {
  3317. destroy = true;
  3318. }
  3319. if (c.name == "innerewut")
  3320. {
  3321. damage = 1;
  3322. attackbuff = 2;
  3323. }
  3324. if (c.name == "zerschmettern")
  3325. {
  3326. damage = 2;
  3327. if (m.Hp >= 3)
  3328. {
  3329. this.owncarddraw++;
  3330. this.drawACard("");
  3331. }
  3332. }
  3333. if (c.name == "toedlicherstoss")
  3334. {
  3335. damage = 4;
  3336. if (ownHeroHp <= 12) damage = 6;
  3337. }
  3338. if (c.name == "schildschlag")
  3339. {
  3340. damage = this.ownHeroDefence;
  3341. }
  3342. if (c.name == "sturmangriff")
  3343. {
  3344. charge = true;
  3345. attackbuff = 2;
  3346. }
  3347. if (c.name == "toben")
  3348. {
  3349. attackbuff = 3;
  3350. hpbuff = 3;
  3351. }
  3352. //hunter#################################################################################
  3353. if (c.name == "maldesjaegers")
  3354. {
  3355. setHPtoONE = true;
  3356. }
  3357. if (c.name == "arkanerschuss")
  3358. {
  3359. damage = 2;
  3360. }
  3361. if (c.name == "fass")
  3362. {
  3363. damage = 3;
  3364. foreach (Minion mnn in this.ownMinions)
  3365. {
  3366. if ((TAG_RACE)mnn.card.race == TAG_RACE.PET)
  3367. {
  3368. damage = 5;
  3369. }
  3370. }
  3371. }
  3372. if (c.name == "zorndeswildtiers")
  3373. {
  3374. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_549o");
  3375. e.creator = c.entityID;
  3376. e.controllerOfCreator = this.ownController;
  3377. addEffectToMinionNoDoubles(m, e, own);
  3378. }
  3379. if (c.name == "explosivschuss")
  3380. {
  3381. damage = 5;
  3382. adjacentDamage = 1;
  3383. }
  3384. //mage###############################################################################
  3385. if (c.name == "eislanze")
  3386. {
  3387. if (m.frozen)
  3388. { damage = 4; }
  3389. else { frozen = true; }
  3390. }
  3391. if (c.name == "kaeltekegel")
  3392. {
  3393. damage = 1;
  3394. adjacentDamage = 1;
  3395. frozen = true;
  3396. }
  3397. if (c.name == "feuerball")
  3398. {
  3399. damage = 6;
  3400. }
  3401. if (c.name == "verwandlung")
  3402. {
  3403. sheep = true;
  3404. }
  3405. if (c.name == "pyroschlag")
  3406. {
  3407. damage = 10;
  3408. }
  3409. if (c.name == "frostblitz")
  3410. {
  3411. damage = 3;
  3412. frozen = true;
  3413. }
  3414. //pala######################################################################
  3415. if (c.name == "demut")
  3416. {
  3417. m.Angr = 1;
  3418. }
  3419. if (c.name == "handdesschutzes")
  3420. {
  3421. divineshild = true;
  3422. }
  3423. if (c.name == "segendermacht")
  3424. {
  3425. attackbuff = 3;
  3426. }
  3427. if (c.name == "heiligeslicht")
  3428. {
  3429. heal = 6;
  3430. }
  3431. if (c.name == "hammerdeszorns")
  3432. {
  3433. damage = 3;
  3434. this.owncarddraw++;
  3435. drawACard("");
  3436. }
  3437. if (c.name == "segenderkoenige")
  3438. {
  3439. attackbuff = 4;
  3440. hpbuff = 4;
  3441. }
  3442. if (c.name == "segenderweisheit")
  3443. {
  3444. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_363e2");
  3445. e.creator = c.entityID;
  3446. e.controllerOfCreator = this.ownController;
  3447. m.enchantments.Add(e);
  3448. }
  3449. if (c.name == "gesegneterchampion")
  3450. {
  3451. m.Angr *= 2;
  3452. }
  3453. if (c.name == "heiligerzorn")
  3454. {
  3455. damage = 2;
  3456. this.owncarddraw++;
  3457. drawACard("");
  3458. }
  3459. if (c.name == "handauflegung")
  3460. {
  3461. for (int i = 0; i < 3; i++)
  3462. {
  3463. this.owncarddraw++;
  3464. this.drawACard("");
  3465. }
  3466. heal = 8;
  3467. }
  3468. //priest ##########################################
  3469. if (c.name == "dunklerwahnsinn")
  3470. {
  3471. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_334e");
  3472. e.creator = c.entityID;
  3473. e.controllerOfCreator = this.ownController;
  3474. addEffectToMinionNoDoubles(m, e, own);
  3475. this.minionGetControlled(m, true, true);
  3476. }
  3477. if (c.name == "gedankenkontrolle")
  3478. {
  3479. this.minionGetControlled(m, true, false);
  3480. }
  3481. if (c.name == "heiligepein")
  3482. {
  3483. damage = 2;
  3484. }
  3485. if (c.name == "machtwortschild")
  3486. {
  3487. hpbuff = 2;
  3488. this.owncarddraw++;
  3489. this.drawACard("");
  3490. }
  3491. if (c.name == "stille")
  3492. {
  3493. silence = true;
  3494. }
  3495. if (c.name == "goettlicherwiller")
  3496. {
  3497. hpbuff = m.Hp;
  3498. }
  3499. if (c.name == "inneresfeuer")
  3500. {
  3501. m.Angr = m.Hp;
  3502. }
  3503. if (c.name == "heiligesfeuer")
  3504. {
  3505. damage = 5;
  3506. int ownheal = getSpellHeal(5);
  3507. attackOrHealHero(-ownheal, true);
  3508. }
  3509. if (c.name == "schattenwortschmerz")
  3510. {
  3511. destroy = true;
  3512. }
  3513. if (c.name == "schattenworttod")
  3514. {
  3515. destroy = true;
  3516. }
  3517. //rogue ##########################################
  3518. if (c.name == "schattenschritt")
  3519. {
  3520. backtohand = true;
  3521. m.card.cost = Math.Max(0, m.card.cost -= 2);
  3522. }
  3523. if (c.name == "kopfnuss")
  3524. {
  3525. backtohand = true;
  3526. }
  3527. if (c.name == "tueckischeklinge")
  3528. {
  3529. damage = 1;
  3530. this.owncarddraw++;
  3531. this.drawACard("");
  3532. }
  3533. if (c.name == "kaltbluetigkeit")
  3534. {
  3535. attackbuff = 2;
  3536. if (this.cardsPlayedThisTurn >= 1) attackbuff = 4;
  3537. }
  3538. if (c.name == "verhuellen")
  3539. {
  3540. stealth = true;
  3541. }
  3542. if (c.name == "ausweiden")
  3543. {
  3544. damage = 2;
  3545. if (this.cardsPlayedThisTurn >= 1) damage = 4;
  3546. }
  3547. if (c.name == "verrat")
  3548. {
  3549. //attack right neightbor
  3550. if (target >= 10 && target < 20 && target < this.enemyMinions.Count + 10 - 1)
  3551. {
  3552. attack(target, target + 1, true);
  3553. }
  3554. if (target < 10 && target < this.ownMinions.Count - 1)
  3555. {
  3556. attack(target, target + 1, true);
  3557. }
  3558. //attack left neightbor
  3559. if (target >= 11 || (target < 10 && target >= 1))
  3560. {
  3561. attack(target, target - 1, true);
  3562. }
  3563. }
  3564. if (c.name == "klingedesverderbens")
  3565. {
  3566. damage = 1;
  3567. if (this.cardsPlayedThisTurn >= 1) damage = 2;
  3568. }
  3569. if (c.name == "meucheln")
  3570. {
  3571. damage = 2;
  3572. }
  3573. if (c.name == "attentat")
  3574. {
  3575. destroy = true;
  3576. }
  3577. //shaman ##########################################
  3578. if (c.name == "blitzschlag")
  3579. {
  3580. damage = 3;
  3581. }
  3582. if (c.name == "frostschock")
  3583. {
  3584. frozen = true;
  3585. damage = 1;
  3586. }
  3587. if (c.name == "waffedesfelsbeissers")
  3588. {
  3589. if (target <= 20)
  3590. {
  3591. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_045e");
  3592. e.creator = c.entityID;
  3593. e.controllerOfCreator = this.ownController;
  3594. addEffectToMinionNoDoubles(m, e, own);
  3595. }
  3596. else
  3597. {
  3598. if (target == 100)
  3599. {
  3600. this.ownheroAngr += 3;
  3601. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  3602. {
  3603. this.ownHeroReady = true;
  3604. }
  3605. }
  3606. }
  3607. }
  3608. if (c.name == "windzorn")
  3609. {
  3610. windfury = true;
  3611. }
  3612. if (c.name == "verhexung")
  3613. {
  3614. frogg = true;
  3615. }
  3616. if (c.name == "erdschock")
  3617. {
  3618. silence = true;
  3619. damage = 1;
  3620. }
  3621. if (c.name == "geistderahnen")
  3622. {
  3623. geistderahnen = true;
  3624. }
  3625. if (c.name == "lavaeruption")
  3626. {
  3627. damage = 5;
  3628. }
  3629. if (c.name == "heilungderahnen")
  3630. {
  3631. heal = 1000;
  3632. spott = true;
  3633. }
  3634. //hexenmeister ##########################################
  3635. if (c.name == "opferpakt")
  3636. {
  3637. destroy = true;
  3638. this.attackOrHealHero(getSpellHeal(5), true); // heal own hero
  3639. }
  3640. if (c.name == "seelenfeuer")
  3641. {
  3642. damage = 4;
  3643. this.owncarddraw--;
  3644. this.owncards.RemoveRange(0, Math.Min(1, this.owncards.Count));
  3645. }
  3646. if (c.name == "ueberwaeltigendemacht")
  3647. {
  3648. //only to own mininos
  3649. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_316e");
  3650. e.creator = c.entityID;
  3651. e.controllerOfCreator = this.ownController;
  3652. addEffectToMinionNoDoubles(m, e, true);
  3653. }
  3654. if (c.name == "verderbnis")
  3655. {
  3656. //only to enemy mininos
  3657. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_063e");
  3658. e.creator = c.entityID;
  3659. e.controllerOfCreator = this.ownController;
  3660. addEffectToMinionNoDoubles(m, e, false);
  3661. }
  3662. if (c.name == "weltlicheaengste")
  3663. {
  3664. damage = 1;
  3665. if (getSpellDamageDamage(1) >= m.Hp && !m.divineshild && !m.immune)
  3666. {
  3667. this.owncarddraw++;
  3668. this.drawACard("");
  3669. }
  3670. }
  3671. if (c.name == "blutsauger")
  3672. {
  3673. damage = 2;
  3674. attackOrHealHero(2, true);
  3675. }
  3676. if (c.name == "schattenblitz")
  3677. {
  3678. damage = 4;
  3679. }
  3680. if (c.name == "schattenflamme")
  3681. {
  3682. int damage1 = getSpellDamageDamage(m.Angr);
  3683. List<Minion> temp = new List<Minion>(this.enemyMinions);
  3684. foreach (Minion mnn in temp)
  3685. {
  3686. minionGetDamagedOrHealed(mnn, damage1, 0, false);
  3687. }
  3688. //destroy own mininon
  3689. destroy = true;
  3690. }
  3691. if (c.name == "daemonenfeuer")
  3692. {
  3693. if (m.card.race == 15 && own)
  3694. {
  3695. attackbuff = 2;
  3696. hpbuff = 2;
  3697. }
  3698. else
  3699. {
  3700. damage = 2;
  3701. }
  3702. }
  3703. if (c.name == "omenderverdammnis")
  3704. {
  3705. damage = 2;
  3706. if (getSpellDamageDamage(2) >= m.Hp && !m.divineshild && !m.immune)
  3707. {
  3708. int posi = this.ownMinions.Count - 1;
  3709. CardDB.Card kid = CardDB.Instance.getCardData("blutwichtel");
  3710. callKid(kid, posi, true);
  3711. }
  3712. }
  3713. if (c.name == "seeleentziehen")
  3714. {
  3715. destroy = true;
  3716. attackOrHealHero(3, true);
  3717. }
  3718. //druid #######################################################################
  3719. if (c.name == "mondfeuer" && c.CardID == "CS2_008")// nicht zu verwechseln mit cenarius choice nummer 1
  3720. {
  3721. damage = 1;
  3722. }
  3723. if (c.name == "malderwildnis")
  3724. {
  3725. spott = true;
  3726. attackbuff = 2;
  3727. hpbuff = 2;
  3728. }
  3729. if (c.name == "heilendeberuehrung")
  3730. {
  3731. heal = 8;
  3732. }
  3733. if (c.name == "sternenfeuer")
  3734. {
  3735. damage = 5;
  3736. this.owncarddraw++;
  3737. this.drawACard("");
  3738. }
  3739. if (c.name == "kreislaufdernatur")
  3740. {
  3741. destroy = true;
  3742. this.enemycarddraw += 2;
  3743. }
  3744. if (c.name == "unbaendigkeit")
  3745. {
  3746. damage = this.ownheroAngr;
  3747. }
  3748. if (c.name == "prankenhieb")
  3749. {
  3750. damage = 4;
  3751. // all others get 1 spelldamage
  3752. int damage1 = getSpellDamageDamage(1);
  3753. if (target != 200)
  3754. {
  3755. attackOrHealHero(damage1, false);
  3756. }
  3757. List<Minion> temp = new List<Minion>(this.enemyMinions);
  3758. foreach (Minion mnn in temp)
  3759. {
  3760. if (mnn.id + 10 != target)
  3761. {
  3762. minionGetDamagedOrHealed(m, damage1, 0, false);
  3763. }
  3764. }
  3765. }
  3766. //druid choices##################################################################################
  3767. if (c.name == "zorn")
  3768. {
  3769. if (choice == 1)
  3770. {
  3771. damage = 3;
  3772. }
  3773. if (choice == 2)
  3774. {
  3775. damage = 1;
  3776. this.owncarddraw++;
  3777. this.drawACard("");
  3778. }
  3779. }
  3780. if (c.name == "maldernatur")
  3781. {
  3782. if (choice == 1)
  3783. {
  3784. attackbuff = 4;
  3785. }
  3786. if (choice == 2)
  3787. {
  3788. spott = true;
  3789. hpbuff = 4;
  3790. }
  3791. }
  3792. if (c.name == "sternenregen")
  3793. {
  3794. if (choice == 1)
  3795. {
  3796. damage = 5;
  3797. }
  3798. }
  3799. //special cards#########################################################################################
  3800. if (c.name == "alptraum")
  3801. {
  3802. //only to own mininos
  3803. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_316e");
  3804. e.creator = c.entityID;
  3805. e.controllerOfCreator = this.ownController;
  3806. addEffectToMinionNoDoubles(m, e, true);
  3807. }
  3808. if (c.name == "traum")
  3809. {
  3810. backtohand = true;
  3811. }
  3812. if (c.name == "banane")
  3813. {
  3814. attackbuff = 1;
  3815. hpbuff = 1;
  3816. }
  3817. if (c.name == "fasswurf")
  3818. {
  3819. damage = 2;
  3820. }
  3821. if (c.CardID == "PRO_001b")// i am murloc
  3822. {
  3823. damage = 4;
  3824. this.owncarddraw++;
  3825. this.drawACard("");
  3826. } if (c.name == "derwillemuklas")
  3827. {
  3828. heal = 6 ;
  3829. }
  3830. //make effect on target
  3831. //ownminion
  3832. if (damage >= 1) damage = getSpellDamageDamage(damage);
  3833. if (adjacentDamage >= 1) adjacentDamage = getSpellDamageDamage(adjacentDamage);
  3834. if (heal >= 1 && heal < 1000) heal = getSpellHeal(heal);
  3835. if (target < 10)
  3836. {
  3837. if (silence) minionGetSilenced(m, true);
  3838. minionGetBuffed(m, attackbuff, hpbuff, true);
  3839. minionGetDamagedOrHealed(m, damage, heal, true);
  3840. if (spott) m.taunt = true;
  3841. if (charge) minionGetCharge(m);
  3842. if (windfury) minionGetWindfurry(m);
  3843. if (divineshild) m.divineshild = true;
  3844. if (destroy) minionGetDestroyed(m, true);
  3845. if (frozen) m.frozen = true;
  3846. if (stealth) m.stealth = true;
  3847. if (backtohand) minionReturnToHand(m, true);
  3848. if (immune) m.immune = true;
  3849. if (adjacentDamage >= 1)
  3850. {
  3851. foreach (Minion mnn in this.ownMinions)
  3852. {
  3853. if (mnn.id == target + 1 || mnn.id == target - 1)
  3854. {
  3855. minionGetDamagedOrHealed(m, adjacentDamage, 0, own);
  3856. if (frozen) mnn.frozen = true;
  3857. }
  3858. }
  3859. }
  3860. if (sheep) minionTransform(m, CardDB.Instance.getCardDataFromID("CS2_tk1"), own);
  3861. if (frogg) minionTransform(m, CardDB.Instance.getCardDataFromID("hexfrog"), own);
  3862. if (setHPtoONE)
  3863. {
  3864. m.Hp = 1; m.maxHp = 1;
  3865. }
  3866. if (geistderahnen)
  3867. {
  3868. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_038e");
  3869. e.creator = c.entityID;
  3870. e.controllerOfCreator = this.ownController;
  3871. addEffectToMinionNoDoubles(m, e, true);
  3872. }
  3873. }
  3874. //enemyminion
  3875. if (target >= 10 && target < 20)
  3876. {
  3877. if (silence) minionGetSilenced(m, false);
  3878. minionGetBuffed(m, attackbuff, hpbuff, false);
  3879. minionGetDamagedOrHealed(m, damage, heal, false);
  3880. if (spott) m.taunt = true;
  3881. if (charge) minionGetCharge(m);
  3882. if (windfury) minionGetWindfurry(m);
  3883. if (divineshild) m.divineshild = true;
  3884. if (destroy) minionGetDestroyed(m, false);
  3885. if (frozen) m.frozen = true;
  3886. if (stealth) m.stealth = true;
  3887. if (backtohand) minionReturnToHand(m, false);
  3888. if (immune) m.immune = true;
  3889. if (adjacentDamage >= 1)
  3890. {
  3891. foreach (Minion mnn in this.enemyMinions)
  3892. {
  3893. if (mnn.id + 10 == target + 1 || mnn.id + 10 == target - 1)
  3894. {
  3895. minionGetDamagedOrHealed(m, adjacentDamage, 0, own);
  3896. if (frozen) mnn.frozen = true;
  3897. }
  3898. }
  3899. }
  3900. if (sheep) minionTransform(m, CardDB.Instance.getCardDataFromID("CS2_tk1"), own);
  3901. if (frogg) minionTransform(m, CardDB.Instance.getCardDataFromID("hexfrog"), own);
  3902. if (setHPtoONE)
  3903. {
  3904. m.Hp = 1; m.maxHp = 1;
  3905. }
  3906. if (geistderahnen)
  3907. {
  3908. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_038e");
  3909. e.creator = c.entityID;
  3910. e.controllerOfCreator = this.ownController;
  3911. addEffectToMinionNoDoubles(m, e, false);
  3912. }
  3913. }
  3914. if (target == 100)
  3915. {
  3916. if (frozen) this.ownHeroFrozen = true;
  3917. if (damage >= 1) attackOrHealHero(damage, true);
  3918. if (heal >= 1) attackOrHealHero(-heal, true);
  3919. }
  3920. if (target == 200)
  3921. {
  3922. if (frozen) this.enemyHeroFrozen = true;
  3923. if (damage >= 1) attackOrHealHero(damage, false);
  3924. if (heal >= 1) attackOrHealHero(-heal, false);
  3925. }
  3926. }
  3927. private void playCardWithoutTarget(CardDB.Card c, int choice)
  3928. {
  3929. //todo faehrtenlesen!
  3930. //play card without target
  3931. if (c.name == "diemuenze")
  3932. {
  3933. this.mana++;
  3934. }
  3935. //hunter#########################################################################
  3936. if (c.name == "mehrfachschuss" && this.enemyMinions.Count >= 2)
  3937. {
  3938. List<Minion> temp = new List<Minion>();
  3939. int damage = getSpellDamageDamage(3);
  3940. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  3941. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));//damage the strongest
  3942. temp.AddRange(Helpfunctions.TakeList(temp2, 2));
  3943. foreach (Minion enemy in temp)
  3944. {
  3945. minionGetDamagedOrHealed(enemy, damage, 0, false);
  3946. }
  3947. }
  3948. if (c.name == "tierbegleiter")
  3949. {
  3950. CardDB.Card c2 = CardDB.Instance.getCardData("misha");
  3951. int placeoffather = this.ownMinions.Count - 1;
  3952. callKid(c2, placeoffather, true);
  3953. }
  3954. if (c.name == "leuchtfeuer")
  3955. {
  3956. foreach (Minion m in this.ownMinions)
  3957. {
  3958. m.stealth = false;
  3959. }
  3960. foreach (Minion m in this.enemyMinions)
  3961. {
  3962. m.stealth = false;
  3963. }
  3964. this.owncarddraw++;
  3965. this.drawACard("");
  3966. this.enemySecretCount = 0;
  3967. }
  3968. if (c.name == "lasstdiehundelos")
  3969. {
  3970. int anz = this.enemyMinions.Count;
  3971. int posi = this.ownMinions.Count - 1;
  3972. CardDB.Card kid = CardDB.Instance.getCardData("jagdhund");
  3973. for (int i = 0; i < anz; i++)
  3974. {
  3975. callKid(kid, posi, true);
  3976. }
  3977. }
  3978. if (c.name == "toedlicherschuss" && this.enemyMinions.Count >= 1)
  3979. {
  3980. List<Minion> temp = new List<Minion>();
  3981. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  3982. temp2.Sort((a, b) => a.Hp.CompareTo(b.Hp));
  3983. temp.AddRange(Helpfunctions.TakeList(temp2, 1));
  3984. foreach (Minion enemy in temp)
  3985. {
  3986. minionGetDestroyed(enemy, false);
  3987. }
  3988. }
  3989. //warrior#########################################################################
  3990. if (c.name == "befehlsruf")
  3991. {
  3992. List<Minion> temp = new List<Minion>(this.ownMinions);
  3993. Enchantment e1 = CardDB.getEnchantmentFromCardID("NEW1_036e");
  3994. e1.creator = c.entityID;
  3995. e1.controllerOfCreator = this.ownController;
  3996. Enchantment e2 = CardDB.getEnchantmentFromCardID("NEW1_036e2");
  3997. e2.creator = c.entityID;
  3998. e2.controllerOfCreator = this.ownController;
  3999. foreach (Minion mnn in temp)
  4000. {//cantLowerHPbelowONE
  4001. addEffectToMinionNoDoubles(mnn, e1, true);
  4002. addEffectToMinionNoDoubles(mnn, e2, true);
  4003. mnn.cantLowerHPbelowONE = true;
  4004. }
  4005. }
  4006. if (c.name == "kampfeswut")
  4007. {
  4008. foreach (Minion mnn in this.ownMinions)
  4009. {
  4010. if (mnn.wounded)
  4011. {
  4012. this.owncarddraw++;
  4013. this.drawACard("");
  4014. }
  4015. }
  4016. }
  4017. if (c.name == "scharmuetzel")
  4018. {
  4019. List<Minion> temp = new List<Minion>(this.ownMinions);
  4020. foreach (Minion mnn in temp)
  4021. {
  4022. minionGetDestroyed(mnn, true);
  4023. }
  4024. temp.Clear();
  4025. temp.AddRange(this.enemyMinions);
  4026. foreach (Minion mnn in temp)
  4027. {
  4028. minionGetDestroyed(mnn,false);
  4029. }
  4030. }
  4031. if (c.name == "spalten" && this.enemyMinions.Count >= 2)
  4032. {
  4033. List<Minion> temp = new List<Minion>();
  4034. int damage = getSpellDamageDamage(2);
  4035. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  4036. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  4037. temp.AddRange(Helpfunctions.TakeList(temp2, 2));
  4038. foreach (Minion enemy in temp)
  4039. {
  4040. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4041. }
  4042. }
  4043. if (c.name == "aufwertung" )
  4044. {
  4045. if (this.ownWeaponName != "")
  4046. {
  4047. this.ownWeaponAttack++;
  4048. this.ownheroAngr++;
  4049. this.ownWeaponDurability++;
  4050. }
  4051. else
  4052. {
  4053. CardDB.Card wcard = CardDB.Instance.getCardData("schwereaxt");
  4054. this.equipWeapon(wcard);
  4055. }
  4056. }
  4057. if (c.name == "wirbelwind")
  4058. {
  4059. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4060. int damage = getSpellDamageDamage(1);
  4061. foreach (Minion enemy in temp)
  4062. {
  4063. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4064. }
  4065. temp.Clear();
  4066. temp = new List<Minion>(this.ownMinions);
  4067. foreach (Minion enemy in temp)
  4068. {
  4069. minionGetDamagedOrHealed(enemy, damage, 0, true);
  4070. }
  4071. }
  4072. if (c.name == "heldenhafterstoss")
  4073. {
  4074. this.ownheroAngr = this.ownheroAngr + 4;
  4075. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  4076. {
  4077. this.ownHeroReady = true;
  4078. }
  4079. }
  4080. if (c.name == "schildblock")
  4081. {
  4082. this.ownHeroDefence = this.ownHeroDefence + 5;
  4083. this.owncarddraw++;
  4084. drawACard("unknown");
  4085. }
  4086. //mage#########################################################################################
  4087. if (c.name == "blizzard")
  4088. {
  4089. int damage = getSpellDamageDamage(2);
  4090. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4091. int maxHp = 0;
  4092. foreach (Minion enemy in temp)
  4093. {
  4094. enemy.frozen = true;
  4095. if (maxHp < enemy.Hp) maxHp = enemy.Hp;
  4096. minionGetDamagedOrHealed(enemy, damage, 0, false, true);
  4097. }
  4098. this.lostDamage += Math.Max(0, damage - maxHp);
  4099. }
  4100. if (c.name == "arkanegeschosse")
  4101. {
  4102. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4103. temp.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  4104. int damage = 1;
  4105. int ammount = getSpellDamageDamage(3);
  4106. int i = 0;
  4107. int hp = 0;
  4108. foreach (Minion enemy in temp)
  4109. {
  4110. if (enemy.Hp >= 2)
  4111. {
  4112. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4113. i++;
  4114. hp += enemy.Hp;
  4115. if (i == ammount) break;
  4116. }
  4117. }
  4118. if (i < ammount) attackOrHealHero(ammount - i, false);
  4119. }
  4120. if (c.name == "arkaneintelligenz")
  4121. {
  4122. this.owncarddraw++;
  4123. this.drawACard("");
  4124. this.drawACard("");
  4125. }
  4126. if (c.name == "spiegelbild")
  4127. {
  4128. int posi = this.ownMinions.Count - 1;
  4129. CardDB.Card kid = CardDB.Instance.getCardData("spiegelbildminion");
  4130. callKid(kid, posi, true);
  4131. callKid(kid, posi, true);
  4132. }
  4133. if (c.name == "arkaneexplosion")
  4134. {
  4135. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4136. int damage = getSpellDamageDamage(1);
  4137. foreach (Minion enemy in temp)
  4138. {
  4139. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4140. }
  4141. }
  4142. if (c.name == "frostnova")
  4143. {
  4144. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4145. foreach (Minion enemy in temp)
  4146. {
  4147. enemy.frozen = true;
  4148. }
  4149. }
  4150. if (c.name == "flammenstoss")
  4151. {
  4152. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4153. int damage = getSpellDamageDamage(4);
  4154. int maxHp = 0;
  4155. foreach (Minion enemy in temp)
  4156. {
  4157. if (maxHp < enemy.Hp) maxHp = enemy.Hp;
  4158. minionGetDamagedOrHealed(enemy, damage, 0, false, true);
  4159. }
  4160. this.lostDamage += Math.Max(0, damage - maxHp);
  4161. }
  4162. //pala#################################################################
  4163. if (c.name == "weihe")
  4164. {
  4165. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4166. int damage = getSpellDamageDamage(2);
  4167. foreach (Minion enemy in temp)
  4168. {
  4169. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4170. }
  4171. attackOrHealHero(damage, false);
  4172. }
  4173. if (c.name == "gleichheit")
  4174. {
  4175. foreach (Minion m in this.ownMinions)
  4176. {
  4177. m.Hp = 1;
  4178. m.maxHp = 1;
  4179. }
  4180. foreach (Minion m in this.enemyMinions)
  4181. {
  4182. m.Hp = 1;
  4183. m.maxHp = 1;
  4184. }
  4185. }
  4186. if (c.name == "goettlichegunst")
  4187. {
  4188. int enemcardsanz = this.enemyAnzCards + this.enemycarddraw;
  4189. int diff = enemcardsanz - this.owncards.Count;
  4190. if (diff >= 1)
  4191. {
  4192. for (int i = 0; i < diff; i++)
  4193. {
  4194. this.owncarddraw++;
  4195. this.drawACard("");
  4196. }
  4197. }
  4198. }
  4199. if (c.name == "zornigevergeltung")
  4200. {
  4201. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4202. int damage = 1;
  4203. int i = 0;
  4204. if (temp.Count >= 1)
  4205. {
  4206. foreach (Minion enemy in temp)
  4207. {
  4208. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4209. i++;
  4210. if (i == 8) break;
  4211. }
  4212. }
  4213. else
  4214. {
  4215. damage = getSpellDamageDamage(8);
  4216. attackOrHealHero(damage, false);
  4217. }
  4218. }
  4219. //priest ####################################################
  4220. if (c.name == "kreisderheilung")
  4221. {
  4222. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4223. int heal = getSpellHeal(4);
  4224. foreach (Minion enemy in temp)
  4225. {
  4226. minionGetDamagedOrHealed(enemy, 0, heal, false);
  4227. }
  4228. temp.Clear();
  4229. temp.AddRange(this.ownMinions);
  4230. foreach (Minion enemy in temp)
  4231. {
  4232. minionGetDamagedOrHealed(enemy, 0, heal, true);
  4233. }
  4234. }
  4235. if (c.name == "gedankenraub")
  4236. {
  4237. this.owncarddraw++;
  4238. this.drawACard("enemycard");
  4239. this.owncarddraw++;
  4240. this.drawACard("enemycard");
  4241. }
  4242. if (c.name == "gedankensicht")
  4243. {
  4244. if (this.enemyAnzCards >= 1)
  4245. {
  4246. this.owncarddraw++;
  4247. this.drawACard("enemycard");
  4248. }
  4249. }
  4250. if (c.name == "schattengestalt")
  4251. {
  4252. if (this.ownHeroAblility.CardID == "CS1h_001") // lesser heal becomes mind spike
  4253. {
  4254. this.ownHeroAblility = CardDB.Instance.getCardDataFromID("EX1_625t");
  4255. }
  4256. else
  4257. {
  4258. this.ownHeroAblility = CardDB.Instance.getCardDataFromID("EX1_625t2"); // mindspike becomes mind shatter
  4259. }
  4260. }
  4261. if (c.name == "gedankenspiele")
  4262. {
  4263. CardDB.Card copymin = CardDB.Instance.getCardDataFromID("CS2_152"); //we draw a knappe :D (worst case)
  4264. callKid(copymin, this.ownMinions.Count - 1, true);
  4265. }
  4266. if (c.name == "massenbannung")
  4267. {
  4268. foreach (Minion m in this.enemyMinions)
  4269. {
  4270. minionGetSilenced(m, false);
  4271. }
  4272. }
  4273. if (c.name == "gedankenschlag")
  4274. {
  4275. int damage = getSpellDamageDamage(5);
  4276. attackOrHealHero(damage, false);
  4277. }
  4278. if (c.name == "kreisderheilung")
  4279. {
  4280. List<Minion> temp = new List<Minion>(this.ownMinions);
  4281. int heal = getSpellHeal(2);
  4282. int damage = getSpellDamageDamage(2);
  4283. foreach (Minion enemy in temp)
  4284. {
  4285. minionGetDamagedOrHealed(enemy, 0, heal, false);
  4286. }
  4287. attackOrHealHero(-heal, true);
  4288. temp.Clear();
  4289. temp.AddRange(this.enemyMinions);
  4290. foreach (Minion enemy in temp)
  4291. {
  4292. minionGetDamagedOrHealed(enemy, damage, 0, true);
  4293. }
  4294. attackOrHealHero(damage, true);
  4295. }
  4296. //rogue #################################################
  4297. if (c.name == "vorbereitung")
  4298. {
  4299. this.playedPreparation = true;
  4300. }
  4301. if (c.name == "klingenwirbel")
  4302. {
  4303. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4304. int damage = this.ownWeaponAttack;
  4305. foreach (Minion enemy in temp)
  4306. {
  4307. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4308. }
  4309. attackOrHealHero(damage, false);
  4310. //destroy own weapon
  4311. this.lowerWeaponDurability(1000, true);
  4312. }
  4313. if (c.name == "schaedelbruch")
  4314. {
  4315. int damage = getSpellDamageDamage(2);
  4316. attackOrHealHero(damage, false);
  4317. if (this.cardsPlayedThisTurn >= 1) this.owncarddraw++; // DONT DRAW A CARD WITH (drawAcard()) because we get this NEXT turn
  4318. }
  4319. if (c.name == "finstererstoss")
  4320. {
  4321. int damage = getSpellDamageDamage(3);
  4322. attackOrHealHero(damage, false);
  4323. }
  4324. if (c.name == "toedlichesgift")
  4325. {
  4326. if (this.ownWeaponName != "")
  4327. {
  4328. this.ownWeaponAttack += 2;
  4329. this.ownheroAngr += 2;
  4330. }
  4331. }
  4332. if (c.name == "dolchfaecher")
  4333. {
  4334. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4335. int damage = getSpellDamageDamage(1);
  4336. foreach (Minion enemy in temp)
  4337. {
  4338. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4339. }
  4340. }
  4341. if (c.name == "sprinten")
  4342. {
  4343. for (int i = 0; i < 4; i++)
  4344. {
  4345. this.owncarddraw++;
  4346. this.drawACard("");
  4347. }
  4348. }
  4349. if (c.name == "verschwinden")
  4350. {
  4351. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4352. int heal = getSpellHeal(4);
  4353. foreach (Minion enemy in temp)
  4354. {
  4355. minionReturnToHand(enemy, false);
  4356. }
  4357. temp.Clear();
  4358. temp.AddRange(this.ownMinions);
  4359. foreach (Minion enemy in temp)
  4360. {
  4361. minionReturnToHand(enemy, true);
  4362. }
  4363. }
  4364. //shaman #################################################
  4365. if (c.name == "gabelblitzschlag" && this.enemyMinions.Count >= 2)
  4366. {
  4367. List<Minion> temp = new List<Minion>();
  4368. int damage = getSpellDamageDamage(2);
  4369. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  4370. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  4371. temp.AddRange(Helpfunctions.TakeList(temp2, 2));
  4372. foreach (Minion enemy in temp)
  4373. {
  4374. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4375. }
  4376. }
  4377. if (c.name == "fernsicht")
  4378. {
  4379. this.owncarddraw++;
  4380. this.drawACard("");
  4381. }
  4382. if (c.name == "gewittersturm")
  4383. {
  4384. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4385. int damage = getSpellDamageDamage(2);
  4386. int maxHp = 0;
  4387. foreach (Minion enemy in temp)
  4388. {
  4389. if (maxHp < enemy.Hp) maxHp = enemy.Hp;
  4390. minionGetDamagedOrHealed(enemy, damage, 0, false, true);
  4391. }
  4392. this.lostDamage += Math.Max(0, damage - maxHp);
  4393. }
  4394. if (c.name == "wildgeist")
  4395. {
  4396. int posi = this.ownMinions.Count - 1;
  4397. CardDB.Card kid = CardDB.Instance.getCardData("geisterwolf");
  4398. callKid(kid, posi, true);
  4399. callKid(kid, posi, true);
  4400. }
  4401. if (c.name == "machtdertotems")
  4402. {
  4403. List<Minion> temp = new List<Minion>(this.ownMinions);
  4404. foreach (Minion m in temp)
  4405. {
  4406. if (m.card.race == 21) // if minion is a totem, buff it
  4407. {
  4408. minionGetBuffed(m, 0, 2, true);
  4409. }
  4410. }
  4411. }
  4412. if (c.name == "kampfrausch")
  4413. {
  4414. List<Minion> temp = new List<Minion>(this.ownMinions);
  4415. foreach (Minion m in temp)
  4416. {
  4417. Enchantment e = CardDB.getEnchantmentFromCardID("CS2_046e");
  4418. e.creator = this.ownController;
  4419. e.controllerOfCreator = this.ownController;
  4420. addEffectToMinionNoDoubles(m, e, true);
  4421. }
  4422. }
  4423. //hexenmeister #################################################
  4424. if (c.name == "daemonenwahrnehmen")
  4425. {
  4426. this.owncarddraw += 2;
  4427. this.drawACard("");
  4428. this.drawACard("");
  4429. }
  4430. if (c.name == "wirbelndernether")
  4431. {
  4432. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4433. foreach (Minion enemy in temp)
  4434. {
  4435. minionGetDestroyed(enemy, false);
  4436. }
  4437. temp.Clear();
  4438. temp.AddRange(this.ownMinions);
  4439. foreach (Minion enemy in temp)
  4440. {
  4441. minionGetDestroyed(enemy, true);
  4442. }
  4443. }
  4444. if (c.name == "hoellenfeuer")
  4445. {
  4446. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4447. int damage = getSpellDamageDamage(3);
  4448. foreach (Minion enemy in temp)
  4449. {
  4450. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4451. }
  4452. temp.Clear();
  4453. temp.AddRange(this.ownMinions);
  4454. foreach (Minion enemy in temp)
  4455. {
  4456. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4457. }
  4458. attackOrHealHero(damage, true);
  4459. attackOrHealHero(damage, false);
  4460. }
  4461. //druid #################################################
  4462. if (c.name == "seeledeswaldes")
  4463. {
  4464. List<Minion> temp = new List<Minion>(this.ownMinions);
  4465. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_158e");
  4466. e.creator = c.entityID;
  4467. e.controllerOfCreator = this.ownController;
  4468. foreach (Minion enemy in temp)
  4469. {
  4470. addEffectToMinionNoDoubles(enemy, e, true);
  4471. }
  4472. }
  4473. if (c.name == "anregen")
  4474. {
  4475. this.mana = Math.Min(this.mana + 2 ,10);
  4476. }
  4477. if (c.name == "biss")
  4478. {
  4479. this.ownheroAngr += 4;
  4480. this.ownHeroDefence += 4;
  4481. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  4482. {
  4483. this.ownHeroReady = true;
  4484. }
  4485. }
  4486. if (c.name == "klaue")
  4487. {
  4488. this.ownheroAngr += 2;
  4489. this.ownHeroDefence += 2;
  4490. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  4491. {
  4492. this.ownHeroReady = true;
  4493. }
  4494. }
  4495. if (c.name == "naturgewalt")
  4496. {
  4497. int posi = this.ownMinions.Count - 1;
  4498. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_tk9");//Treant
  4499. callKid(kid, posi, true);
  4500. callKid(kid, posi, true);
  4501. callKid(kid, posi, true);
  4502. }
  4503. if (c.name == "machtderwildnis")// macht der wildnis with summoning
  4504. {
  4505. if (choice == 1)
  4506. {
  4507. foreach (Minion m in this.ownMinions)
  4508. {
  4509. minionGetBuffed(m, 1, 1, true);
  4510. }
  4511. }
  4512. if (choice == 2)
  4513. {
  4514. int posi = this.ownMinions.Count - 1;
  4515. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_160t");//panther
  4516. callKid(kid, posi, true);
  4517. }
  4518. }
  4519. if (c.name == "sternenregen")
  4520. {
  4521. if (choice == 2)
  4522. {
  4523. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4524. int damage = getSpellDamageDamage(2);
  4525. foreach (Minion enemy in temp)
  4526. {
  4527. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4528. }
  4529. }
  4530. }
  4531. if (c.name == "pflege")
  4532. {
  4533. if (choice == 1)
  4534. {
  4535. if (this.ownMaxMana == 10)
  4536. {
  4537. this.owncarddraw++;
  4538. this.drawACard("ueberschuessigesmana");
  4539. }
  4540. else
  4541. {
  4542. this.ownMaxMana++;
  4543. this.mana++;
  4544. }
  4545. if (this.ownMaxMana == 10)
  4546. {
  4547. this.owncarddraw++;
  4548. this.drawACard("ueberschuessigesmana");
  4549. }
  4550. else
  4551. {
  4552. this.ownMaxMana++;
  4553. this.mana++;
  4554. }
  4555. }
  4556. if (choice == 2)
  4557. {
  4558. this.owncarddraw+=3;
  4559. this.drawACard("");
  4560. this.drawACard("");
  4561. this.drawACard("");
  4562. }
  4563. }
  4564. //special cards#######################
  4565. if (c.CardID == "PRO_001a")// i am murloc
  4566. {
  4567. int posi = this.ownMinions.Count - 1;
  4568. CardDB.Card kid = CardDB.Instance.getCardDataFromID("PRO_001at");//panther
  4569. callKid(kid, posi, true);
  4570. callKid(kid, posi, true);
  4571. callKid(kid, posi, true);
  4572. }
  4573. if (c.CardID == "PRO_001c")// i am murloc
  4574. {
  4575. int posi = this.ownMinions.Count - 1;
  4576. CardDB.Card kid = CardDB.Instance.getCardDataFromID("EX1_021");//scharfseher
  4577. callKid(kid, posi, true);
  4578. }
  4579. if (c.name == "wildwuchs")
  4580. {
  4581. if (this.ownMaxMana == 10)
  4582. {
  4583. this.owncarddraw++;
  4584. this.drawACard("ueberschuessigesmana");
  4585. }
  4586. else
  4587. {
  4588. this.ownMaxMana++;
  4589. }
  4590. }
  4591. if (c.name == "ueberschuessigesmana")
  4592. {
  4593. this.owncarddraw++;
  4594. this.drawACard("");
  4595. }
  4596. if (c.name == "yseraerwacht")
  4597. {
  4598. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4599. int damage = getSpellDamageDamage(5);
  4600. foreach (Minion enemy in temp)
  4601. {
  4602. if (enemy.name != "ysera")// dont attack ysera
  4603. {
  4604. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4605. }
  4606. }
  4607. temp.Clear();
  4608. temp.AddRange(this.ownMinions);
  4609. foreach (Minion enemy in temp)
  4610. {
  4611. if (enemy.name != "ysera")//dont attack ysera
  4612. {
  4613. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4614. }
  4615. }
  4616. attackOrHealHero(damage, true);
  4617. attackOrHealHero(damage, false);
  4618. }
  4619. if (c.name == "stampfen" )
  4620. {
  4621. List<Minion> temp = new List<Minion>(this.enemyMinions);
  4622. int damage = getSpellDamageDamage(2);
  4623. foreach (Minion enemy in temp)
  4624. {
  4625. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4626. }
  4627. }
  4628. }
  4629. private void drawACard(string ss)
  4630. {
  4631. string s = ss;
  4632. if (s == "") s = "unknown";
  4633. if (s == "enemycard") s = "unknown"; // NO PENALITY FOR DRAWING TO MUCH CARDS
  4634. if (this.owncards.Count >= 10) return; // cant hold more than 10 cards
  4635. if (s == "unknown")
  4636. {
  4637. CardDB.Card plchldr = new CardDB.Card();
  4638. plchldr.name = "unknown";
  4639. plchldr.cost = 1000;
  4640. Handmanager.Handcard hc = new Handmanager.Handcard();
  4641. hc.card = plchldr;
  4642. hc.position = this.owncards.Count + 1;
  4643. this.owncards.Add(hc);
  4644. }
  4645. if (s == "feuerball")
  4646. {
  4647. CardDB.Card c = CardDB.Instance.getCardData("feuerball");
  4648. Handmanager.Handcard hc = new Handmanager.Handcard();
  4649. hc.card = c;
  4650. hc.position = this.owncards.Count + 1;
  4651. this.owncards.Add(hc);
  4652. }
  4653. }
  4654. private void triggerPlayedAMinion(CardDB.Card c, bool own)
  4655. {
  4656. if (own) // effects only for OWN minons
  4657. {
  4658. foreach (Minion m in this.ownMinions)
  4659. {
  4660. if (m.silenced) continue;
  4661. if (m.name == "messerjongleur")
  4662. {
  4663. if (this.enemyMinions.Count >= 1)
  4664. {
  4665. List<Minion> temp = new List<Minion>();
  4666. int damage = 1;
  4667. List<Minion> temp2 = new List<Minion>(this.enemyMinions);
  4668. temp2.Sort((a, b) => -a.Hp.CompareTo(b.Hp));
  4669. temp.AddRange(Helpfunctions.TakeList(temp2, 1));
  4670. foreach (Minion enemy in temp)
  4671. {
  4672. minionGetDamagedOrHealed(enemy, damage, 0, false);
  4673. }
  4674. }
  4675. else
  4676. {
  4677. this.attackOrHealHero(1, false);
  4678. }
  4679. }
  4680. if (own && m.name == "verhungernderbussard" && (TAG_RACE)c.race == TAG_RACE.PET)
  4681. {
  4682. this.owncarddraw++;
  4683. this.drawACard("");
  4684. }
  4685. }
  4686. }
  4687. //effects for ALL minons
  4688. foreach (Minion m in this.ownMinions)
  4689. {
  4690. if (m.silenced) continue;
  4691. if (m.name == "murlocgezeitenrufer" && c.race == 14)
  4692. {
  4693. minionGetBuffed(m, 1, 0, true);
  4694. }
  4695. if (m.name == "truebaugederalte" && c.race == 14)
  4696. {
  4697. minionGetBuffed(m, 1, 0, true);
  4698. }
  4699. }
  4700. foreach (Minion m in this.enemyMinions)
  4701. {
  4702. if (m.silenced) continue;
  4703. //truebaugederalte
  4704. if (m.name == "murlocgezeitenrufer" && c.race == 14)
  4705. {
  4706. minionGetBuffed(m, 1, 0, false);
  4707. }
  4708. if (m.name == "truebaugederalte" && c.race == 14)
  4709. {
  4710. minionGetBuffed(m, 1, 0, false);
  4711. }
  4712. }
  4713. }
  4714. private void triggerPlayedASpell(CardDB.Card c)
  4715. {
  4716. bool wilderpyro = false;
  4717. foreach (Minion m in this.ownMinions)
  4718. {
  4719. if (m.silenced) continue;
  4720. if (m.name == "manawyrm")
  4721. {
  4722. minionGetBuffed(m, 1, 0, true);
  4723. }
  4724. if (m.name == "manasuechtige")
  4725. {
  4726. Enchantment e = CardDB.getEnchantmentFromCardID("EX1_055o");
  4727. e.creator = m.entitiyID;
  4728. e.controllerOfCreator = this.ownController;
  4729. addEffectToMinionNoDoubles(m, e, true);
  4730. }
  4731. if (m.name == "geheimnisbewahrerin" && c.Secret)
  4732. {
  4733. minionGetBuffed(m, 1, 1, true);
  4734. }
  4735. if (m.name == "erzmagierantonidas")
  4736. {
  4737. drawACard("feuerball");
  4738. }
  4739. if (m.name == "violetteausbilderin")
  4740. {
  4741. CardDB.Card d = CardDB.Instance.getCardData("violetterlehrling");
  4742. callKid(d, m.id, true);
  4743. }
  4744. if (m.name == "goblinauktionator")
  4745. {
  4746. this.owncarddraw++;
  4747. drawACard("unknown");
  4748. }
  4749. if (m.name == "wilderpyromant")
  4750. {
  4751. wilderpyro = true;
  4752. }
  4753. }
  4754. foreach (Minion m in this.enemyMinions)
  4755. {
  4756. if (m.name == "geheimnisbewahrerin" && c.Secret)
  4757. {
  4758. minionGetBuffed(m, 1, 1, true);
  4759. }
  4760. }
  4761. if (wilderpyro)
  4762. {
  4763. List<Minion> temp = new List<Minion>(this.ownMinions);
  4764. foreach (Minion m in temp)
  4765. {
  4766. if (m.silenced) continue;
  4767. if (m.name == "wilderpyromant")
  4768. {
  4769. List<Minion> temp2 = new List<Minion>(this.ownMinions);
  4770. foreach (Minion mnn in temp2)
  4771. {
  4772. minionGetDamagedOrHealed(mnn, 1, 0, true);
  4773. }
  4774. temp2.Clear();
  4775. temp2.AddRange(this.enemyMinions);
  4776. foreach (Minion mnn in temp2)
  4777. {
  4778. minionGetDamagedOrHealed(mnn, 1, 0, false);
  4779. }
  4780. }
  4781. }
  4782. }
  4783. }
  4784. public void removeCard(int cardpos)
  4785. {
  4786. this.owncards.RemoveAll(x => x.position == (cardpos + 1));
  4787. foreach (Handmanager.Handcard hc in this.owncards)
  4788. {
  4789. if (hc.position > cardpos + 1)
  4790. {
  4791. hc.position--;
  4792. }
  4793. }
  4794. }
  4795. public void playCard(CardDB.Card c, int cardpos, int cardEntity, int target, int targetEntity, int choice, int placepos)
  4796. {
  4797. // lock at frostnova (click) / frostblitz (no click)
  4798. this.mana = this.mana - c.getManaCost(this);
  4799. if (c.Secret)
  4800. {
  4801. this.ownSecretsIDList.Add(c.CardID);
  4802. this.playedmagierinderkirintor = false;
  4803. }
  4804. if (c.type == CardDB.cardtype.SPELL) this.playedPreparation = false;
  4805. if (logging) help.logg("play crd" + c.name + " " + cardEntity + " " + c.getManaCost(this) + " trgt " + target);
  4806. if (c.type == CardDB.cardtype.MOB)
  4807. {
  4808. Action b = this.placeAmobSomewhere(c, cardpos, target, choice,placepos);
  4809. b.druidchoice = choice;
  4810. b.owntarget = placepos;
  4811. b.enemyEntitiy = targetEntity;
  4812. b.cardEntitiy = cardEntity;
  4813. this.playactions.Add(b);
  4814. this.mobsplayedThisTurn++;
  4815. if (c.name == "magierinderkirintor") this.playedmagierinderkirintor = true;
  4816. }
  4817. else
  4818. {
  4819. Action a = new Action();
  4820. a.cardplay = true;
  4821. a.card = c;
  4822. a.cardEntitiy = cardEntity;
  4823. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  4824. a.owntarget = 0;
  4825. if (target >= 0)
  4826. {
  4827. a.owntarget = -1;
  4828. }
  4829. a.enemytarget = target;
  4830. a.enemyEntitiy = targetEntity;
  4831. a.druidchoice = choice;
  4832. if (target == -1)
  4833. {
  4834. //card with no target
  4835. if (c.type == CardDB.cardtype.WEAPON)
  4836. {
  4837. equipWeapon(c);
  4838. }
  4839. playCardWithoutTarget(c, choice);
  4840. }
  4841. else //before : if(target >=0 && target < 20)
  4842. {
  4843. if (c.type == CardDB.cardtype.WEAPON)
  4844. {
  4845. equipWeapon(c);
  4846. }
  4847. playCardWithTarget(c, target, choice);
  4848. }
  4849. this.playactions.Add(a);
  4850. if (c.type == CardDB.cardtype.SPELL)
  4851. {
  4852. this.triggerPlayedASpell(c);
  4853. }
  4854. }
  4855. triggerACardGetPlayed(c);
  4856. removeCard(cardpos);// remove card
  4857. this.ueberladung += c.recallValue;
  4858. this.cardsPlayedThisTurn++;
  4859. }
  4860. private void triggerACardGetPlayed(CardDB.Card c)
  4861. {
  4862. List<Minion> temp = new List<Minion>(this.ownMinions);
  4863. foreach (Minion mnn in temp)
  4864. {
  4865. if (mnn.silenced) continue;
  4866. if (mnn.name == "illidansturmgrimm")
  4867. {
  4868. CardDB.Card d = CardDB.Instance.getCardData("flammevonazzinoth");
  4869. callKid(d, mnn.id, true);
  4870. }
  4871. if (mnn.name == "rastloserabenteurer")
  4872. {
  4873. minionGetBuffed(mnn, 1, 1, true);
  4874. }
  4875. if (mnn.name == "entfesselterelementar" && c.recallValue >= 1)
  4876. {
  4877. minionGetBuffed(mnn, 1, 1, true);
  4878. }
  4879. }
  4880. }
  4881. public void attackWithWeapon(int target, int targetEntity)
  4882. {
  4883. //this.ownHeroAttackedInRound = true;
  4884. this.ownHeroNumAttackThisTurn++;
  4885. if ((this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 2) || (!this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1))
  4886. {
  4887. this.ownHeroReady = false;
  4888. }
  4889. Action a = new Action();
  4890. a.heroattack = true;
  4891. a.enemytarget = target;
  4892. a.enemyEntitiy = targetEntity;
  4893. a.owntarget = 100;
  4894. a.ownEntitiy = this.ownHeroEntity;
  4895. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  4896. this.playactions.Add(a);
  4897. if (this.ownWeaponName == "echtsilberchampion")
  4898. {
  4899. this.attackOrHealHero(-2, true);
  4900. }
  4901. if (logging) help.logg("attck with weapon " +a.owntarget + " "+ a.ownEntitiy + " trgt: " + a.enemytarget + " " +a.enemyEntitiy );
  4902. if (target == 200)
  4903. {
  4904. attackOrHealHero(this.ownheroAngr, false);
  4905. return;
  4906. }
  4907. Minion enemy = this.enemyMinions[target - 10];
  4908. minionGetDamagedOrHealed(enemy, this.ownheroAngr, 0, false);
  4909. if (!this.heroImmuneWhileAttacking)
  4910. {
  4911. attackOrHealHero(enemy.Angr, true);
  4912. if (enemy.name == "wasserelementar")
  4913. {
  4914. this.ownHeroFrozen = true;
  4915. }
  4916. }
  4917. //todo
  4918. if (ownWeaponName == "blutschrei")
  4919. {
  4920. this.ownWeaponAttack--;
  4921. this.ownheroAngr--;
  4922. }
  4923. else
  4924. {
  4925. this.lowerWeaponDurability(1, true);
  4926. }
  4927. }
  4928. public void activateAbility(CardDB.Card c, int target, int targetEntity)
  4929. {
  4930. string heroname = this.ownHeroName;
  4931. this.ownAbilityReady = false;
  4932. this.mana -= 2;
  4933. Action a = new Action();
  4934. a.useability = true;
  4935. a.card = c;
  4936. a.enemytarget = target;
  4937. a.enemyEntitiy = targetEntity;
  4938. a.numEnemysBeforePlayed = this.enemyMinions.Count;
  4939. this.playactions.Add(a);
  4940. if (logging) help.logg("play ability on target " + target);
  4941. if (heroname == "mage")
  4942. {
  4943. int damage = 1;
  4944. if (target == 100)
  4945. {
  4946. attackOrHealHero(damage, true);
  4947. }
  4948. else
  4949. {
  4950. if (target == 200)
  4951. {
  4952. attackOrHealHero(damage, false);
  4953. }
  4954. else
  4955. {
  4956. if (target < 10)
  4957. {
  4958. Minion m = this.ownMinions[target];
  4959. this.minionGetDamagedOrHealed(m, damage, 0, true);
  4960. }
  4961. if (target >= 10 && target < 20)
  4962. {
  4963. Minion m = this.enemyMinions[target - 10];
  4964. this.minionGetDamagedOrHealed(m, damage, 0, false);
  4965. }
  4966. }
  4967. }
  4968. }
  4969. if (heroname == "priest")
  4970. {
  4971. int heal = 2;
  4972. if (this.auchenaiseelenpriesterin) heal = -2;
  4973. if (c.name == "gedankenstachel")
  4974. {
  4975. heal = -1 * 2;
  4976. }
  4977. if (c.name == "gedankenzersplitterung")
  4978. {
  4979. heal = -1 * 3;
  4980. }
  4981. if (target == 100)
  4982. {
  4983. attackOrHealHero(-1 * heal, true);
  4984. }
  4985. else
  4986. {
  4987. if (target == 200)
  4988. {
  4989. attackOrHealHero(-1 * heal, false);
  4990. }
  4991. else
  4992. {
  4993. if (target < 10)
  4994. {
  4995. Minion m = this.ownMinions[target];
  4996. this.minionGetDamagedOrHealed(m, 0, heal, true);
  4997. }
  4998. if (target >= 10 && target < 20)
  4999. {
  5000. Minion m = this.enemyMinions[target - 10];
  5001. this.minionGetDamagedOrHealed(m, 0, heal, false);
  5002. }
  5003. }
  5004. }
  5005. }
  5006. if (heroname == "warrior")
  5007. {
  5008. this.ownHeroDefence += 2;
  5009. }
  5010. if (heroname == "warlock")
  5011. {
  5012. this.owncarddraw++;
  5013. drawACard("unknown");
  5014. this.attackOrHealHero(2, true);
  5015. }
  5016. if (heroname == "thief")
  5017. {
  5018. CardDB.Card wcard = CardDB.Instance.getCardData("tueckischesmesser");
  5019. this.equipWeapon(wcard);
  5020. }
  5021. if (heroname == "druid")
  5022. {
  5023. this.ownheroAngr += 1;
  5024. if ((this.ownHeroNumAttackThisTurn == 0 || (this.ownHeroWindfury && this.ownHeroNumAttackThisTurn == 1)) && !this.ownHeroFrozen)
  5025. {
  5026. this.ownHeroReady = true;
  5027. }
  5028. this.ownHeroDefence += 1;
  5029. }
  5030. if (heroname == "hunter")
  5031. {
  5032. this.attackOrHealHero(2, false);
  5033. }
  5034. if (heroname == "pala")
  5035. {
  5036. int posi = this.ownMinions.Count - 1;
  5037. CardDB.Card kid = CardDB.Instance.getCardData("rekrutdersilbernenhand");
  5038. callKid(kid, posi, true);
  5039. }
  5040. if (heroname == "shaman")
  5041. {
  5042. int posi = this.ownMinions.Count - 1;
  5043. CardDB.Card kid = CardDB.Instance.getCardData("heiltotem");
  5044. callKid(kid, posi, true);
  5045. }
  5046. if (heroname == "lordjaraxxus")
  5047. {
  5048. int posi = this.ownMinions.Count - 1;
  5049. CardDB.Card kid = CardDB.Instance.getCardData("hoellenbestie");
  5050. callKid(kid, posi, true);
  5051. }
  5052. }
  5053. public void doAction()
  5054. {
  5055. /*if (this.playactions.Count >= 1)
  5056. {
  5057. Action a = this.playactions[0];
  5058. if (a.cardplay)
  5059. {
  5060. if (logging) help.logg("play " + a.card.name);
  5061. if (logging) help.logg("with position " + a.cardplace.X + "," + a.cardplace.Y);
  5062. help.clicklauf(a.cardplace.X, a.cardplace.Y);
  5063. if (a.owntarget >= 0)
  5064. {
  5065. if (logging) help.logg("on position " + a.ownplace.X + "," + a.ownplace.Y);
  5066. help.clicklauf(a.ownplace.X, a.ownplace.Y);
  5067. }
  5068. if (a.enemytarget >= 0)
  5069. {
  5070. if (logging) help.logg("and target to " + a.enemytarget + ": on " + a.targetplace.X + ", " + a.targetplace.Y);
  5071. help.clicklauf(a.targetplace.X, a.targetplace.Y);
  5072. }
  5073. }
  5074. if (a.minionplay)
  5075. {
  5076. if (logging) help.logg("attacker: " + a.owntarget + " enemy: " + a.enemytarget);
  5077. help.clicklauf(a.ownplace.X, a.ownplace.Y);
  5078. System.Threading.Thread.Sleep(500);
  5079. if (logging) help.logg("targetplace " + a.targetplace.X + ", " + a.targetplace.Y);
  5080. help.clicklauf(a.targetplace.X, a.targetplace.Y);
  5081. }
  5082. if (a.heroattack)
  5083. {
  5084. if (logging) help.logg("attack with hero, enemy: " + a.enemytarget);
  5085. help.clicklauf(a.ownplace.X, a.ownplace.Y);
  5086. if (logging) help.logg("targetplace " + a.targetplace.X + ", " + a.targetplace.Y);
  5087. help.clicklauf(a.targetplace.X, a.targetplace.Y);
  5088. }
  5089. if (a.useability)
  5090. {
  5091. if (logging) help.logg("useability ");
  5092. help.clicklauf(a.ownplace.X, a.ownplace.Y);
  5093. if (a.enemytarget >= 0)
  5094. {
  5095. if (logging) help.logg("on enemy: " + a.enemytarget + "targetplace " + a.targetplace.X + ", " + a.targetplace.Y);
  5096. help.clicklauf(a.targetplace.X, a.targetplace.Y);
  5097. }
  5098. }
  5099. }
  5100. else
  5101. {
  5102. // click endturnbutton
  5103. help.clicklauf(939, 353);
  5104. }
  5105. help.laufmaus(915, 400, 6);
  5106. */
  5107. }
  5108. public void printBoard()
  5109. {
  5110. help.logg("board: "+ value);
  5111. help.logg("cardsplayed: " + this.cardsPlayedThisTurn + " handsize: " + this.owncards.Count);
  5112. help.logg("ownhero: ");
  5113. help.logg("ownherohp: " + this.ownHeroHp + " + " + this.ownHeroDefence);
  5114. help.logg("ownheroattac: " + this.ownheroAngr);
  5115. help.logg("ownheroweapon: " + this.ownWeaponAttack + " " + this.ownWeaponDurability + " " + this.ownWeaponName);
  5116. help.logg("ownherostatus: frozen" + this.ownHeroFrozen + " ");
  5117. help.logg("enemyherohp: " + this.enemyHeroHp + " + " + this.enemyHeroDefence);
  5118. help.logg("OWN MINIONS################");
  5119. foreach (Minion m in this.ownMinions)
  5120. {
  5121. help.logg("name,ang, hp: " + m.name + ", " + m.Angr + ", " + m.Hp);
  5122. }
  5123. help.logg("ENEMY MINIONS############");
  5124. foreach (Minion m in this.enemyMinions)
  5125. {
  5126. help.logg("name,ang, hp: " + m.name + ", " + m.Angr + ", " + m.Hp);
  5127. }
  5128. help.logg("");
  5129. }
  5130. public Action getNextAction()
  5131. {
  5132. if (this.playactions.Count >= 1) return this.playactions[0];
  5133. return null;
  5134. }
  5135. public void printActions()
  5136. {
  5137. foreach (Action a in this.playactions)
  5138. {
  5139. if (a.cardplay)
  5140. {
  5141. help.logg("play " + a.card.name);
  5142. if (a.druidchoice >= 1) help.logg("choose choise " + a.druidchoice);
  5143. help.logg("with position " + a.cardEntitiy);
  5144. if (a.owntarget >= 0)
  5145. {
  5146. help.logg("on position " + a.ownEntitiy);
  5147. }
  5148. if (a.enemytarget >= 0)
  5149. {
  5150. help.logg("and target to " + a.enemytarget + " " + a.enemyEntitiy);
  5151. }
  5152. }
  5153. if (a.minionplay)
  5154. {
  5155. help.logg("attacker: " + a.owntarget + " enemy: " + a.enemytarget);
  5156. help.logg("targetplace " + a.enemyEntitiy);
  5157. }
  5158. if (a.heroattack)
  5159. {
  5160. help.logg("attack with hero, enemy: " + a.enemytarget);
  5161. help.logg("targetplace " + a.enemyEntitiy);
  5162. }
  5163. if (a.useability)
  5164. {
  5165. help.logg("useability ");
  5166. if (a.enemytarget >= 0)
  5167. {
  5168. help.logg("on enemy: " + a.enemytarget + "targetplace " + a.enemyEntitiy);
  5169. }
  5170. }
  5171. help.logg("");
  5172. }
  5173. }
  5174. }
  5175. }