예제 #1
0
        public override void MulliganUpdate()
        {
            switch (mulliganPhase)
            {
            case "begin":
                Card[] cards = GameState.Get().GetPlayer(0).GetHandZone().GetCards().ToArray();
                foreach (Card card in cards)
                {
                    if (card.GetEntity().GetCardId() == "GAME_005")
                    {
                        continue;
                    }
                    ZConsole.LogLog(card.GetEntity().GetName());
                    if (card.GetEntity().GetCost() > 3)
                    {
                        HearthGem.ClickCard(card);
                    }
                }
                mulliganPhase = "click";
                break;

            case "click":
                MulliganManager.Get().GetMulliganButton().TriggerRelease();
                mulliganPhase = "end";
                break;

            case "end":
                break;
            }
        }
예제 #2
0
    public override void OnTagChanged(TagDelta change)
    {
        switch (((GAME_TAG)change.tag))
        {
        case GAME_TAG.STEP:
            if (change.newValue == 4)
            {
                MulliganManager.Get().BeginMulligan();
            }
            break;

        case GAME_TAG.NEXT_STEP:
            if (change.newValue == 6)
            {
                if (GameState.Get().IsMulliganManagerActive())
                {
                    GameState.Get().SetMulliganPowerBlocker(true);
                }
            }
            else if (((change.oldValue == 9) && (change.newValue == 10)) && GameState.Get().IsFriendlySidePlayerTurn())
            {
                TurnStartManager.Get().BeginPlayingTurnEvents();
            }
            break;
        }
        base.OnTagChanged(change);
    }
예제 #3
0
        /// <summary>
        /// On WaitForMulligan state
        /// </summary>
        /// <returns>Seconds to be delayed before next call.</returns>
        private double OnRockMulligan()
        {
            if (this.currentAction == null)
            {
                this.ShowRockInfo("Mulligan");
                this.actionId += 1;
                // Force update sessionId when starting a new game.
                this.sessionId = Guid.NewGuid().ToString();
                var scene            = this.pegasus.SnapshotScene(this.sessionId, this.actionId);
                var mulliganedAction = this.bot.GetMulliganAction(scene);

                this.currentAction = new RockEngineAction(this.pegasus, mulliganedAction.Objects, mulliganedAction.Slot);
            }

            if (this.currentAction.IsDone())
            {
                MulliganManager.Get().GetMulliganButton().TriggerRelease();
                var scene = this.pegasus.SnapshotScene(this.sessionId, this.actionId);
                this.bot.ReportActionResult(scene);
                return(5);
            }

            this.currentAction.ApplyAll();
            return(1);
        }
예제 #4
0
        public void Update()
        {
            GameState gs = GameState.Get();

            if (gs == null)
            {
                return;
            }
            var rah = RemoteActionHandler.Get();

            if (gs.IsMulliganManagerActive())
            {
                // TODO: set choices...
                MulliganManager.Get().GetMulliganButton().TriggerRelease();
            }

            if (gs.IsFriendlySidePlayerTurn())
            {
                if (gs.IsTurnStartManagerBlockingInput() == false)
                {
                    if (m_nextChooseOption == null)
                    {
                        return;
                    }
                    SendOption(m_nextChooseOption);
                    m_nextChooseOption = null;
                }
            }
        }
예제 #5
0
 internal MulliganData()
 {
     this.UserClass     = GameState.Get().GetFriendlySidePlayer().GetHero().GetClass();
     this.OpponentClass = GameState.Get().GetOpposingSidePlayer().GetHero().GetClass();
     this.Cards         = new List <Triton.Game.Abstraction.Card>();
     this.Mulligans     = new List <bool>();
     foreach (Triton.Game.Mapping.Card card in MulliganManager.Get().m_startingCards)
     {
         this.Cards.Add(new Triton.Game.Abstraction.Card(card));
         this.Mulligans.Add(false);
     }
 }
