Esempio n. 1
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);
        }
Esempio n. 2
0
        // Calc cumulative score for move buff
        float CalculateBuffScore(buffTuple buff, DeltemonClass curPlayerDelt)
        {
            float         tmpBuffScore = 0;
            DeltemonClass deltInBattle = State.OpponentState.DeltInBattle;

            if (buff.BuffType == buffType.Heal)
            {
                if (deltInBattle.health < 0.4 * deltInBattle.GPA)
                {
                    tmpBuffScore = 2;
                }
                else
                {
                    tmpBuffScore = 1;
                }

                tmpBuffScore *= buff.BuffAmount;
            }
            else
            {
                byte index = 0;
                switch (buff.BuffType)
                {
                case (buffType.Truth):
                    index = 1;
                    // Priority for if oppDelt has TruthAtk and it buffs oppDelt
                    if (buff.HasPositiveEffect && (deltInBattle.moveset.Exists(m => ((m.movType == moveType.TruthAtk) && (m.PPLeft > 0)))))
                    {
                        tmpBuffScore = 15 * buff.BuffAmount;
                    }
                    // Priority for if player has TruthAtk and it debuffs player
                    else if (!buff.HasPositiveEffect && (curPlayerDelt.moveset.Exists(m => ((m.movType == moveType.TruthAtk) && (m.PPLeft > 0)))))
                    {
                        tmpBuffScore = 15 * buff.BuffAmount;
                    }
                    break;

                case (buffType.Courage):
                    index = 2;
                    // Priority for if oppDelt has powerAtk and it debuffs player
                    if (!buff.HasPositiveEffect && (deltInBattle.moveset.Exists(m => ((m.movType == moveType.PowerAtk) && (m.PPLeft > 0)))))
                    {
                        tmpBuffScore = 15 * buff.BuffAmount;
                    }
                    // Priority for if player has powerAtk and it buffs oppDelt
                    else if (buff.HasPositiveEffect && (curPlayerDelt.moveset.Exists(m => ((m.movType == moveType.PowerAtk) && (m.PPLeft > 0)))))
                    {
                        tmpBuffScore = 15 * buff.BuffAmount;
                    }
                    break;

                case (buffType.Faith):
                    index = 3;
                    // Priority for if oppDelt has truthAtk and it debuffs player
                    if (!buff.HasPositiveEffect && (deltInBattle.moveset.Exists(m => ((m.movType == moveType.TruthAtk) && (m.PPLeft > 0)))))
                    {
                        tmpBuffScore = 15 * buff.BuffAmount;
                    }
                    // Priority for if player has truthAtk and it buffs oppDelt
                    else if (buff.HasPositiveEffect && (curPlayerDelt.moveset.Exists(m => ((m.movType == moveType.TruthAtk) && (m.PPLeft > 0)))))
                    {
                        tmpBuffScore = 15 * buff.BuffAmount;
                    }
                    break;

                case (buffType.Power):
                    index = 4;
                    // Priority for if oppDelt has PowerAtk and it buffs oppDelt
                    if (buff.HasPositiveEffect && (deltInBattle.moveset.Exists(m => ((m.movType == moveType.PowerAtk) && (m.PPLeft > 0)))))
                    {
                        tmpBuffScore = 15 * buff.BuffAmount;
                    }
                    // Priority for if player has PowerAtk and it debuffs player
                    else if (!buff.HasPositiveEffect && (curPlayerDelt.moveset.Exists(m => (m.movType == moveType.PowerAtk) && (m.PPLeft > 0))))
                    {
                        tmpBuffScore = 15 * buff.BuffAmount;
                    }
                    break;

                case (buffType.ChillToPull):
                    index = 5;
                    float oppCTP    = State.OpponentState.GetDeltBattleStat(DeltStat.ChillToPull);
                    float playerCTP = State.PlayerState.GetDeltBattleStat(DeltStat.ChillToPull);

                    // If opp speed is less than player's, and within an amendable range
                    // Note: Buff type does not matter in this context
                    if ((oppCTP < playerCTP) && (oppCTP > 0.80f * playerCTP))
                    {
                        tmpBuffScore = 15 * buff.BuffAmount;
                    }
                    break;
                }

                // If a buff/debuff has already affected the Delt, lower the priority of the buff/debuff
                if (buff.HasPositiveEffect && State.OpponentState.StatAdditions[index] > 0)
                {
                    tmpBuffScore *= 0.8f;
                }
                else if (!buff.HasPositiveEffect && State.OpponentState.StatAdditions[index] < 0)
                {
                    tmpBuffScore *= 0.8f;
                }
            }

            return(tmpBuffScore);
        }