Ejemplo n.º 1
0
        public void simmulateWholeTurn()
        {
            help.ErrorLog("########################################################################################################");
            help.ErrorLog("simulate best board");
            help.ErrorLog("########################################################################################################");
            //this.bestboard.printActions();

            Playfield tempbestboard = new Playfield();

            tempbestboard.value = botBase.getPlayfieldValue(tempbestboard);
            tempbestboard.printBoard();

            if (bestmove != null && bestmove.actionType != actionEnum.endturn)  // save the guessed move, so we doesnt need to recalc!
            {
                bestmove.print();

                tempbestboard.doAction(bestmove);
            }
            else
            {
                tempbestboard.mana = -100;
            }
            help.logg("-------------");
            tempbestboard.value = botBase.getPlayfieldValue(tempbestboard);
            tempbestboard.printBoard();

            foreach (Action bestmovee in this.bestActions)
            {
                help.logg("stepp");


                if (bestmovee != null && bestmovee.actionType != actionEnum.endturn)  // save the guessed move, so we doesnt need to recalc!
                {
                    bestmovee.print();

                    tempbestboard.doAction(bestmovee);
                }
                else
                {
                    tempbestboard.mana = -100;
                }
                help.logg("-------------");
                tempbestboard.value = botBase.getPlayfieldValue(tempbestboard);
                tempbestboard.printBoard();
            }

            //help.logg("AFTER ENEMY TURN:" );
            tempbestboard.sEnemTurn = true;
            tempbestboard.endTurn(false, this.playaround, false, Settings.Instance.playaroundprob, Settings.Instance.playaroundprob2);
            help.logg("ENEMY TURN:-----------------------------");
            tempbestboard.value = botBase.getPlayfieldValue(tempbestboard);
            tempbestboard.prepareNextTurn(tempbestboard.isOwnTurn);
            Ai.Instance.enemyTurnSim[0].simulateEnemysTurn(tempbestboard, true, playaround, true, Settings.Instance.playaroundprob, Settings.Instance.playaroundprob2);
        }
Ejemplo n.º 2
0
 private void printError(List <Action> mainActList, List <Action> newActList, Action aError)
 {
     help.ErrorLog("Reordering actions error!");
     LogHelper.WriteCombatLog("Reordering actions error!\r\nError in action:");
     aError.print();
     LogHelper.WriteCombatLog("Main order of actions:");
     foreach (Action a in mainActList)
     {
         a.print();
     }
     LogHelper.WriteCombatLog("New order of actions:");
     foreach (Action a in newActList)
     {
         a.print();
     }
     return;
 }
Ejemplo n.º 3
0
        private void printError(List <Action> mainActList, List <Action> newActList, Action aError)
        {
            this.help.ErrorLog("Reordering actions error!");
            this.help.logg("Reordering actions error!\r\nError in action:");
            aError.print();
            this.help.logg("Main order of actions:");
            foreach (var a in mainActList)
            {
                a.print();
            }

            this.help.logg("New order of actions:");
            foreach (var a in newActList)
            {
                a.print();
            }
        }
Ejemplo n.º 4
0
        public void simmulateWholeTurn()
        {
            help.ErrorLog("########################################################################################################");
            help.ErrorLog("simulate best board");
            help.ErrorLog("########################################################################################################");
            //this.bestboard.printActions();

            Playfield tempbestboard = new Playfield();

            tempbestboard.printBoard();

            if (bestmove != null && bestmove.actionType != actionEnum.endturn)  // save the guessed move, so we doesnt need to recalc!
            {
                bestmove.print();

                tempbestboard.doAction(bestmove);
            }
            else
            {
                tempbestboard.mana = -100;
            }
            help.logg("-------------");
            tempbestboard.printBoard();

            foreach (Action bestmovee in this.bestActions)
            {
                help.logg("stepp");


                if (bestmovee != null && bestmove.actionType != actionEnum.endturn)  // save the guessed move, so we doesnt need to recalc!
                {
                    bestmovee.print();

                    tempbestboard.doAction(bestmovee);
                }
                else
                {
                    tempbestboard.mana = -100;
                }
                help.logg("-------------");
                tempbestboard.printBoard();
            }

            //help.logg("AFTER ENEMY TURN:" );
        }