예제 #6
0
        /// <summary>
        /// Get current Pegasus Game State.
        /// </summary>
        /// <returns>The RockPegasusGameState.</returns>
        public RockPegasusGameState GetPegasusGameState()
        {
            GameState state = GameState.Get();

            if (state.IsBusy())
            {
                return(RockPegasusGameState.Blocking);
            }
            else if (state.IsGameOver())
            {
                return(RockPegasusGameState.GameOver);
            }
            else if (state.IsResponsePacketBlocked())
            {
                return(RockPegasusGameState.Blocking);
            }
            else if (state.IsBlockingPowerProcessor())
            {
                return(RockPegasusGameState.Blocking);
            }
            else if (state.IsMulliganPhase())
            {
                if (state.IsMulliganManagerActive() == false || MulliganManager.Get() == null || MulliganManager.Get().GetMulliganButton() == null || MulliganManager.Get().GetMulliganButton().IsEnabled() == false)
                {
                    return(RockPegasusGameState.Blocking);
                }

                FieldInfo filedinfo = MulliganManager.Get().GetType().GetField("m_waitingForUserInput", BindingFlags.NonPublic | BindingFlags.Instance);
                bool      iswaiting = (bool)filedinfo.GetValue(MulliganManager.Get());
                if (!iswaiting)
                {
                    return(RockPegasusGameState.Blocking);
                }

                return(RockPegasusGameState.WaitForMulligan);
            }
            else if (state.IsMulliganPhasePending())
            {
                return(RockPegasusGameState.Blocking);
            }
            else if (state.IsFriendlySidePlayerTurn() == true)
            {
                if (EndTurnButton.Get().IsInWaitingState())
                {
                    return(RockPegasusGameState.Blocking);
                }

                return(RockPegasusGameState.WaitForPlay);
            }

            return(RockPegasusGameState.None);
        }
예제 #7
0
 public static void ReplaceCards(IList <Card> cards)
 {
     /*for (var i = 0; i < cards.Count; i++)
      * {
      *  Card c = cards[i];
      *  if (c.GetEntity().GetCost() > 3)
      *  {
      *      MulliganManager.Get().ToggleHoldState(c);
      *  }
      * }*/
     MulliganManager.Get().EndMulligan();
     EndTurn();
 }
예제 #8
0
        public static void ReplaceCards()
        {
            var cards = MyPlayer.CardsInHand();

            foreach (var card in cards)
            {
                if (card.Cost >= 3)
                {
                    MulliganManager.Get().ToggleHoldState(card.Source);
                }
            }
            MulliganManager.Get().GetMulliganButton().TriggerRelease();
        }
예제 #9
0
파일: AIBot.cs 프로젝트: linuxaged/hsbot
        private void gameplay_mode()
        {
            GameState gs = GameState.Get();

            // If we're in mulligan
            if (gs.IsMulliganPhase())
            {
                if (mulligan_state == MulliganState.BEGIN)
                {
                    if (gs.IsMulliganManagerActive() && PrivateHacker.get_m_UIbuttons() != null)
                    {
                        mulligan();
                        mulligan_state = MulliganState.DO_END;
                        Delay(2000);
                    }
                }
                else if (mulligan_state == MulliganState.DO_END)
                {
                    MulliganManager.Get().AutomaticContinueMulligan();
                    mulligan_state = MulliganState.DONE;
                }
                return;
            }
            // If the game is over
            else if (gs.IsGameOver())
            {
                game_over();
            }
            // If it's our turn
            else if (gs.IsLocalPlayerTurn())
            {
                // If it was not our turn last tick
                if (!was_my_turn)
                {
                    // Wait extra time for turn to start
                    was_my_turn = true;
                    Delay(5000);
                    return;
                }

                run_ai();
            }
            else
            {
                was_my_turn = false;
            }

            // Reset variables
            mulligan_state = MulliganState.BEGIN;
        }
