//private static Ai instance; //public static Ai Instance //{ // get // { // return instance ?? (instance = new Ai()); // } //} public Ai(Silverfish sf) { this.sf = sf; this.nextMoveGuess = new Playfield(sf); PenalityManager penman = sf.PenalityManager; hp = sf.Hrtprozis; hm = sf.Handmanager; help = sf.Helpfunctions; this.nextMoveGuess = new Playfield (sf) { mana = -100 }; this.mainTurnSimulator = new MiniSimulator(sf, maxdeep, maxwide, 0); // 0 for unlimited this.mainTurnSimulator.setPrintingstuff(true); /*this.nextTurnSimulator = new MiniSimulatorNextTurn(); this.enemyTurnSim = new EnemyTurnSimulator(); this.enemySecondTurnSim = new EnemyTurnSimulator();*/ for (int i = 0; i < sf.Settings.numberOfThreads; i++) { this.nextTurnSimulator.Add(new MiniSimulatorNextTurn(sf)); this.enemyTurnSim.Add(new EnemyTurnSimulator(sf)); this.enemySecondTurnSim.Add(new EnemyTurnSimulator(sf)); this.nextTurnSimulator[i].thread = i; this.enemyTurnSim[i].thread = i; this.enemySecondTurnSim[i].thread = i; } }
public int getChoice(Playfield p) { int i = 0; int choice = 0; int prevbonus = 0; foreach (Handmanager.Handcard hc in Handmanager.Instance.handcardchoices) { CardDB.Card c = hc.card; i++; int bonus = getBonusValue(c.cardIDenum, Hrtprozis.heroEnumtoName(p.ownHeroName), Hrtprozis.heroEnumtoName(p.enemyHeroName)); if (bonus > prevbonus) { choice = i; prevbonus = bonus; } } return(choice); }
//public static ComboBreaker Instance //{ // get // { // return instance ?? (instance = new ComboBreaker()); // } //} public ComboBreaker(Silverfish sf) { this.sf = sf; hm = sf.Handmanager; hp = sf.Hrtprozis; readCombos(); if (attackFaceHP != -1) { hp.setAttackFaceHP(attackFaceHP); } }
public int getChoice(Playfield p) { this.choicebonus = 0; int i = 0; int choice = 0; int prevbonus = 0; bool cankillmortalcoil = false; bool enemyhastaunt = false; bool enemyhas1hp = false; bool soulfiretarget = false; bool corruptiontarget = false; foreach (Minion mnn in p.enemyMinions) { if (mnn.Hp <= 1 + p.spellpower) { cankillmortalcoil = true; } if (mnn.taunt) { enemyhastaunt = true; } if (mnn.Hp == 1) { enemyhas1hp = true; } if (mnn.Angr >= 3 && mnn.Hp <= 4 || PenalityManager.Instance.priorityTargets.ContainsKey(mnn.name)) { soulfiretarget = true; } if (mnn.Hp >= 5 || mnn.Angr >= 4) { corruptiontarget = true; } } bool canibuff = false; foreach (Minion mnn in p.ownMinions) { if (mnn.Ready) { canibuff = true; } } bool hasMinusValue = false; List <int> minusvalue = new List <int>(new int[] { 1, 2, 3 }); foreach (Handmanager.Handcard hc in Handmanager.Instance.handcardchoices) { CardDB.Card c = hc.card; i++; int bonus = getBonusValue(c.cardIDenum, Hrtprozis.heroEnumtoName(p.ownHeroName), Hrtprozis.heroEnumtoName(p.enemyHeroName)); switch (hc.card.name) { case CardDB.cardName.mortalcoil: { if (p.mana >= 1 && cankillmortalcoil) { bonus += 200; } break; } case CardDB.cardName.bloodsailcorsair: { if (p.mana >= 1 && p.enemyWeaponAttack >= 1) { bonus += 200; } break; } case CardDB.cardName.reliquaryseeker: { if (p.mana >= 1 && p.ownMinions.Count >= 6) { bonus += 200; } break; } case CardDB.cardName.elvenarcher: { if (p.mana >= 1 && (enemyhas1hp || Ai.Instance.lethalMissing == 1)) { bonus += 250; } else if (p.mana >= 1 && cankillmortalcoil) { bonus += 200; } break; } case CardDB.cardName.stonetuskboar: { if (p.mana >= 1 && (enemyhas1hp || (Ai.Instance.lethalMissing == 1 && !enemyhastaunt))) { bonus += 250; } break; } case CardDB.cardName.soulfire: { if (p.mana >= 1 && (soulfiretarget || Ai.Instance.lethalMissing <= 4)) { bonus += 250; } break; } case CardDB.cardName.poweroverwhelming: { if (p.mana >= 1 && ((canibuff && Ai.Instance.lethalMissing <= 4) || (canibuff && corruptiontarget))) { bonus += 250; } break; } case CardDB.cardName.corruption: { if (p.mana >= 1 && corruptiontarget && !canibuff) { bonus += 150; } break; } case CardDB.cardName.voidwalker: { if (p.mana >= 1 && Ai.Instance.bestmoveValue <= -400) { bonus += 200; } break; } case CardDB.cardName.shieldbearer: { if (p.mana >= 1 && Ai.Instance.bestmoveValue <= -400) { bonus += 190; } break; } case CardDB.cardName.goldshirefootman: { if (p.mana >= 1 && Ai.Instance.bestmoveValue <= -400) { bonus += 180; } break; } case CardDB.cardName.tournamentattendee: { if (p.mana >= 1 && Ai.Instance.bestmoveValue <= -400) { bonus += 180; } break; } case CardDB.cardName.sirfinleymrrgglton: { if (p.ownHeroName == HeroEnum.warlock) { bonus -= 100; hasMinusValue = true; minusvalue.Remove(i); } break; } default: break; } //adaptcards //switch (hc.card.cardIDenum) //{ // case CardDB.cardIDEnum.UNG_999t3: bonus = 250; break;// 3attack // case CardDB.cardIDEnum.UNG_999t8: bonus = 180; break; //divine shield // case CardDB.cardIDEnum.UNG_999t13: //poisonous // { // if (p.enemyMinions.Find(a => a.Hp >= 5) != null) bonus += 100; //very huge // else bonus += 170; // break; // } // case CardDB.cardIDEnum.UNG_999t14: bonus = 150; break;// +1/+1 // case CardDB.cardIDEnum.UNG_999t4: bonus = 140; break;// 3hp // case CardDB.cardIDEnum.UNG_999t2: bonus = 100; break;//deathrattle 2 1/1 plants // case CardDB.cardIDEnum.UNG_999t7: // { // bonus = 90; // if (p.guessEnemyHeroLethalMissing() <= 3) bonus += 150; // }//windfury // break; // case CardDB.cardIDEnum.UNG_999t6: //taunt // { // if (Ai.Instance.bestmoveValue <= -400) bonus += 1000; // else if (p.ownHero.Hp <= 10) bonus += 205; // break; // } // case CardDB.cardIDEnum.UNG_999t10: bonus += 1; break;//stealth // case CardDB.cardIDEnum.UNG_999t5: break; //can't be targeted // default: break; //} if (p.owncards.Count == 0) { if (hc.card.cost <= p.mana && p.turnCounter == 0) { bonus += 10 * hc.card.cost; } } else if (hc.card.cost == p.ownMaxMana + 1 && p.turnCounter == 0) { bonus += 1; //bonus for next turn } if (bonus > prevbonus) { choice = i; prevbonus = bonus; } Helpfunctions.Instance.ErrorLog("card : " + i + " name : " + hc.card.name); Helpfunctions.Instance.logg("card : " + i + " name : " + hc.card.name); } this.choicebonus = prevbonus; if (choicebonus == 0 && hasMinusValue) { if (minusvalue.Count >= 1) { choice = minusvalue[0]; } } Helpfunctions.Instance.ErrorLog("Choice : " + choice + " bonus : " + choicebonus); Helpfunctions.Instance.logg("Choice : " + choice + " bonus : " + choicebonus); return(choice); }