示例#1
0
        public static UInt16 GetRandomBtlID(UInt32 player)
        {
            UInt16[] array = new UInt16[4];
            UInt16   num   = 0;

            if (player != 0u)
            {
                player = 1u;
            }
            for (BTL_DATA next = FF9StateSystem.Battle.FF9Battle.btl_list.next; next != null; next = next.next)
            {
                if ((UInt32)next.bi.player == player && !Status.checkCurStat(next, 256u) && next.bi.target != 0)
                {
                    UInt16[] array2 = array;
                    UInt16   num2   = num;
                    num = (UInt16)(num2 + 1);
                    array2[(Int32)num2] = next.btl_id;
                }
            }
            if (num == 0)
            {
                return(0);
            }
            return(array[Comn.random8() % (Int32)num]);
        }
示例#2
0
        public static void SetBonus(ENEMY_TYPE et)
        {
            BONUS btlBonus = battle.btl_bonus;

            btlBonus.gil += et.bonus.gil;
            btlBonus.exp += et.bonus.exp;
            Byte num1 = 0;

            while (num1 < 16 && btlBonus.item[num1] != Byte.MaxValue)
            {
                ++num1;
            }
            if (num1 < 16)
            {
                if (Comn.random8() < 1 && et.bonus.item[3] != Byte.MaxValue)
                {
                    btlBonus.item[num1++] = et.bonus.item[3];
                    et.bonus.item[3]      = Byte.MaxValue;
                }
                else if (Comn.random8() < 32 && et.bonus.item[2] != Byte.MaxValue)
                {
                    btlBonus.item[num1++] = et.bonus.item[2];
                    et.bonus.item[2]      = Byte.MaxValue;
                }
                else if (Comn.random8() < 96 && et.bonus.item[1] != Byte.MaxValue)
                {
                    btlBonus.item[num1++] = et.bonus.item[1];
                    et.bonus.item[1]      = Byte.MaxValue;
                }
                if (et.bonus.item[0] != Byte.MaxValue)
                {
                    Byte[] numArray = btlBonus.item;
                    Int32  index    = num1;
                    //int num2 = 1;
                    //byte num3 = (byte)(index + num2);
                    Int32 num4 = et.bonus.item[0];
                    numArray[index] = (Byte)num4;
                }
            }
            if (btlBonus.card != Byte.MaxValue || et.bonus.card >= 100U || Comn.random8() >= 32)
            {
                return;
            }
            btlBonus.card = (Byte)et.bonus.card;
        }
示例#3
0
        public static Byte StartType(BTL_SCENE_INFO info)
        {
            Byte num1 = 2;

            if (info.SpecialStart != 0)
            {
                if (info.BackAttack != 0)
                {
                    num1 = 0;
                }
            }
            else
            {
                Byte num2 = 24;
                if (btl_abil.CheckPartyAbility(1U, 512U))
                {
                    num2 = 0;
                }
                else if (info.BackAttack != 0)
                {
                    num2 = Byte.MaxValue;
                }
                if (Comn.random8() < num2)
                {
                    num1 = 0;
                }
                else
                {
                    Byte num3 = 16;
                    if (btl_abil.CheckPartyAbility(1U, 1024U))
                    {
                        num3 = 85;
                    }
                    if (Comn.random8() < num3)
                    {
                        num1 = 1;
                    }
                }
            }
            if (num1 == 0)
            {
                BattleAchievement.UpdateBackAttack();
            }
            return(num1);
        }
示例#4
0
        public static void CheckBattlePhase(BTL_DATA btl)
        {
            FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle;
            Int32 num1 = 6; /*btl.bi.player == 0 ? 6 : 6*/

            for (BTL_DATA next = ff9Battle.btl_list.next; next != null; next = next.next)
            {
                if (next.bi.player == btl.bi.player && (!Status.checkCurStat(next, BattleStatus.BattleEnd) || Status.checkCurStat(next, BattleStatus.Death) && next.die_seq != num1))
                {
                    return;
                }
            }
            if (btl.bi.player == 0)
            {
                Int32 num2 = 0;
                for (BTL_DATA next = ff9Battle.btl_list.next; next != null; next = next.next)
                {
                    if (next.bi.player != 0 && (!Status.checkCurStat(next, BattleStatus.BattleEnd) || (next.cur.hp == 0 || Status.checkCurStat(next, BattleStatus.Death)) && Status.checkCurStat(next, BattleStatus.AutoLife) || btl_cmd.CheckSpecificCommand(next, BattleCommandId.SysReraise)))
                    {
                        num2 = 1;
                        break;
                    }
                }
                if (num2 == 0)
                {
                    return;
                }
                if (ff9Battle.btl_seq != 1)
                {
                    ff9Battle.btl_seq = 0;
                }
            }
            else
            {
                for (BTL_DATA next = ff9Battle.btl_list.next; next != null; next = next.next)
                {
                    switch (btl_util.getSerialNumber(next))
                    {
                    case 10:
                    case 11:
                        if (!Status.checkCurStat(next, BattleStatus.Petrify | BattleStatus.Venom | BattleStatus.Zombie | BattleStatus.Stop))
                        {
                            if (btl_cmd.CheckSpecificCommand(next, BattleCommandId.SysLastPhoenix))
                            {
                                return;
                            }
                            if (ff9item.FF9Item_GetCount(249) > Comn.random8())
                            {
                                UIManager.Battle.FF9BMenu_EnableMenu(true);
                                btl_cmd.SetCommand(next.cmd[0], BattleCommandId.SysLastPhoenix, 73U, btl_scrp.GetBattleID(0U), 1U);
                                return;
                            }
                            break;
                        }
                        goto label_24;
                    }
                }
label_24:
                ff9Battle.btl_seq = 1;
                UIManager.Battle.SetBattleFollowMessage((Int32)BattleMesages.Annihilated);
            }
            UIManager.Battle.FF9BMenu_EnableMenu(false);
            ff9Battle.btl_phase = 5;
            btl_cmd.KillAllCommand(ff9Battle);
        }