예제 #10
0
 private void Start()
 {
     if (MulliganManager.Get() != null)
     {
         Vector3 position = MulliganManager.Get().GetMulliganButton().transform.position;
         if (UniversalInputManager.UsePhoneUI != null)
         {
             base.transform.position = new Vector3(position.x + 1.8f, position.y, position.z);
         }
         else
         {
             base.transform.position = new Vector3(position.x, position.y, position.z - 1f);
         }
     }
 }
예제 #11
0
        private void OnRockMulligan()
        {
            if (GameState.Get().IsMulliganManagerActive() == false || MulliganManager.Get() == null || MulliganManager.Get().GetMulliganButton() == null || MulliganManager.Get().GetMulliganButton().IsEnabled() == false)
            {
                HoldBack(500);
                return;
            }

            FieldInfo filedinfo = MulliganManager.Get().GetType().GetField("m_waitingForUserInput", BindingFlags.NonPublic | BindingFlags.Instance);
            bool      iswaiting = (bool)filedinfo.GetValue(MulliganManager.Get());

            if (!iswaiting)
            {
                HoldBack(500);
                return;
            }

            if (MulliganState <= 0)
            {
                Notify("Mulligan");
                HoldBack(1000);
                Card[] cards = GameState.Get().GetFriendlySidePlayer().GetHandZone().GetCards().ToArray();
                foreach (Card current in cards)
                {
                    if (current.GetEntity().GetCardId() == "GAME_005")
                    {
                        continue;
                    }
                    if (current.GetEntity().GetCost() > 4)
                    {
                        HearthstoneClickCard(current);
                    }
                }
                MulliganState = 1;
                return;
            }
            if (MulliganState <= 1)
            {
                MulliganManager.Get().GetMulliganButton().TriggerRelease();
                MulliganState = 2;
                HoldBack(5000);
                return;
            }
            return;
        }
예제 #12
0
        public void DoMulligan()
        {
            //TODO toggle holding as needed
            //var cs = myPlayer.GetHandZone().GetCards();
            //Log.say("Mulligan with " + cs.Count + " cards ");
            //MulliganManager.Get().ToggleHoldState(cs[0]);
            //MulliganManager.Get().SetAllMulliganCardsToHold();

            // End mulligan
            Log.log("Handling mulligan");
            Thread.Sleep(1000 * 5);
            //MulliganManager.Get().SetAllMulliganCardsToHold();
            InputManager.Get().DoEndTurnButton();
            TurnStartManager.Get().BeginListeningForTurnEvents();
            MulliganManager.Get().EndMulliganEarly();
            Thread.Sleep(1000 * 5);
            Log.log("Done handling mulligan");
        }
예제 #13
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");
        }
예제 #14
0
        /// <summary>
        /// On WaitForMulligan state
        /// </summary>
        /// <returns>Seconds to be delayed before next call.</returns>
        private double OnRockMulligan()
        {
            if (this.currentAction == null)
            {
                this.ShowRockInfo("Mulligan");
                var scene            = this.pegasus.SnapshotScene();
                var mulliganedAction = this.bot.GetMulliganAction(scene);

                this.currentAction = new RockEngineAction(this.pegasus, mulliganedAction.Objects, mulliganedAction.Slot);
            }

            if (this.currentAction.IsDone())
            {
                MulliganManager.Get().GetMulliganButton().TriggerRelease();
                return(5);
            }

            this.currentAction.ApplyAll();
            return(1);
        }
예제 #15
0
            public static void OnMessageRecv(Message msg)
            {
                var gs = GameState.Get();

                gs.SendChoices();
                //MulliganManager.Get().GetMulliganButton().TriggerRelease();
                MulliganManager.Get().EndMulligan();

                //MulliganManager.Get().EndMulligan();

                //GameMgr.Get().FindGame(PegasusShared.GameType.GT_UNRANKED, 2, deckID, 0);
                //GameMgr.Get().CancelFindGame();

                //GameMgr.Get().FindGame(PegasusShared.GameType.GT_UNRANKED, 2, deckID, 0);
                //SceneMgr.Get().SetNextMode(SceneMgr.Mode.ADVENTURE);

                //gs.SetSelectedOption(1);
                //gs.SetSelectedOptionPosition(1);
                //gs.SendOption();
            }
