示例#1
0
    public static UInt32 AlterStatus(BTL_DATA btl, UInt32 status)
    {
        BattleUnit unit = new BattleUnit(btl);

        STAT_DATA[] statusData = FF9StateSystem.Battle.FF9Battle.status_data;
        STAT_INFO   stat       = btl.stat;
        UInt32      statTblNo  = 0;

        if (((Int32)stat.invalid & (Int32)status) != 0)
        {
            return(0);
        }
        if (((Int32)stat.permanent & (Int32)status) != 0 || ((Int32)stat.cur & (Int32)status) != 0 && ((Int32)status & -2013200513) != 0)
        {
            return(1);
        }
        UInt32 num1 = 0;
        UInt32 num2 = 0;

        for (; num1 < 32U; ++num1)
        {
            UInt32 num3 = 1U << (Int32)num1;
            if (((Int32)status & (Int32)num3) != 0)
            {
                statTblNo = num1;
            }
            if (((Int32)stat.cur & (Int32)num3) != 0)
            {
                num2 |= statusData[num1].invalid;
            }
        }
        if (btl_cmd.CheckSpecificCommand(btl, 62))
        {
            num2 |= statusData[0].invalid;
        }
        if (((Int32)num2 & (Int32)status) != 0)
        {
            return(1);
        }
        if (((Int32)status & 270008321) == 0)
        {
            if (((Int32)status & 134403) != 0)
            {
                StatusCommandCancel(btl, status);
            }
            stat.cur |= status;
        }
        UInt32 num4 = statTblNo;

        switch (num4)
        {
        case 6:
            if (unit.IsPlayer && !unit.IsUnderStatus(BattleStatus.Trance))
            {
                unit.Trance = 0;
            }

            SetStatusPolyColor(btl);
            break;

        case 8:
            if (unit.CurrentHp > 0)
            {
                btl.fig_info |= 64;
                new BattleUnit(btl).Kill();
            }
            else
            {
                unit.CurrentHp = 0;
            }

            unit.CurrentAtb = 0;

            if (!btl_cmd.CheckUsingCommand(btl.cmd[2]))
            {
                btl_cmd.SetCommand(btl.cmd[2], 60U, 0U, btl.btl_id, 0U);
                if (!unit.IsPlayer)
                {
                    btl_sys.CheckForecastMenuOff(btl);
                }
            }

            btl_cmd.KillSpecificCommand(btl, 59);
            break;

        case 11:
        case 24:
        case 25:
            SetStatusPolyColor(btl);
            break;

        case 12:
            btl_sys.CheckBattlePhase(btl);
            break;

        case 14:
            btl_cmd.SetCommand(btl.cmd[4], 59U, 0U, btl.btl_id, 0U);
            break;

        case 17:
            if (unit.IsPlayer && !btl_mot.checkMotion(btl, 1) && !btl_util.isCurCmdOwner(btl))
            {
                btl_mot.setMotion(btl, 1);
                btl.evt.animFrame = 0;
            }
            break;

        case 19:
            if (Status.checkCurStat(btl, 1048576U))
            {
                RemoveStatus(btl, 1048576U);
                return(2);
            }
            btl_para.InitATB(btl);
            btl.cur.at_coef = (SByte)(btl.cur.at_coef * 3 / 2);
            stat.cur       |= status;
            break;

        case 20:
            if (Status.checkCurStat(btl, 524288U))
            {
                RemoveStatus(btl, 524288U);
                return(2);
            }
            btl_para.InitATB(btl);
            btl.cur.at_coef = (SByte)(btl.cur.at_coef * 2 / 3);
            stat.cur       |= status;
            break;

        case 26:
            btl_mot.HideMesh(btl, btl.mesh_banish, true);
            break;

        case 28:
            stat.cur ^= status;
            if (Status.checkCurStat(btl, 268435456U))
            {
                geo.geoScaleSet(btl, 2048);
                btlshadow.FF9ShadowSetScaleBattle(btl_util.GetFF9CharNo(btl), (Byte)(btl.shadow_x / 2U), (Byte)(btl.shadow_z / 2U));
                break;
            }
            geo.geoScaleReset(btl);
            btlshadow.FF9ShadowSetScaleBattle(btl_util.GetFF9CharNo(btl), btl.shadow_x, btl.shadow_z);
            break;

        default:
            if ((Int32)num4 != 0)
            {
                if ((Int32)num4 == 1)
                {
                    if (FF9StateSystem.Battle.FF9Battle.btl_phase > 2)
                    {
                        btl_sys.CheckBattlePhase(btl);
                    }
                    if (btl.bi.player != 0 && !btl_mot.checkMotion(btl, 1) && !btl_util.isCurCmdOwner(btl))
                    {
                        btl_mot.setMotion(btl, 1);
                        btl.evt.animFrame = 0;
                    }
                }
                break;
            }
            if (!btl_cmd.CheckUsingCommand(btl.cmd[2]))
            {
                if (FF9StateSystem.Battle.FF9Battle.btl_phase > 2)
                {
                    btl_cmd.SetCommand(btl.cmd[2], 62U, 0U, btl.btl_id, 0U);
                    break;
                }
                stat.cur  |= status;
                btl.bi.atb = 0;
                SetStatusClut(btl, true);
            }
            break;
        }
        RemoveStatuses(btl, statusData[statTblNo].clear);
        if (Status.checkCurStat(btl, 1073746177U))
        {
            btl.bi.atb = 0;
        }
        if (((Int32)status & -268500992) != 0)
        {
            Int16 num3 = ((Int32)status & -1693253632) == 0 ? (((Int32)status & 619446272) == 0 ? (Int16)(60 - btl.elem.wpr << 2) : (Int16)(btl.elem.wpr << 3)) : (Int16)(60 - btl.elem.wpr << 3);
            btl.stat.cnt.conti[statTblNo - 16U] = (Int16)(statusData[statTblNo].conti_cnt * num3);
        }
        if (((Int32)status & 327682) != 0)
        {
            SetOprStatusCount(btl, statTblNo);
        }
        HonoluluBattleMain.battleSPS.AddBtlSPSObj(btl, status);
        if (btl.bi.player != 0)
        {
            BattleAchievement.UpdateAbnormalStatus(status);
        }
        return(2);
    }