Ejemplo n.º 5
0
        /// <summary>
        /// [EN]
        /// This handler is executed when the local player turn is active.
        ///
        /// [DE]
        /// Dieses Event wird ausgelöst wenn der Spieler am Zug ist.
        /// </summary>
        private HREngine.API.Actions.ActionBase HandleOnBattleStateUpdate()
        {
            try
            {
                if (HRBattle.IsInTargetMode() && dirtytarget >= 0)
                {
                    HRLog.Write("dirty targeting...");
                    HREntity target = getEntityWithNumber(dirtytarget);
                    dirtytarget = -1;
                    return(new HREngine.API.Actions.TargetAction(target));
                }


                //SafeHandleBattleLocalPlayerTurnHandler();


                sf.updateEverything(this);
                Action moveTodo = Ai.Instance.bestmove;
                if (moveTodo == null)
                {
                    HRLog.Write("end turn");
                    return(null);
                }
                HRLog.Write("play action");
                moveTodo.print();
                if (moveTodo.cardplay)
                {
                    HRCard cardtoplay = getCardWithNumber(moveTodo.cardEntitiy);
                    if (moveTodo.enemytarget >= 0)
                    {
                        HREntity target = getEntityWithNumber(moveTodo.enemyEntitiy);
                        HRLog.Write("play: " + cardtoplay.GetEntity().GetName() + " target: " + target.GetName());
                        Helpfunctions.Instance.logg("play: " + cardtoplay.GetEntity().GetName() + " target: " + target.GetName());
                        if (moveTodo.handcard.card.type == CardDB.cardtype.MOB)
                        {
                            return(new HREngine.API.Actions.PlayCardAction(cardtoplay, target, moveTodo.owntarget + 1));
                        }

                        return(new HREngine.API.Actions.PlayCardAction(cardtoplay, target));
                    }
                    else
                    {
                        HRLog.Write("play: " + cardtoplay.GetEntity().GetName() + " target nothing");
                        if (moveTodo.handcard.card.type == CardDB.cardtype.MOB)
                        {
                            return(new HREngine.API.Actions.PlayCardAction(cardtoplay, null, moveTodo.owntarget + 1));
                        }
                        return(new HREngine.API.Actions.PlayCardAction(cardtoplay));
                    }
                }

                if (moveTodo.minionplay)
                {
                    HREntity attacker = getEntityWithNumber(moveTodo.ownEntitiy);
                    HREntity target   = getEntityWithNumber(moveTodo.enemyEntitiy);
                    HRLog.Write("minion attack: " + attacker.GetName() + " target: " + target.GetName());
                    Helpfunctions.Instance.logg("minion attack: " + attacker.GetName() + " target: " + target.GetName());
                    return(new HREngine.API.Actions.AttackAction(attacker, target));
                }

                if (moveTodo.heroattack)
                {
                    HREntity attacker = getEntityWithNumber(moveTodo.ownEntitiy);
                    HREntity target   = getEntityWithNumber(moveTodo.enemyEntitiy);
                    this.dirtytarget = moveTodo.enemyEntitiy;
                    //HRLog.Write("heroattack: attkr:" + moveTodo.ownEntitiy + " defender: " + moveTodo.enemyEntitiy);
                    HRLog.Write("heroattack: " + attacker.GetName() + " target: " + target.GetName());
                    Helpfunctions.Instance.logg("heroattack: " + attacker.GetName() + " target: " + target.GetName());
                    if (HRPlayer.GetLocalPlayer().HasWeapon())
                    {
                        HRLog.Write("hero attack with weapon");
                        return(new HREngine.API.Actions.AttackAction(HRPlayer.GetLocalPlayer().GetWeaponCard().GetEntity(), target));
                    }
                    HRLog.Write("hero attack without weapon");
                    //HRLog.Write("attacker entity: " + HRPlayer.GetLocalPlayer().GetHero().GetEntityId());
                    return(new HREngine.API.Actions.AttackAction(HRPlayer.GetLocalPlayer().GetHero(), target));
                }

                if (moveTodo.useability)
                {
                    HRCard cardtoplay = HRPlayer.GetLocalPlayer().GetHeroPower().GetCard();

                    if (moveTodo.enemytarget >= 0)
                    {
                        HREntity target = getEntityWithNumber(moveTodo.enemyEntitiy);
                        HRLog.Write("use ablitiy: " + cardtoplay.GetEntity().GetName() + " target " + target.GetName());
                        Helpfunctions.Instance.logg("use ablitiy: " + cardtoplay.GetEntity().GetName() + " target " + target.GetName());
                        return(new HREngine.API.Actions.PlayCardAction(cardtoplay, target));
                    }
                    else
                    {
                        HRLog.Write("use ablitiy: " + cardtoplay.GetEntity().GetName() + " target nothing");
                        Helpfunctions.Instance.logg("use ablitiy: " + cardtoplay.GetEntity().GetName() + " target nothing");
                        return(new HREngine.API.Actions.PlayCardAction(cardtoplay));
                    }
                }
            }
            catch (Exception Exception)
            {
                HRLog.Write(Exception.Message);
                HRLog.Write(Environment.StackTrace);
            }
            return(null);
            //HRBattle.FinishRound();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// [EN]
        /// This handler is executed when the local player turn is active.
        ///
        /// [DE]
        /// Dieses Event wird ausgelöst wenn der Spieler am Zug ist.
        /// </summary>
        private HREngine.API.Actions.ActionBase HandleOnBattleStateUpdate()
        {
            try
            {
                if (this.isgoingtoconcede)
                {
                    if (HREngine.API.Utilities.HRSettings.Get.SelectedGameMode == HRGameMode.ARENA)
                    {
                        this.isgoingtoconcede = false;
                    }
                    else
                    {
                        return(new HREngine.API.Actions.ConcedeAction());
                    }
                }

                if (Settings.Instance.passiveWaiting && sf.waitingForSilver)
                {
                    if (!this.sf.readActionFile(true))
                    {
                        return(new HREngine.API.Actions.MakeNothingAction());
                    }
                }

                if (Settings.Instance.learnmode && (HRBattle.IsInTargetMode() || HRChoice.IsChoiceActive()))
                {
                    return(new HREngine.API.Actions.MakeNothingAction());
                }

                if (HRBattle.IsInTargetMode() && dirtytarget >= 0)
                {
                    Helpfunctions.Instance.ErrorLog("dirty targeting...");
                    HREntity target = getEntityWithNumber(dirtytarget);

                    dirtytarget = -1;

                    return(new HREngine.API.Actions.TargetAction(target));
                }
                if (HRChoice.IsChoiceActive())
                {
                    if (this.dirtychoice >= 1)
                    {
                        List <HREntity> choices = HRChoice.GetChoiceCards();
                        int             choice  = this.dirtychoice;
                        this.dirtychoice = -1;
                        string ccId = this.choiceCardId;
                        this.choiceCardId = "";
                        HREntity target = choices[choice - 1];
                        if (ccId == "EX1_160")
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "EX1_160b")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "EX1_160a")
                                {
                                    target = hre;
                                }
                            }
                        }
                        if (ccId == "NEW1_008")
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "NEW1_008a")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "NEW1_008b")
                                {
                                    target = hre;
                                }
                            }
                        }
                        if (ccId == "EX1_178")
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "EX1_178a")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "EX1_178b")
                                {
                                    target = hre;
                                }
                            }
                        }
                        if (ccId == "EX1_573")
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "EX1_573a")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "EX1_573b")
                                {
                                    target = hre;
                                }
                            }
                        }
                        if (ccId == "EX1_165")//druid of the claw
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "EX1_165t1")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "EX1_165t2")
                                {
                                    target = hre;
                                }
                            }
                        }
                        if (ccId == "EX1_166")//keeper of the grove
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "EX1_166a")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "EX1_166b")
                                {
                                    target = hre;
                                }
                            }
                        }
                        if (ccId == "EX1_155")
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "EX1_155a")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "EX1_155b")
                                {
                                    target = hre;
                                }
                            }
                        }
                        if (ccId == "EX1_164")
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "EX1_164a")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "EX1_164b")
                                {
                                    target = hre;
                                }
                            }
                        }
                        if (ccId == "New1_007")//starfall
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "New1_007b")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "New1_007a")
                                {
                                    target = hre;
                                }
                            }
                        }
                        if (ccId == "EX1_154")//warth
                        {
                            foreach (HREntity hre in choices)
                            {
                                if (choice == 1 && hre.GetCardId() == "EX1_154a")
                                {
                                    target = hre;
                                }
                                if (choice == 2 && hre.GetCardId() == "EX1_154b")
                                {
                                    target = hre;
                                }
                            }
                        }
                        Helpfunctions.Instance.logg("chooses the card: " + target.GetCardId());
                        return(new HREngine.API.Actions.ChoiceAction(target));
                    }
                    else
                    {
                        //Todo: ultimate tracking-simulation!
                        List <HREntity> choices = HRChoice.GetChoiceCards();
                        Random          r       = new Random();
                        int             choice  = r.Next(0, choices.Count);
                        Helpfunctions.Instance.logg("chooses a random card");
                        return(new HREngine.API.Actions.ChoiceAction(choices[choice]));
                    }
                }

                bool templearn = sf.updateEverything(behave, Settings.Instance.useExternalProcess, Settings.Instance.passiveWaiting);
                if (templearn == true)
                {
                    Settings.Instance.printlearnmode = true;
                }

                if (Settings.Instance.passiveWaiting && sf.waitingForSilver)
                {
                    return(new HREngine.API.Actions.MakeNothingAction());
                }

                if (Settings.Instance.learnmode)
                {
                    if (Settings.Instance.printlearnmode)
                    {
                        Ai.Instance.simmulateWholeTurnandPrint();
                    }
                    Settings.Instance.printlearnmode = false;
                    return(new HREngine.API.Actions.MakeNothingAction());
                }



                if (Ai.Instance.bestmoveValue <= -900 && Settings.Instance.enemyConcede)
                {
                    return(new HREngine.API.Actions.ConcedeAction());
                }

                Action moveTodo = Ai.Instance.bestmove;

                if (moveTodo == null || moveTodo.actionType == actionEnum.endturn)
                {
                    Helpfunctions.Instance.ErrorLog("end turn");
                    return(null);
                }
                Helpfunctions.Instance.ErrorLog("play action");
                moveTodo.print();
                if (moveTodo.actionType == actionEnum.playcard)
                {
                    HRCard cardtoplay = getCardWithNumber(moveTodo.card.entity);
                    if (moveTodo.target != null)
                    {
                        HREntity target = getEntityWithNumber(moveTodo.target.entitiyID);
                        Helpfunctions.Instance.ErrorLog("play: " + cardtoplay.GetEntity().GetName() + " target: " + target.GetName());
                        Helpfunctions.Instance.logg("play: " + cardtoplay.GetEntity().GetName() + " target: " + target.GetName() + " choice: " + moveTodo.druidchoice);
                        if (moveTodo.druidchoice >= 1)
                        {
                            this.dirtytarget  = moveTodo.target.entitiyID;
                            this.dirtychoice  = moveTodo.druidchoice; //1=leftcard, 2= rightcard
                            this.choiceCardId = moveTodo.card.card.cardIDenum.ToString();
                        }
                        if (moveTodo.card.card.type == CardDB.cardtype.MOB)
                        {
                            return(new HREngine.API.Actions.PlayCardAction(cardtoplay, target, moveTodo.place));
                        }

                        return(new HREngine.API.Actions.PlayCardAction(cardtoplay, target));
                    }
                    else
                    {
                        Helpfunctions.Instance.ErrorLog("play: " + cardtoplay.GetEntity().GetName() + " target nothing");
                        Helpfunctions.Instance.logg("play: " + cardtoplay.GetEntity().GetName() + " choice: " + moveTodo.druidchoice);
                        if (moveTodo.druidchoice >= 1)
                        {
                            this.dirtychoice  = moveTodo.druidchoice; //1=leftcard, 2= rightcard
                            this.choiceCardId = moveTodo.card.card.cardIDenum.ToString();
                        }
                        if (moveTodo.card.card.type == CardDB.cardtype.MOB)
                        {
                            return(new HREngine.API.Actions.PlayCardAction(cardtoplay, null, moveTodo.place));
                        }
                        return(new HREngine.API.Actions.PlayCardAction(cardtoplay));
                    }
                }

                if (moveTodo.actionType == actionEnum.attackWithMinion)
                {
                    HREntity attacker = getEntityWithNumber(moveTodo.own.entitiyID);
                    HREntity target   = getEntityWithNumber(moveTodo.target.entitiyID);
                    Helpfunctions.Instance.ErrorLog("minion attack: " + attacker.GetName() + " target: " + target.GetName());
                    Helpfunctions.Instance.logg("minion attack: " + attacker.GetName() + " target: " + target.GetName());
                    return(new HREngine.API.Actions.AttackAction(attacker, target));
                }

                if (moveTodo.actionType == actionEnum.attackWithHero)
                {
                    HREntity attacker = getEntityWithNumber(moveTodo.own.entitiyID);
                    HREntity target   = getEntityWithNumber(moveTodo.target.entitiyID);
                    this.dirtytarget = moveTodo.target.entitiyID;
                    Helpfunctions.Instance.ErrorLog("heroattack: " + attacker.GetName() + " target: " + target.GetName());
                    Helpfunctions.Instance.logg("heroattack: " + attacker.GetName() + " target: " + target.GetName());
                    if (HRPlayer.GetLocalPlayer().HasWeapon())
                    {
                        Helpfunctions.Instance.ErrorLog("hero attack with weapon");
                        return(new HREngine.API.Actions.AttackAction(HRPlayer.GetLocalPlayer().GetWeaponCard().GetEntity(), target));
                    }
                    Helpfunctions.Instance.ErrorLog("hero attack without weapon");
                    //Helpfunctions.Instance.ErrorLog("attacker entity: " + HRPlayer.GetLocalPlayer().GetHero().GetEntityId());
                    //return new HREngine.API.Actions.AttackAction(HRPlayer.GetLocalPlayer().GetHero(), target);
                    return(new HREngine.API.Actions.PlayCardAction(HRPlayer.GetLocalPlayer().GetHeroCard(), target));
                }

                if (moveTodo.actionType == actionEnum.useHeroPower)
                {
                    HRCard cardtoplay = HRPlayer.GetLocalPlayer().GetHeroPower().GetCard();

                    if (moveTodo.target != null)
                    {
                        HREntity target = getEntityWithNumber(moveTodo.target.entitiyID);
                        Helpfunctions.Instance.ErrorLog("use ablitiy: " + cardtoplay.GetEntity().GetName() + " target " + target.GetName());
                        Helpfunctions.Instance.logg("use ablitiy: " + cardtoplay.GetEntity().GetName() + " target " + target.GetName());
                        return(new HREngine.API.Actions.PlayCardAction(cardtoplay, target));
                    }
                    else
                    {
                        Helpfunctions.Instance.ErrorLog("use ablitiy: " + cardtoplay.GetEntity().GetName() + " target nothing");
                        Helpfunctions.Instance.logg("use ablitiy: " + cardtoplay.GetEntity().GetName() + " target nothing");
                        return(new HREngine.API.Actions.PlayCardAction(cardtoplay));
                    }
                }
            }
            catch (Exception Exception)
            {
                Helpfunctions.Instance.ErrorLog(Exception.Message);
                Helpfunctions.Instance.ErrorLog(Environment.StackTrace);
                if (Settings.Instance.learnmode)
                {
                    return(new HREngine.API.Actions.MakeNothingAction());
                }
            }
            return(null);
            //HRBattle.FinishRound();
        }