예제 #16
0
        // 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);
        }
예제 #17
0
 private void Update()
 {
     if (this.m_remainingTimeSet)
     {
         float f    = this.ComputeCountdownRemainingSec();
         int   num2 = Mathf.RoundToInt(f);
         if (num2 < 0)
         {
             num2 = 0;
         }
         this.m_timeText.Text = string.Format(":{0:D2}", num2);
         if (f <= 0f)
         {
             if (MulliganManager.Get() != null)
             {
                 MulliganManager.Get().AutomaticContinueMulligan();
             }
             else
             {
                 this.SelfDestruct();
             }
         }
     }
 }
예제 #18
0
        void Update()
        {
            Reflection.SetField(InactivePlayerKicker.Get(), "m_activityDetected", true);

            SceneMgr.Mode mode = SceneMgr.Get().GetMode();

            if (mode != lastmode)
            {
                if (lastmode != SceneMgr.Mode.GAMEPLAY && mode == SceneMgr.Mode.GAMEPLAY)
                {
                    bot.Reset();
                }
                lastmode = mode;
                ZConsole.Get().HandleLog(mode.ToString(), "SceneMode", LogType.Log);
                clickplaygame = false;
            }
            if (mode == SceneMgr.Mode.TOURNAMENT)
            {
                if (SceneMgr.Get().IsInGame() || DeckPickerTrayDisplay.Get() == null || DeckPickerTrayDisplay.Get().GetSelectedDeckID() == 0)
                {
                    return;
                }
                if (!clickplaygame)
                {
                    Reflection.InvokeMethod(DeckPickerTrayDisplay.Get(), "PlayGame");
                    clickplaygame = true;
                }
            }
            if (mode == SceneMgr.Mode.GAMEPLAY)
            {
                GameState state     = GameState.Get();
                string    gamestate = "invalid";
                if (state != null)
                {
                    if (state.IsBlockingServer())
                    {
                        return;
                    }
                    if (state.IsMulliganPhase())
                    {
                        gamestate = "mulligan";
                    }
                    //else if (state.IsLocalPlayerTurn())
                    //	gamestate = "turn";
                    else if (state.IsGameOver())
                    {
                        gamestate = "over";
                    }
                    else
                    {
                        gamestate = "invalid";
                    }
                }
                if (gamestate != lastgamestate)
                {
                    if (gamestate == "turn")
                    {
                        bot.TurnBegin();
                    }
                    lastgamestate = gamestate;
                }
                ZConsole.LogLog(gamestate);
                switch (gamestate)
                {
                case "mulligan":
                    if (GameState.Get().IsMulliganManagerActive() && MulliganManager.Get() != null &&
                        MulliganManager.Get().GetMulliganButton() != null &&
                        MulliganManager.Get().GetMulliganButton().IsEnabled() &&
                        (bool)Reflection.GetField(MulliganManager.Get(), "m_waitingForUserInput"))
                    {
                        bot.MulliganUpdate();
                    }
                    break;

                case "turn":
                    if (GameState.Get().IsMainPhase() &&
                        ((GameEntity)Reflection.GetField(GameState.Get(), "m_gameEntity")).GetTag <TAG_STEP>(GAME_TAG.STEP) == TAG_STEP.MAIN_ACTION)
                    {
                        bot.TurnUpdate();
                    }
                    break;

                case "over":
                    CleanUp();
                    break;

                case "invalid":
                    //CleanUp();
                    break;
                }
            }
        }
예제 #19
0
 public void PlayHoggerLine()
 {
     if (MulliganManager.Get() == null)
     {
     }
 }
