コード例 #1
0
ファイル: AIBot.cs プロジェクト: linuxaged/hsbot
        // Called when a game is ended
        private void game_over()
        {
            // Write why the game ended
            if (API.getEnemyPlayer().GetHero().GetRemainingHP() <= 0)
            {
                Log.say("Victory!");
            }
            else if (API.getOurPlayer().GetHero().GetRemainingHP() <= 0)
            {
                Log.say("Defeat...");
            }
            else
            {
                Log.say("Draw..?");
            }

            // Click through end screen info (rewards, and such)
            if (EndGameScreen.Get() != null)
            {
                EndGameScreen.Get().m_hitbox.TriggerRelease();

                //EndGameScreen.Get().ContinueEvents();
            }

            // Delay 10 seconds after this method
            Delay(10000);
        }
コード例 #2
0
ファイル: AIBot.cs プロジェクト: zanzo420/HearthstoneBot
        // Called when a game is ended
        private void game_over()
        {
            // Delay 10 seconds
            Delay(10000);
            // Try to move on
            try
            {
                // Write why the game ended
                if (API.getEnemyPlayer().GetHero().GetRemainingHP() <= 0)
                {
                    Log.say("Victory!");
                }
                else if (API.getOurPlayer().GetHero().GetRemainingHP() <= 0)
                {
                    Log.say("Defeat...");
                }
                else
                {
                    Log.say("Draw..?");
                }

                // Click through end screen info (rewards, and such)
                if (EndGameScreen.Get() != null)
                {
                    EndGameScreen.Get().m_hitbox.TriggerRelease();

                    //EndGameScreen.Get().ContinueEvents();
                }
            }
            catch (Exception e)
            {
                Log.error("Exception: In endgame function");
                Log.error(e.ToString());
            }
        }
コード例 #3
0
ファイル: AIBot.cs プロジェクト: linuxaged/hsbot
        // Called to invoke AI
        private void run_ai()
        {
            // Temporarily disable reticle so mouse doesn't have to stay in window
            TargetReticleManager trm = TargetReticleManager.Get();

            PrivateHacker.set_TargetReticleManager_s_instance(null);

            try
            {
                // Perform queued actions first
                if (queuedActions.Count > 0)
                {
                    // Dequeue first execution and perform it
                    Action action = queuedActions[0];
                    queuedActions.RemoveAt(0);
                    int delay = api.PerformAction(action);

                    // Delay between each action
                    Delay(delay);
                    return;
                }

                // Get hand cards
                var cards = API.getOurPlayer().GetHandZone().GetCards().ToList <Card>();

                // Get initial actions to perform
                var actions = api.turn(cards);

                // Queue up these actions
                queuedActions.AddRange(actions);

                if (queuedActions.Count == 0)
                {
                    // Done with turn actions
                    Log.log("Ending turn");
                    end_turn();
                }
            }
            catch (Exception e)
            {
                Log.error("Exception in run_ai: " + e.Message);
                Log.error(e.ToString());
            }

            // Re-enable TargetReticleManager
            PrivateHacker.set_TargetReticleManager_s_instance(trm);
        }
コード例 #4
0
ファイル: AIBot.cs プロジェクト: linuxaged/hsbot
        // Return whether Mulligan was done
        private void mulligan()
        {
            // Get hand cards
            List <Card> cards = API.getOurPlayer().GetHandZone().GetCards().ToList <Card>();
            // Ask the AI scripting system, to figure which cards to replace
            List <Card> replace = api.mulligan(cards);

            // Toggle them as replaced
            MulliganManager mm = MulliganManager.Get();

            foreach (Card current in replace)
            {
                Log.log(current.ToString());
                mm.ToggleHoldState(current);
            }

            // Report progress
            Log.log("Mulligan Ended : " + replace.Count + " cards changed");
        }
コード例 #5
0
ファイル: AIBot.cs プロジェクト: zanzo420/HearthstoneBot
        // Return whether Mulligan was done
        private bool mulligan()
        {
            // Check that the button exists and is enabled
            if (GameState.Get().IsMulliganManagerActive() == false ||
                MulliganManager.Get() == null /*||
                                               * MulliganManager.Get().GetMulliganButton() == null ||
                                               * MulliganManager.Get().GetMulliganButton().IsEnabled() == false*/)
            {
                return(false);
            }

            // Get hand cards
            List <Card> cards = API.getOurPlayer().GetHandZone().GetCards().ToList <Card>();
            // Ask the AI scripting system, to figure which cards to replace
            List <Card> replace = api.mulligan(cards);

            if (replace == null)
            {
                return(false);
            }

            // Toggle them as replaced
            foreach (Card current in replace)
            {
                MulliganManager.Get().ToggleHoldState(current);
            }

            // End mulligan
            MulliganManager.Get().EndMulligan();
            end_turn();

            // Report progress
            Log.say("Mulligan Ended : " + replace.Count + " cards changed");
            // Delay 5 seconds
            Delay(5000);
            return(true);
        }