// Deathrattle: Put a Secret: from your deck into the battlefield. public override void onDeathrattle(Playfield p, Minion m) { if (m.own) { CardDB.cardIDEnum secToDraw = p.getArandomSecretFromDeck(m.own); if (secToDraw != CardDB.cardIDEnum.None) { p.playerFirst.ownSecretsIDList.Add(secToDraw); GraveYardItem gyi = new GraveYardItem(secToDraw, p.getNextEntity(), m.own); p.graveYard.Add(gyi); } } else { CardDB.cardIDEnum secToDraw = p.getArandomSecretFromDeck(m.own); if (secToDraw != CardDB.cardIDEnum.None) { p.playerSecond.ownSecretsIDList.Add(secToDraw); GraveYardItem gyi = new GraveYardItem(secToDraw, p.getNextEntity(), m.own); p.graveYard.Add(gyi); } } }
public bool updateEverything(HRSim.Playfield mp, bool own) { //HRSim.Helpfunctions.Instance.startTimer(); HRSim.Player mPlayer, ePlayer; if (own) { mPlayer = mp.playerFirst; ePlayer = mp.playerSecond; } else { mPlayer = mp.playerSecond; ePlayer = mp.playerFirst; } this.updateBehaveString(botbase); updateHeroStuff(mp, own); updateMinions(mp, own); updateHandcards(mp, own); updateDecks(mp, own); // send ai the data: Hrtprozis.clearAll(); Handmanager.clearAll(); Hrtprozis.setOwnPlayer(mPlayer.ownController); Handmanager.setOwnPlayer(mPlayer.ownController); this.numOptionPlayedThisTurn = 0; this.numOptionPlayedThisTurn += this.cardsPlayedThisTurn + this.ownHero.numAttacksThisTurn; foreach (Minion m in this.ownMinions) { if (m.Hp >= 1) { this.numOptionPlayedThisTurn += m.numAttacksThisTurn; } } Hrtprozis.updatePlayer(this.ownMaxMana, this.currentMana, this.cardsPlayedThisTurn, this.numMinionsPlayedThisTurn, this.numOptionPlayedThisTurn, this.ueberladung, mPlayer.ownHero.entitiyID, mp.playerSecond.ownHero.entitiyID); Hrtprozis.updateSecretStuff(this.ownSecretList, this.enemySecretCount); Hrtprozis.updateOwnHero(this.ownHeroWeapon, this.heroWeaponAttack, this.heroWeaponDurability, this.heroname, this.heroAbility, this.ownAbilityisReady, this.ownHero); Hrtprozis.updateEnemyHero(this.enemyHeroWeapon, this.enemyWeaponAttack, this.enemyWeaponDurability, this.enemyHeroname, this.enemyMaxMana, this.enemyAbility, this.enemyHero); Hrtprozis.updateMinions(this.ownMinions, this.enemyMinions); Handmanager.setHandcards(this.handCards, this.anzcards, this.enemyAnzCards); Hrtprozis.updateFatigueStats(this.ownDecksize, this.ownHeroFatigue, this.enemyDecksize, this.enemyHeroFatigue); Hrtprozis.updateMaxEntity(mp.getNextEntity()); //change here!! Probabilitymaker.getEnemySecretGuesses(this.enemySecretList, Hrtprozis.enemyHeroStartClass); //learnmode :D //HRSim.Helpfunctions.Instance.logTime("start to finish update"); Playfield p = new Playfield(this); if (lastpf != null) { if (lastpf.isEqualf(p)) { return(false); } //board changed we update secrets! //if(Ai.nextMoveGuess!=null) Probabilitymaker.Instance.updateSecretList(Ai.nextMoveGuess.enemySecretList); Probabilitymaker.updateSecretList(p, lastpf); lastpf = p; } else { lastpf = p; } p = new Playfield(this); //secrets have updated :D p.printBoard(); // calculate stuff HRSim.Helpfunctions.Instance.ErrorLog("calculating stuff... " + DateTime.Now.ToString("HH:mm:ss.ffff")); //if (runExtern) //{ // HRSim.Helpfunctions.Instance.logg("recalc-check###########"); // if (p.isEqual(Ai.nextMoveGuess, true)) // { // //printstuff(false); // Debug.WriteLine("equal"); // Ai.doNextCalcedMove(); // } // else // { // //printstuff(true); // Debug.WriteLine("not equal"); // //readActionFile(passiveWait); // } //} //else //{ // Drew: This prevents the freeze during AI updates, but no API functions may be called // during this time! //using (TritonHs.Memory.ReleaseFrame(true)) //{ // printstuff(false); Ai.dosomethingclever(botbase); //} //} //HRSim.Helpfunctions.Instance.logTime("end of do sth clever"); //Ai.bestmove = Movegenerator.getRandomMove(new Playfield(p), true, false, true); HRSim.Helpfunctions.Instance.ErrorLog("calculating ended! " + DateTime.Now.ToString("HH:mm:ss.ffff")); return(true); }