예제 #20
0
    private void OnFriendlyPlayerTagChanged(TagDelta change)
    {
        GAME_TAG tag = (GAME_TAG)change.tag;

        switch (tag)
        {
        case GAME_TAG.CURRENT_SPELLPOWER:
            break;

        case GAME_TAG.TEMP_RESOURCES:
        {
            int num  = change.oldValue - this.m_usedTempMana;
            int num2 = change.newValue - change.oldValue;
            if (num2 < 0)
            {
                this.m_usedTempMana += num2;
            }
            if (this.m_usedTempMana < 0)
            {
                this.m_usedTempMana = 0;
            }
            if (num < 0)
            {
                num = 0;
            }
            int numCrystals = (change.newValue - num) - this.m_usedTempMana;
            if (numCrystals > 0)
            {
                this.AddTempManaCrystal(numCrystals);
            }
            else
            {
                this.DestroyTempManaCrystal(-numCrystals);
            }
            return;
        }

        case GAME_TAG.OVERLOAD_OWED:
            this.HandleSameTurnOverloadChanged(change.newValue - change.oldValue);
            return;

        case GAME_TAG.CURRENT_PLAYER:
            if (change.newValue == 1)
            {
                ManaCrystalMgr.Get().OnCurrentPlayerChanged();
                this.m_queuedSpentMana = 0;
                if (GameState.Get().IsMainPhase())
                {
                    TurnStartManager.Get().BeginListeningForTurnEvents();
                }
            }
            return;

        case GAME_TAG.RESOURCES_USED:
        {
            int num4 = change.oldValue + this.m_queuedSpentMana;
            int num5 = change.newValue - change.oldValue;
            if (num5 > 0)
            {
                this.m_queuedSpentMana -= num5;
            }
            if (this.m_queuedSpentMana < 0)
            {
                this.m_queuedSpentMana = 0;
            }
            int shownChangeAmount = (change.newValue - num4) + this.m_queuedSpentMana;
            ManaCrystalMgr.Get().UpdateSpentMana(shownChangeAmount);
            return;
        }

        case GAME_TAG.RESOURCES:
            if (change.newValue <= change.oldValue)
            {
                this.DestroyManaCrystal(change.oldValue - change.newValue);
                return;
            }
            if (!GameState.Get().IsTurnStartManagerActive() || !this.IsFriendlySide())
            {
                this.AddManaCrystal(change.newValue - change.oldValue);
                return;
            }
            TurnStartManager.Get().NotifyOfManaCrystalGained(change.newValue - change.oldValue);
            return;

        default:
            switch (tag)
            {
            case GAME_TAG.SPELLPOWER_DOUBLE:
            case GAME_TAG.HEALING_DOUBLE:
                break;

            case GAME_TAG.MULLIGAN_STATE:
                if ((change.newValue == 4) && (MulliganManager.Get() == null))
                {
                    foreach (Card card in this.GetHandZone().GetCards())
                    {
                        card.GetActor().TurnOnCollider();
                    }
                }
                return;

            default:
                if ((tag == GAME_TAG.OVERLOAD_LOCKED) && (change.newValue < change.oldValue))
                {
                    this.UnlockCrystals(change.oldValue - change.newValue);
                }
                return;
            }
            break;
        }
        List <Card> cards = this.GetHandZone().GetCards();

        for (int i = 0; i < cards.Count; i++)
        {
            if (cards[i].GetEntity().IsSpell())
            {
                cards[i].GetActor().UpdatePowersText();
            }
        }
    }
