Пример #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 Start()
 {
     State         = new BattleState();
     SetUp         = new BattleSetUp(State);
     TurnProcess   = new BattleTurnProcess(State);
     MoveSelection = new BattleMoveSelection(State);
     Animator      = new BattleAnimator(State, PlayerDeltAnim, OppDeltAnim, PlayerSlideIn, OppSlideIn);
     BattleUI.Initialize(TurnProcess, State);
 }
Пример #3
0
        void PrepareBattleState(BattleType type, BattleAI AI)
        {
            // Do setup common to all battles
            State.Reset();
            State.Type       = type;
            State.OpponentAI = AI;

            // REFACTOR_TODO: Queue the beginning of battle
            BattleAnimator animator = BattleManager.Inst.Animator;

            BattleManager.AddToBattleQueue(enumerator: animator.DeltAnimation("SlideOut", true));
            BattleManager.AddToBattleQueue(enumerator: animator.DeltAnimation("SlideOut", false));
        }
Пример #4
0
        // REFACTOR_TODO: Figure out whether to wait on these animations
        // or whether it would be easier to do your own animation coroutines
        // Player throws a ball at the opposing (hopefully wild) Delt
        public override void ExecuteAction()
        {
            // If not a wild battle, Trainer bats away ball in disgust
            if (State.IsTrainer)
            {
                ThrowBallTrainerReaction();
                return;
            }

            BattleManager.AddToBattleQueue("You threw a " + Ball.itemName + "!");

            float catchChance = GetCatchChance(Ball, State.OpponentState.DeltInBattle);

            int            ballRattles    = GetNumberOfBallRattles(catchChance);
            BattleAnimator battleAnimator = BattleManager.Inst.Animator;

            // Trigger animations
            BattleManager.AddToBattleQueue(enumerator: battleAnimator.BallRattles(ballRattles));
            BattleManager.AddToBattleQueue(enumerator: battleAnimator.DeltAnimation("ThrowBall", false));
            BattleManager.AddToBattleQueue(action: () => SoundEffectManager.Inst.PlaySoundImmediate("BallTink"));

            BattleManager.AddToBattleQueue(enumerator: battleAnimator.DeltAnimation("FadeOut", false));

            // REFACTOR_TODO: Break up the animation so we call each rattle at these stages
            BattleManager.AddToBattleQueue(action: () => SoundEffectManager.Inst.PlaySoundImmediate("BallRattle2"));

            // Play sounds for ball shakes
            if (ballRattles > 1)
            {
                BattleManager.AddToBattleQueue(action: () => SoundEffectManager.Inst.PlaySoundImmediate("BallRattle1"));
            }
            if (ballRattles > 2)
            {
                BattleManager.AddToBattleQueue(action: () => SoundEffectManager.Inst.PlaySoundImmediate("BallRattle2"));
            }
            if (ballRattles > 3) // Capture Delt
            {
                SoundEffectManager.Inst.PlaySoundImmediate("BallClick");
                // REFACTOR_TODO: Set win condition on battle
                CaptureDelt();
            }
            else
            {
                BattleManager.AddToBattleQueue(enumerator: battleAnimator.DeltAnimation("BallReleaseFadeIn", false));
                BattleManager.AddToBattleQueue(State.OpponentState.DeltInBattle.nickname + " escaped!");
            }
        }
Пример #5
0
        void PerformMoveDamage()
        {
            Effectiveness  effectiveness = Move.GetEffectivenessAgainst(DefendingDelt);
            BattleAnimator animator      = BattleManager.Inst.Animator;

            BattleManager.AddToBattleQueue(enumerator: animator.DeltAnimation("Attack", IsPlayer));
            // yield return new WaitForSeconds(0.4f); // REFACTOR_TODO: Animations added to the queue

            bool  isCrit    = false;
            float rawDamage = Move.GetMoveDamage(AttackingDelt, DefendingDelt, State, IsPlayer);

            // If a critical hit
            if (Random.Range(0, 100) <= Move.critChance)
            {
                rawDamage = rawDamage * 1.75f;
                isCrit    = true;
            }

            // Multiply by random number from 0.85-1.00
            rawDamage = rawDamage * (0.01f * (float)Random.Range(85, 100));

            // Return final damage
            DefendingDelt.health = DefendingDelt.health - rawDamage;

            BattleManager.AddToBattleQueue(enumerator: animator.TriggerHitAnimation(IsPlayer, effectiveness));
            BattleManager.AddToBattleQueue(enumerator: animator.AnimateHurtDelt(!IsPlayer));

            if (isCrit)
            {
                BattleManager.AddToBattleQueue(message: "It's a critical hit!");
            }

            if (effectiveness != Effectiveness.Average)
            {
                BattleManager.AddToBattleQueue(message: GetEffectivenessMessage(effectiveness));
            }

            // If Delt passed out
            if (DefendingDelt.health <= 0)
            {
                DefendingDelt.health = 0;
                BattleManager.AddToBattleQueue(message: DefendingDelt.nickname + " has DA'd!");
                BattleManager.Inst.StatusChange(!IsPlayer, statusType.DA);
            }
        }
Пример #6
0
        void PerformMoveBuff(buffTuple buff, DeltemonClass buffedDelt)
        {
            DeltStat       stat        = GetDeltStatFromBuffT(buff.BuffType);
            bool           isPlayer    = buffedDelt == State.PlayerState.DeltInBattle;
            float          valueChange = buff.BuffAmount * 0.02f * buffedDelt.GetStat(stat) + buff.BuffAmount;
            string         buffMessage = string.Format("{0}'s {1} stat went {2} {3}!", buffedDelt.nickname, stat, buff.BuffAmount > 5 ? "waaay" : "", buff.HasPositiveEffect ? "up" : "down");
            BattleAnimator animator    = BattleManager.Inst.Animator;

            State.ChangeStatAddition(isPlayer, stat, valueChange);

            if (buff.HasPositiveEffect)
            {
                valueChange *= -1;
                BattleManager.AddToBattleQueue(enumerator: animator.DeltAnimation("Debuff", isPlayer));
            }
            else
            {
                BattleManager.AddToBattleQueue(enumerator: animator.DeltAnimation("Buff", isPlayer));
            }
            BattleManager.AddToBattleQueue(message: buffMessage);
        }