示例#2
0
    private static void CheckStatuses(BTL_DATA btl, Boolean ignoreAtb)
    {
        FF9StateBattleSystem ff9Battle = FF9StateSystem.Battle.FF9Battle;
        STAT_INFO            stat      = btl.stat;
        BattleUnit           unit      = new BattleUnit(btl);

        SetStatusVfx(unit);

        if (unit.IsUnderStatus(BattleStatus.Death))
        {
            btl_mot.DieSequence(btl);
            return;
        }

        if (unit.IsUnderStatus(BattleStatus.Petrify))
        {
            return;
        }

        if (!unit.IsUnderStatus(BattleStatus.Stop | BattleStatus.Jump))
        {
            btl.bi.atb = 1;
        }

        if (!ignoreAtb && !UIManager.Battle.FF9BMenu_IsEnableAtb())
        {
            return;
        }

        if (btl.bi.atb == 0)
        {
            if (unit.IsUnderStatus(BattleStatus.Jump) && (ff9Battle.cmd_status & 16) == 0 && (stat.cnt.conti[14] -= btl.cur.at_coef) < 0)
            {
                if (btl.cmd[3].cmd_no == 3)
                {
                    btl_cmd.SetCounter(btl, 10U, 185, btl.cmd[3].tar_id);
                }
                else
                {
                    btl_cmd.SetCounter(btl, 11U, 186, btl.cmd[3].tar_id);
                }
            }

            return;
        }

        if (unit.IsUnderStatus(BattleStatus.Venom))
        {
            if (stat.cnt.opr[0] <= 0)
            {
                SetOprStatusCount(btl, 1U);
                btl_para.SetPoisonDamage(btl);
                btl_para.SetPoisonMpDamage(btl);
                btl2d.Btl2dStatReq(btl);
            }
            else
            {
                stat.cnt.opr[0] -= btl.cur.at_coef;
            }
        }

        if (unit.IsUnderStatus(BattleStatus.Poison))
        {
            if (stat.cnt.opr[1] <= 0)
            {
                SetOprStatusCount(btl, 16U);
                btl_para.SetPoisonDamage(btl);
                btl2d.Btl2dStatReq(btl);
            }
            else
            {
                stat.cnt.opr[1] -= btl.cur.at_coef;
            }
        }

        if (unit.IsUnderStatus(BattleStatus.Regen) || unit.IsUnderPermanentStatus(BattleStatus.Regen))
        {
            if (stat.cnt.opr[2] <= 0)
            {
                SetOprStatusCount(btl, 18U);
                btl_para.SetRegeneRecover(btl);
                btl2d.Btl2dStatReq(btl);
            }
            else
            {
                stat.cnt.opr[2] -= btl.cur.at_coef;
            }
        }

        if (unit.IsUnderStatus(BattleStatus.Trance) && btl.bi.slot_no == 2 && ((ff9Battle.cmd_status & 4) != 0 && (ff9Battle.cmd_status & 8) == 0))
        {
            if (ff9Battle.phantom_cnt <= 0)
            {
                btl_cmd.SetCommand(btl.cmd[3], 57U, ff9Battle.phantom_no, btl_util.GetStatusBtlID(1U, 0U), 8U);
                ff9Battle.cmd_status |= 8;
            }
            else
            {
                ff9Battle.phantom_cnt -= btl.cur.at_coef;
            }
        }

        ActiveTimeStatus(btl);
    }