예제 #21
0
    public override void OnTagChanged(TagDelta change)
    {
        if (this.IsFriendlySide())
        {
            this.OnFriendlyPlayerTagChanged(change);
        }
        else
        {
            this.OnOpposingPlayerTagChanged(change);
        }
        GAME_TAG tag = (GAME_TAG)change.tag;

        switch (tag)
        {
        case GAME_TAG.LOCK_AND_LOAD:
        {
            Card heroCard = this.GetHeroCard();
            this.ToggleActorSpellOnCard(heroCard, change, SpellType.LOCK_AND_LOAD);
            return;
        }

        case GAME_TAG.SHADOWFORM:
        {
            Card card5 = this.GetHeroCard();
            this.ToggleActorSpellOnCard(card5, change, SpellType.SHADOWFORM);
            return;
        }
        }
        if ((tag != GAME_TAG.RESOURCES_USED) && (tag != GAME_TAG.RESOURCES))
        {
            if (tag == GAME_TAG.PLAYSTATE)
            {
                if (change.newValue == 8)
                {
                    this.PlayConcedeEmote();
                }
                return;
            }
            if (tag == GAME_TAG.COMBO_ACTIVE)
            {
                foreach (Card card in this.GetHandZone().GetCards())
                {
                    card.UpdateActorState();
                }
                return;
            }
            if (tag != GAME_TAG.TEMP_RESOURCES)
            {
                if (tag == GAME_TAG.MULLIGAN_STATE)
                {
                    if ((change.newValue == 4) && (MulliganManager.Get() != null))
                    {
                        MulliganManager.Get().ServerHasDealtReplacementCards(this.IsFriendlySide());
                    }
                    return;
                }
                if (tag == GAME_TAG.STEADY_SHOT_CAN_TARGET)
                {
                    Card heroPowerCard = this.GetHeroPowerCard();
                    this.ToggleActorSpellOnCard(heroPowerCard, change, SpellType.STEADY_SHOT_CAN_TARGET);
                    return;
                }
                if (tag == GAME_TAG.CURRENT_HEROPOWER_DAMAGE_BONUS)
                {
                    if (this.IsHeroPowerAffectedByBonusDamage())
                    {
                        Card card3 = this.GetHeroPowerCard();
                        this.ToggleActorSpellOnCard(card3, change, SpellType.CURRENT_HEROPOWER_DAMAGE_BONUS);
                    }
                    return;
                }
                return;
            }
        }
        if (!GameState.Get().IsTurnStartManagerActive() || !this.IsFriendlySide())
        {
            this.UpdateManaCounter();
        }
    }
 private bool CheckCriticalAssetLoads()
 {
     if (!this.m_criticalAssetsLoaded)
     {
         if (Board.Get() == null)
         {
             return(false);
         }
         if (BoardCameras.Get() == null)
         {
             return(false);
         }
         if (BoardStandardGame.Get() == null)
         {
             return(false);
         }
         if (GameMgr.Get().IsTutorial() && (BoardTutorial.Get() == null))
         {
             return(false);
         }
         if (MulliganManager.Get() == null)
         {
             return(false);
         }
         if (TurnStartManager.Get() == null)
         {
             return(false);
         }
         if (TargetReticleManager.Get() == null)
         {
             return(false);
         }
         if (GameplayErrorManager.Get() == null)
         {
             return(false);
         }
         if (EndTurnButton.Get() == null)
         {
             return(false);
         }
         if (BigCard.Get() == null)
         {
             return(false);
         }
         if (CardTypeBanner.Get() == null)
         {
             return(false);
         }
         if (TurnTimer.Get() == null)
         {
             return(false);
         }
         if (CardColorSwitcher.Get() == null)
         {
             return(false);
         }
         if (RemoteActionHandler.Get() == null)
         {
             return(false);
         }
         if (ChoiceCardMgr.Get() == null)
         {
             return(false);
         }
         if (InputManager.Get() == null)
         {
             return(false);
         }
         this.m_criticalAssetsLoaded = true;
         this.ProcessQueuedPowerHistory();
     }
     return(true);
 }
예제 #23
0
 public static void EndMulligan()
 {
     MulliganManager.Get().EndMulligan();
 }
예제 #24
0
 public static List <MulliganReplaceLabel> get_m_UIbuttons()
 {
     return((List <MulliganReplaceLabel>)get_private_field(MulliganManager.Get(), "m_UIbuttons"));
 }