Ejemplo n.º 7
0
        public void simmulateWholeTurn()
        {
            help.logg("simulate best board");
            //this.bestboard.printActions();

            Playfield tempbestboard = new Playfield();

            if (bestmove != null) // save the guessed move, so we doesnt need to recalc!
            {
                bestmove.print();
                if (bestmove.cardplay)
                {
                    help.logg("card");
                    //pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
                    Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmove.cardEntitiy);
                    if (bestmove.owntarget >= 0 && bestmove.enemytarget >= 0 && bestmove.enemytarget <= 9 && bestmove.owntarget < bestmove.enemytarget)
                    {
                        tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget - 1, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
                    }
                    else
                    {
                        tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
                    }
                }

                if (bestmove.minionplay)
                {
                    help.logg("min");
                    //.attackWithMinion(m, trgt.target, trgt.targetEntity, attackPenality);
                    Minion mm = tempbestboard.ownMinions.Find(x => x.entitiyID == bestmove.ownEntitiy);
                    tempbestboard.attackWithMinion(mm, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
                }

                if (bestmove.heroattack)
                {
                    help.logg("hero");
                    tempbestboard.attackWithWeapon(bestmove.enemytarget, bestmove.enemyEntitiy, 0);
                }

                if (bestmove.useability)
                {
                    help.logg("abi");
                    //.activateAbility(p.ownHeroAblility, trgt.target, trgt.targetEntity, abilityPenality);
                    tempbestboard.activateAbility(this.nextMoveGuess.ownHeroAblility, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
                }
            }
            else
            {
                tempbestboard.mana = -1;
            }
            help.logg("-------------");
            tempbestboard.printBoard();

            foreach (Action bestmovee in bestboard.playactions)
            {
                help.logg("stepp");


                if (bestmovee != null) // save the guessed move, so we doesnt need to recalc!
                {
                    bestmovee.print();
                    if (bestmovee.cardplay)
                    {
                        help.logg("card");
                        //pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
                        Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmovee.cardEntitiy);
                        if (bestmovee.owntarget >= 0 && bestmovee.enemytarget >= 0 && bestmovee.enemytarget <= 9 && bestmovee.owntarget < bestmovee.enemytarget)
                        {
                            tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget - 1, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
                        }
                        else
                        {
                            tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
                        }
                    }

                    if (bestmovee.minionplay)
                    {
                        help.logg("min");
                        //.attackWithMinion(m, trgt.target, trgt.targetEntity, attackPenality);
                        Minion mm = tempbestboard.ownMinions.Find(x => x.entitiyID == bestmovee.ownEntitiy);
                        tempbestboard.attackWithMinion(mm, bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
                    }

                    if (bestmovee.heroattack)
                    {
                        help.logg("hero");
                        tempbestboard.attackWithWeapon(bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
                    }

                    if (bestmovee.useability)
                    {
                        help.logg("abi");
                        //.activateAbility(p.ownHeroAblility, trgt.target, trgt.targetEntity, abilityPenality);
                        tempbestboard.activateAbility(this.nextMoveGuess.ownHeroAblility, bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
                    }
                }
                else
                {
                    tempbestboard.mana = -1;
                }
                help.logg("-------------");
                tempbestboard.printBoard();
            }

            help.logg("AFTER ENEMY TURN:");
            tempbestboard.sEnemTurn = this.simulateEnemyTurn;
            tempbestboard.endTurn(this.secondturnsim, this.playaround, true);
        }
Ejemplo n.º 8
0
        public void simmulateWholeTurn()
        {
            help.logg("simulate best board");
            //this.bestboard.printActions();

            Playfield tempbestboard = new Playfield();

            if (bestmove != null) // save the guessed move, so we doesnt need to recalc!
            {
                bestmove.print();
                if (bestmove.cardplay)
                {
                    help.logg("card");
                    //pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
                    Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmove.cardEntitiy);
                    if (bestmove.owntarget >= 0 && bestmove.enemytarget >= 0 && bestmove.enemytarget <= 9 && bestmove.owntarget < bestmove.enemytarget)
                    {
                        tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget - 1, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
                    }
                    else
                    {
                        tempbestboard.playCard(bestmove.handcard, hc.position - 1, hc.entity, bestmove.enemytarget, bestmove.enemyEntitiy, bestmove.druidchoice, bestmove.owntarget, 0);
                    }
                }

                if (bestmove.minionplay)
                {
                    help.logg("min");
                    //.attackWithMinion(m, trgt.target, trgt.targetEntity, attackPenality);
                    Minion mm = tempbestboard.ownMinions.Find(x => x.entitiyID == bestmove.ownEntitiy);
                    help.logg("min");
                    tempbestboard.attackWithMinion(mm, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
                    help.logg("min");
                }

                if (bestmove.heroattack)
                {
                    help.logg("hero");
                    tempbestboard.attackWithWeapon(bestmove.enemytarget, bestmove.enemyEntitiy, 0);
                }

                if (bestmove.useability)
                {
                    help.logg("abi");
                    //.activateAbility(p.ownHeroAblility, trgt.target, trgt.targetEntity, abilityPenality);
                    tempbestboard.activateAbility(this.nextMoveGuess.ownHeroAblility, bestmove.enemytarget, bestmove.enemyEntitiy, 0);
                }
            }
            else
            {
                tempbestboard.mana = -1;
            }
            help.logg("-------------");
            help.logg("OwnMinions:");


            foreach (Minion m in tempbestboard.ownMinions)
            {
                help.logg(m.name + " id " + m.id + " zp " + m.zonepos + " " + " e:" + m.entitiyID + " " + " A:" + m.Angr + " H:" + m.Hp + " mH:" + m.maxHp + " rdy:" + m.Ready + " tnt:" + m.taunt + " frz:" + m.frozen + " silenced:" + m.silenced + " divshield:" + m.divineshild + " ptt:" + m.playedThisTurn + " wndfr:" + m.windfury + " natt:" + m.numAttacksThisTurn + " sil:" + m.silenced + " stl:" + m.stealth + " poi:" + m.poisonous + " imm:" + m.immune + " ex:" + m.exhausted + " chrg:" + m.charge);
                foreach (Enchantment e in m.enchantments)
                {
                    help.logg(e.CARDID + " " + e.creator + " " + e.controllerOfCreator);
                }
            }
            help.logg("EnemyMinions:");
            foreach (Minion m in tempbestboard.enemyMinions)
            {
                help.logg(m.name + " id " + m.id + " zp " + m.zonepos + " " + " e:" + m.entitiyID + " " + " A:" + m.Angr + " H:" + m.Hp + " mH:" + m.maxHp + " rdy:" + m.Ready + " tnt:" + m.taunt + " frz:" + m.frozen + " silenced:" + m.silenced + " divshield:" + m.divineshild + " wndfr:" + m.windfury + " sil:" + m.silenced + " stl:" + m.stealth + " poi:" + m.poisonous + " imm:" + m.immune + " ex:" + m.exhausted);
                foreach (Enchantment e in m.enchantments)
                {
                    help.logg(e.CARDID + " " + e.creator + " " + e.controllerOfCreator);
                }
            }


            foreach (Action bestmovee in bestboard.playactions)
            {
                help.logg("stepp");


                if (bestmovee != null) // save the guessed move, so we doesnt need to recalc!
                {
                    bestmovee.print();
                    if (bestmovee.cardplay)
                    {
                        help.logg("card");
                        //pf.playCard(c, hc.position - 1, hc.entity, trgt.target, trgt.targetEntity, 0, bestplace, cardplayPenality);
                        Handmanager.Handcard hc = tempbestboard.owncards.Find(x => x.entity == bestmovee.cardEntitiy);
                        if (bestmovee.owntarget >= 0 && bestmovee.enemytarget >= 0 && bestmovee.enemytarget <= 9 && bestmovee.owntarget < bestmovee.enemytarget)
                        {
                            tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget - 1, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
                        }
                        else
                        {
                            tempbestboard.playCard(bestmovee.handcard, hc.position - 1, hc.entity, bestmovee.enemytarget, bestmovee.enemyEntitiy, bestmovee.druidchoice, bestmovee.owntarget, 0);
                        }
                    }

                    if (bestmovee.minionplay)
                    {
                        help.logg("min");
                        //.attackWithMinion(m, trgt.target, trgt.targetEntity, attackPenality);
                        Minion mm = tempbestboard.ownMinions.Find(x => x.entitiyID == bestmovee.ownEntitiy);
                        help.logg("min");
                        tempbestboard.attackWithMinion(mm, bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
                        help.logg("min");
                    }

                    if (bestmovee.heroattack)
                    {
                        help.logg("hero");
                        tempbestboard.attackWithWeapon(bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
                    }

                    if (bestmovee.useability)
                    {
                        help.logg("abi");
                        //.activateAbility(p.ownHeroAblility, trgt.target, trgt.targetEntity, abilityPenality);
                        tempbestboard.activateAbility(this.nextMoveGuess.ownHeroAblility, bestmovee.enemytarget, bestmovee.enemyEntitiy, 0);
                    }
                }
                else
                {
                    tempbestboard.mana = -1;
                }
                help.logg("-------------");
                help.logg("OwnMinions:");
                foreach (Minion m in tempbestboard.ownMinions)
                {
                    help.logg(m.name + " id " + m.id + " zp " + m.zonepos + " " + " e:" + m.entitiyID + " " + " A:" + m.Angr + " H:" + m.Hp + " mH:" + m.maxHp + " rdy:" + m.Ready + " tnt:" + m.taunt + " frz:" + m.frozen + " silenced:" + m.silenced + " divshield:" + m.divineshild + " ptt:" + m.playedThisTurn + " wndfr:" + m.windfury + " natt:" + m.numAttacksThisTurn + " sil:" + m.silenced + " stl:" + m.stealth + " poi:" + m.poisonous + " imm:" + m.immune + " ex:" + m.exhausted + " chrg:" + m.charge);
                    foreach (Enchantment e in m.enchantments)
                    {
                        help.logg(e.CARDID + " " + e.creator + " " + e.controllerOfCreator);
                    }
                }
                help.logg("EnemyMinions:");
                foreach (Minion m in tempbestboard.enemyMinions)
                {
                    help.logg(m.name + " id " + m.id + " zp " + m.zonepos + " " + " e:" + m.entitiyID + " " + " A:" + m.Angr + " H:" + m.Hp + " mH:" + m.maxHp + " rdy:" + m.Ready + " tnt:" + m.taunt + " frz:" + m.frozen + " silenced:" + m.silenced + " divshield:" + m.divineshild + " wndfr:" + m.windfury + " sil:" + m.silenced + " stl:" + m.stealth + " poi:" + m.poisonous + " imm:" + m.immune + " ex:" + m.exhausted);
                    foreach (Enchantment e in m.enchantments)
                    {
                        help.logg(e.CARDID + " " + e.creator + " " + e.controllerOfCreator);
                    }
                }
            }
        }