x020003_g_scriptId = 020003

x020003_g_CSParamIdxCurFloor = 0
x020003_g_CSParamIdxCurSubStage = 1

x020003_g_CSParam1 = 2

x20003_g_RbIdXingChenShow_1 = 7010
x20003_g_RbIdXingChenShow_2 = 7011
x20003_g_RbIdXingChenShow_3 = 7012

x20003_g_RbIdZaiMu_1 = 7016
x20003_g_RbIdZaiMu_2 = 7017
x20003_g_RbIdZaiMu_3 = 7018

x20003_g_RbIdLinHaoTian = 7023
x20003_g_RbIdJueShengJian_1 = 7025
x20003_g_RbIdJueShengJian_2 = 7026

x20003_g_RbIdSiTuPo = 7030
x20003_g_RbIdYueBingYing = 7032

x20003_g_ImpactIdAddHp = 11
x20003_g_ImpactIdAddPD = 11
x20003_g_ImpactIdAddMD = 11
x20003_g_ImpactIdAddAttack = 11
x20003_g_CSParamStage = 1
x20003_g_TowerStage = 1
x20003_g_IsSetHpTrigger = 1
x20003_g_IsBuffGetOk = 1
-- 下面三个数组 请保证一一对应    特殊情况在下面另加
x20003_g_IdTower = { 305, 308, 310, 315, 325, 405, 410, 415, 420 }  --第几关需要有特殊的buff
x20003_g_IdImpact = { 30000, 30001, 30002, 30003, 30004, 30007, 30015, 30008, 30009 } --需要触发的buff
x20003_g_HpTrigger = { 50, 50, 50, 50, 50, 50, 50, 50, 50 } --需要触发的条件（血量低于百分之多少）
x20003_g_RBId = 1

function x020003_OnCopySceneOpen(scene)
    local nUserCount = GetSceneUserCount(scene)
    for j = 0, nUserCount - 1 do
        local nUserObjId = GetUserObjIdByIdx(scene, j)
        SetHpFull(scene, nUserObjId)
    end
end

function x020003_OnCopySceneTick(scene, tickCount)
    --副本阶段

end

function x020003_OnObjEnter(scene, objId)
    SetCopySceneParam(scene, x020003_g_CSParam1, 0)
    --CopySceneNPC(scene,1001101,51001,6,52,1,"XXX")--场景、角色ID、CharModel表ID、势力、出现的场景SceneID、等级、名称
    TellPlayerAutoCombat(scene)
    SendAlertTip(scene, objId, "通天塔禁止使用血藥且境界低於輪脈境無法覺醒血脈")
end
function x020003_OnCaredHpPercent(scene, ObjId, Tirgger, attackerId)

end

function x020003_OnObjDie(scene, objId, rolebaseId, killerId)
    --战斗（）

    if IsUser(objId) then

        OnTowerFail(scene, objId)
        SetCopySceneFail(scene)

        -- 副本已经结束
    elseif GetCopySceneParam(scene, x020003_g_CSParam1) == 1 then
        return
    elseif GetHostileMonsterCount(scene) == 0 then
        AccoutByCopyScene(scene)
        local nUserCount = GetSceneUserCount(scene)
        for i = 0, nUserCount - 1 do
            local nUserObjId = GetUserObjIdByIdx(scene, i)
            TowerSuccess(scene, nUserObjId)
        end

        SetCopySceneSuccess(scene)

    else
        x020003_MonsterDieLogic(scene, objId, rolebaseId, killerId)
    end
end

function x020003_MonsterDieLogic(scene, objId, rolebaseId, killerId)


end

function x020003_OnCopySceneTimeOut(scene)
    local nUserCount = GetSceneUserCount(scene)
    for i = 0, nUserCount - 1 do
        local nUserObjId = GetUserObjIdByIdx(scene, i)
        OnTowerFail(scene, nUserObjId)
    end
    SetCopySceneParam(scene, x020003_g_CSParam1, 1)
    SetCopySceneFail(scene)
end