示例#3
0
    public static UInt32 RemoveStatus(BTL_DATA btl, UInt32 status)
    {
        STAT_INFO stat = btl.stat;

        if (((Int32)stat.permanent & (Int32)status) != 0 || ((Int32)stat.cur & (Int32)status) == 0 || btl.bi.player == 0 && FF9StateSystem.Battle.FF9Battle.btl_phase == 5 && (status & 4099L) != 0L)
        {
            return(1);
        }
        stat.cur &= ~status;
        switch ((BattleStatus)status)
        {
        case BattleStatus.Petrify:
            SetStatusClut(btl, false);
            break;

        case BattleStatus.Zombie:
        case BattleStatus.Heat:
        case BattleStatus.Freeze:
            if (Status.checkCurStat(btl, 50333760U))
            {
                SetStatusPolyColor(btl);
            }
            break;

        case BattleStatus.Death:
            btl.die_seq      = 0;
            btl.bi.dmg_mot_f = 0;
            btl.bi.cmd_idle  = 0;
            btl.bi.death_f   = 0;
            btl.bi.stop_anim = 0;
            btl.escape_key   = 0;
            if (btl_mot.checkMotion(btl, 4) || btl_mot.checkMotion(btl, 8))
            {
                GeoTexAnim.geoTexAnimPlay(btl.texanimptr, 2);
                if (btl.bi.player != 0)
                {
                    GeoTexAnim.geoTexAnimPlay(btl.tranceTexanimptr, 2);
                }
                btl_mot.setMotion(btl, 6);
                btl.evt.animFrame = 0;
            }
            if (FF9StateSystem.Battle.FF9Battle.cur_cmd.regist != btl || FF9StateSystem.Battle.FF9Battle.cur_cmd.cmd_no > 48)
            {
                btl.sel_mode = 0;
            }
            btl_cmd.KillSpecificCommand(btl, 60);
            if (((Int32)btl.stat.permanent & 262144) != 0)
            {
                SetOprStatusCount(btl, 18U);
            }
            break;

        case BattleStatus.Confuse:
            Vector3 eulerAngles = btl.rot.eulerAngles;
            eulerAngles.y = btl.evt.rotBattle.eulerAngles.y;
            btl.rot       = Quaternion.Euler(eulerAngles);
            StatusCommandCancel(btl, status);
            break;

        case BattleStatus.Berserk:
            StatusCommandCancel(btl, status);
            if (Status.checkCurStat(btl, 50333760U))
            {
                SetStatusPolyColor(btl);
            }
            break;

        case BattleStatus.Trance:
            btl.trance = 0;
            if (Status.checkCurStat(btl, 1073741824U))
            {
                RemoveStatus(btl, 1073741824U);
                btl.SetDisappear(0);
                btl_mot.setBasePos(btl);
                btl_mot.setMotion(btl, btl.bi.def_idle);
                btl.evt.animFrame = 0;
            }
            btl_cmd.SetCommand(btl.cmd[4], 59U, 0U, btl.btl_id, 0U);
            break;

        case BattleStatus.Haste:
        case BattleStatus.Slow:
            btl_para.InitATB(btl);
            break;

        case BattleStatus.Float:
            Single value = 0f;
            btl.pos[1]      = value;
            btl.base_pos[1] = value;
            break;

        case BattleStatus.Vanish:
            btl_mot.ShowMesh(btl, btl.mesh_banish, true);
            break;

        case BattleStatus.Doom:
            if (btl.deathMessage != null)
            {
                Singleton <HUDMessage> .Instance.ReleaseObject(btl.deathMessage);

                btl.deathMessage = null;
            }
            break;

        case BattleStatus.Mini:
            geo.geoScaleReset(btl);
            btlshadow.FF9ShadowSetScaleBattle(btl_util.GetFF9CharNo(btl), btl.shadow_x, btl.shadow_z);
            break;

        case BattleStatus.Jump:
            btl.tar_mode = 3;
            btl.bi.atb   = 1;
            if (btl.bi.player != 0 && !FF9StateSystem.Settings.IsATBFull)
            {
                btl.cur.at = 0;
            }
            btl.sel_mode      = 0;
            btl.cmd[3].cmd_no = 0;
            btl.cmd[3].tar_id = 0;
            break;

        case BattleStatus.GradualPetrify:
            if (btl.petrifyMessage != null)
            {
                Singleton <HUDMessage> .Instance.ReleaseObject(btl.petrifyMessage);

                btl.petrifyMessage = null;
            }
            btl_cmd.KillSpecificCommand(btl, 62);
            break;
        }
        HonoluluBattleMain.battleSPS.RemoveBtlSPSObj(btl, status);
        return(2);
    }