Пример #1
0
        IEnumerator CheckAttackingDeltStatus(PlayerBattleState player, bool isPlayer)
        {
            DeltemonClass  attacker = player.DeltInBattle;
            BattleAnimator animator = BattleManager.Inst.Animator;

            if (!AttackingStatusEffects.Contains(attacker.curStatus))
            {
                yield break;
            }

            StatusAffectData statusData = GetAttackingStatusEffect(attacker.curStatus);

            BattleManager.AddToBattleQueue(
                message: attacker.nickname + statusData.StatusActiveText,
                enumerator: animator.DeltAnimation(statusData.AnimationAndSoundKey, isPlayer)
                );

            if (attacker.curStatus != statusType.Drunk)
            {
                // If Delt comes down
                if (Random.Range(0, 100) <= statusData.ChanceToRemove)
                {
                    BattleManager.AddToBattleQueue(attacker.nickname + statusData.StatusRemovalText);
                    BattleManager.Inst.StatusChange(isPlayer, statusType.None);
                }
                else
                {
                    BattleManager.AddToBattleQueue(attacker.nickname + statusData.StatusContinueText);
                }
            }
            else
            {
                // If Delt hurts himself
                if (Random.Range(0, 100) <= 30)
                {
                    attacker.health = attacker.health - (attacker.GPA * 0.05f);
                    BattleManager.AddToBattleQueue(enumerator: animator.DeltAnimation("Hurt", isPlayer));
                    BattleManager.AddToBattleQueue(attacker.nickname + " hurt itself in it's drunkeness!");

                    // REFACTOR_TODO: Find proper location for this
                    //yield return BattleManager.Inst.StartCoroutine(BattleManager.Inst.Animator.AnimateHurtDelt(isPlayer));

                    // Player DA's // REFACTOR_TODO: This should be in the hurt function
                    if (attacker.health <= 0)
                    {
                        attacker.health = 0;
                        BattleManager.AddToBattleQueue(attacker.nickname + " has DA'd for being too Drunk!");
                        BattleManager.Inst.StatusChange(isPlayer, statusType.DA);
                    }
                }
                // Attacker relieved from Drunk status
                else if (Random.Range(0, 100) <= 27)
                {
                    BattleManager.AddToBattleQueue(attacker.nickname + " has sobered up!");
                    BattleManager.Inst.StatusChange(isPlayer, statusType.None);
                }
            }
        }
Пример #2
0
        void CheckPostMoveItemEffects(PlayerBattleState player, bool isPlayer)
        {
            DeltemonClass delt = player.DeltInBattle;

            if (delt.item != null && delt.item.statUpgrades[0] > 0)
            {
                BattleManager.AddToBattleQueue(delt.nickname + " used it's " + delt.item.itemName + "...");
                // REFACTOR_TODO: Heal function
                //BattleManager.Inst.StartCoroutine(BattleManager.Inst.AnimateHealDelt(true));
            }
        }
Пример #3
0
        void InitialSwitchIn(bool isPlayer)
        {
            PlayerBattleState playerState  = State.GetPlayerState(isPlayer);
            DeltemonClass     startingDelt = State.PlayerState.Delts.Find(delt => delt.curStatus != statusType.DA);

            playerState.ResetStatAdditions();
            playerState.DeltInBattle = startingDelt;
            BattleManager.Inst.BattleUI.PopulateBattlingDeltInfo(isPlayer, startingDelt);
            BattleManager.AddToBattleQueue(
                action: () => BattleManager.Inst.BattleUI.SetDeltImageActive(isPlayer),
                enumerator: BattleManager.Inst.Animator.DeltSlideIn(isPlayer)
                );
        }
