예제 #1
0
            /// <summary>
            /// <para>
            /// This Generates a Crisis Level. Run this each turn in battle. Though in real game it
            /// runs when the menu pops up.
            /// </para>
            /// <para>-1 means no limit break. &gt;=0 has a limit break.</para>
            /// </summary>
            /// <returns>-1 - 4</returns>
            /// <remarks>https://finalfantasy.fandom.com/wiki/Crisis_Level</remarks>
            /// <remarks>TODO: Need to confirm the formula is correct via reverse</remarks>
            public sbyte GenerateCrisisLevel()
            {
                ushort current = CurrentHP();
                ushort max     = MaxHP();
                //if ((ID == Characters.Seifer_Almasy && CurrentHP() < (max * 84 / 100)))
                //{
                int HPMod       = CharacterStats.Crisis * 10 * current / max;
                int DeathBonus  = Memory.State.DeadPartyMembers() * 200 + 1600;
                int StatusBonus = (int)(Statuses0.Count() * 10);                  // I think this is status of all party members
                int RandomMod   = Memory.Random.Next(0, 255) + 160;
                int crisislevel = (StatusBonus + DeathBonus - HPMod) / RandomMod; // better random number?

                if (crisislevel == 5)
                {
                    CurrentCrisisLevel = 0;
                    return(CurrentCrisisLevel);
                }
                else if (crisislevel == 6)
                {
                    CurrentCrisisLevel = 1;
                    return(CurrentCrisisLevel);
                }
                else if (crisislevel == 7)
                {
                    CurrentCrisisLevel = 2;
                    return(CurrentCrisisLevel);
                }
                else if (crisislevel >= 8)
                {
                    CurrentCrisisLevel = 3;
                    return(CurrentCrisisLevel);
                }
                //}
                return(CurrentCrisisLevel = -1);
            }
예제 #2
0
            /// <summary>
            /// needs tested. should return the current crisis level. randomly -1 means no limit break. >=0 has a limit break.
            /// </summary>
            /// <returns>-1 - 4</returns>
            /// <remarks>https://finalfantasy.fandom.com/wiki/Crisis_Level</remarks>
            public sbyte CrisisLevel()
            {
                ushort current = CurrentHP();
                ushort max     = MaxHP();

                if (Critical() || (ID == Characters.Seifer_Almasy && CurrentHP() < (max * 84 / 100)))
                {
                    int HPMod       = CharacterStats.Crisis * 10 * current / max;
                    int DeathBonus  = Memory.State.DeadPartyMembers() * 200 + 1600;
                    int StatusBonus = (int)(Statuses0.Count() * 10);
                    int RandomMod   = random.Next(0, 255) + 160;
                    int crisislevel = (StatusBonus + DeathBonus - HPMod) / RandomMod;
                    if (crisislevel == 5)
                    {
                        return(0);
                    }
                    else if (crisislevel == 6)
                    {
                        return(1);
                    }
                    else if (crisislevel == 7)
                    {
                        return(2);
                    }
                    else if (crisislevel >= 8)
                    {
                        return(3);
                    }
                }
                return(-1);
            }