Пример #4
0
        // Check loss condition, select new Delt if still playing
        void checkLoss(bool isPlayer)
        {
            BattleManager.Inst.BattleUI.UpdateTrainerPosseBalls();

            PlayerBattleState playerState = State.GetPlayerState(isPlayer);

            if (playerState.HasLost())
            {
                // Loss condition
                if (isPlayer)
                {
                    BattleManager.Inst.PlayerWinBattle();
                }
                else
                {
                    BattleManager.Inst.PlayerLoseBattle();
                }
            }
            else if (isPlayer)
            {
                // Player must choose available Delt for switch in
                BattleManager.AddToBattleQueue(
                    State.GetPlayerName(isPlayer) + " must choose another Delt!",
                    () => UIManager.Inst.PosseUI.Open()
                    ); // REFACTOR_TODO: Should this call happen here?
            }
            else
            {
                // AI chooses switch in
                int           score    = -1000;
                DeltemonClass switchIn = ((TrainerAI)State.OpponentAI).FindSwitchIn(out score);

                if (switchIn != null)
                {
                    new SwitchDeltAction(State, switchIn).ExecuteAction();
                }
                else
                {
                    BattleManager.Inst.PlayerWinBattle();
                }
            }

            if (!isPlayer) // IE. Opponent's Delt has DA'd
            {
                AwardAVsToPlayerDelt();
                AwardXP();

                // REFACTOR_TODO: Return defeated wild delts to wild pool
                // REFACTOR_TODO: Do I need to do this once DeltemonClass is no longer a Monobehavior?
            }
        }
Пример #5
0
        void CheckPostMoveStatusEffects(PlayerBattleState player, bool isPlayer)
        {
            DeltemonClass delt = player.DeltInBattle;

            // Opp gets hurt by negative status if not DA'd
            if (PostMoveStatusEffects.Contains(delt.curStatus))
            {
                // REFACTOR_TODO: Hurt function
                delt.health -= (delt.GPA * 0.125f);
                if (delt.health < 0)
                {
                    delt.health = 0;
                }

                StatusAffectData statusEffect = GetPostMoveStatusEffect(delt.curStatus);

                // If opp Delt is Roasted
                if (delt.curStatus == statusType.Roasted)
                {
                    BattleManager.AddToBattleQueue(enumerator: BattleManager.Inst.Animator.DeltAnimation(statusEffect.AnimationAndSoundKey, isPlayer));
                    BattleManager.AddToBattleQueue(delt.nickname + statusEffect.StatusActiveText);
                }

                // REFACTOR_TODO: Hurt function
                // Animate hurting opp Delt
                //yield return BattleManager.Inst.StartCoroutine(BattleManager.Inst.hurtDelt(false));

                // REFACTOR_TODO: Hurt function
                // If opp Delt passed out
                if (delt.health == 0)
                {
                    BattleManager.AddToBattleQueue(delt.nickname + " has DA'd!");
                    BattleManager.Inst.StatusChange(false, statusType.DA);

                    // Opponent loses/selects another Delt
                    //checkLoss(false);
                    //if (playerWon)
                    //{
                    //    yield break;
                    //}
                }
            }
        }
Пример #6
0
        // Switching out Delts, loading into Battle UI, clearing temporary battle stats
        public override void ExecuteAction()
        {
            DeltemonClass     switchOut   = IsPlayer ? State.PlayerState.DeltInBattle : State.OpponentState.DeltInBattle;
            PlayerBattleState playerState = State.GetPlayerState(IsPlayer);

            // Clear the temporary stats of the Delt
            playerState.ResetStatAdditions();

            if (switchOut != null)
            {
                BattleManager.AddToBattleQueue(enumerator: BattleManager.Inst.Animator.DeltSlideOut(IsPlayer));
            }

            playerState.DeltInBattle = SwitchIn;

            BattleManager.Inst.BattleUI.PopulateBattlingDeltInfo(IsPlayer, SwitchIn);

            // Animate Delt coming in
            BattleManager.AddToBattleQueue(enumerator: BattleManager.Inst.Animator.DeltSlideIn(IsPlayer));

            // If it is not first turn, do slide in animation
            if (switchOut != null)
            {
                BattleManager.AddToBattleQueue(SwitchIn.nickname + " has been switched in for " + switchOut.nickname);
            }

            // Add stat upgrades for Delt's item
            if (SwitchIn.item != null)
            {
                for (int i = 1; i < 6; i++)
                {
                    if (SwitchIn.item.statUpgrades[i] == 0)
                    {
                        continue;
                    }

                    BattleManager.AddToBattleQueue(enumerator: BattleManager.Inst.Animator.DeltAnimation("Buff", IsPlayer));
                    BattleManager.AddToBattleQueue(string.Format("{0}'s {1} raised it's {2} stat!", SwitchIn.nickname, SwitchIn.item.itemName, ((DeltStat)i).ToStatString()));
                }
            }
        }
Пример #7
0
 public BattleState()
 {
     PlayerState   = new PlayerBattleState();
     OpponentState = new PlayerBattleState();
 }