You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

258 lines
5.2 KiB

--------------------------------------------------------------------------------
-- King Slime Routine --
--------------------------------------------------------------------------------
function PlayerMapLogin( MapIndex, Handle )
cExecCheck "PlayerMapLogin"
if MapIndex == nil
then
DebugLog( "PlayerMapLogin::MapIndex == nil")
return
end
if Handle == nil
then
DebugLog( "PlayerMapLogin::Handle == nil")
return
end
local Var = InstanceField[ MapIndex ]
if Var == nil
then
DebugLog( "PlayerMapLogin::Var == nil")
return
end
-- ù <EFBFBD>÷<EFBFBD><EFBFBD>̾<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>α<EFBFBD><EFBFBD><EFBFBD> üũ
Var["bPlayerMapLogin"] = true
-- <EFBFBD>ð<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ƹ<EFBFBD><EFBFBD>͵<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ʴ´<EFBFBD>.
if Var["KQLimitTime"] == nil
then
return
end
if Var["CurSec"] == nil
then
return
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ѽð<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>޾Ƽ<EFBFBD> <EFBFBD><EFBFBD>û<EFBFBD>Ѵ<EFBFBD>.
local nLimitSec = Var["KQLimitTime"] - Var["CurSec"]
cShowKQTimerWithLife_Obj( Handle, nLimitSec )
end
function KingSlimeRoutine( Handle, MapIndex )
cExecCheck "KingSlimeRoutine"
local Var = InstanceField[ MapIndex ]
if Var == nil
then
cAIScriptSet( Handle )
cNPCVanish( Handle )
return ReturnAI["END"]
end
local RoutineTimeIndex = ""..Handle
-- // 0.1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> üũ<EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD>ƾ
if Var["RoutineTime"][ RoutineTimeIndex ] == nil
then
Var["RoutineTime"][ RoutineTimeIndex ] = cCurrentSecond()
end
if Var["RoutineTime"][ RoutineTimeIndex ] + 0.1 > cCurrentSecond()
then
return ReturnAI["CPP"]
else
Var["RoutineTime"][ RoutineTimeIndex ] = cCurrentSecond()
end
-- 0.1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> üũ<EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD>ƾ //
if Var["Enemy"] == nil
then
cAIScriptSet( Handle )
cNPCVanish( Handle )
return ReturnAI["END"]
end
if Var["Enemy"][ Handle ] == nil
then
cAIScriptSet( Handle )
cNPCVanish( Handle )
return ReturnAI["END"]
end
-- King Slime <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if cIsObjectDead( Handle ) == 1
then
cMobShout( Handle, KingSlimeChat["ScriptFileName"], KingSlimeChat["DeathShout"]["Index"] )
cAIScriptSet( Handle )
Var["Enemy"][ Handle ]["PhaseNumber"] = nil
Var["Enemy"][ Handle ] = nil
return ReturnAI["END"]
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ <EFBFBD><EFBFBD> <EFBFBD>ൿ
if Var["Enemy"][ Handle ]["PhaseNumber"] == nil
then
Var["Enemy"][ Handle ]["PhaseNumber"] = 1
end
local CurHP, MaxHP = cObjectHP( Handle )
local RoutineStepFunc = nil
if CurHP == MaxHP
then
RoutineStepFunc = DummyPhaseFunc
elseif Var["Enemy"][ Handle ]["PhaseNumber"] < #BossPhaseNameTable
then
local NextBossPhase = BossPhaseNameTable[ Var["Enemy"][ Handle ]["PhaseNumber"] + 1 ]
local HP_RealRate = ( CurHP * 1000 ) / MaxHP -- 1000<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if HP_RealRate < KingSlimeSummon[ NextBossPhase ]["HP_Rate"]
then
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ٲ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>׼<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Var["Enemy"][ Handle ]["PhaseNumber"] = Var["Enemy"][ Handle ]["PhaseNumber"] + 1
RoutineStepFunc = PhaseActionFunc
else
RoutineStepFunc = DummyPhaseFunc
end
else
RoutineStepFunc = DummyPhaseFunc
end
RoutineStepFunc( Handle, MapIndex )
return ReturnAI["CPP"]
end
function DummyPhaseFunc( )
cExecCheck "DummyPhaseFunc"
end
function PhaseActionFunc( BossHandle, MapIndex )
cExecCheck "PhaseActionFunc"
if BossHandle == nil
then
return
end
if MapIndex == nil
then
return
end
local Var = InstanceField[ MapIndex ]
if Var == nil
then
return
end
local PhaseNumber = Var["Enemy"][ BossHandle ]["PhaseNumber"]
local BossPhase = BossPhaseNameTable[ PhaseNumber ]
DebugLog( "Start PhaseActionFunc::"..BossPhase )
cMobShout( BossHandle, KingSlimeChat["ScriptFileName"], KingSlimeChat["SummonMobShout"]["Index"] )
for i = 1, #KingSlimeSummon[ BossPhase ]["SummonMobs"]
do
local SummonMobInfo = {}
local SummonMobHandle = nil
SummonMobHandle = cMobRegen_Obj( KingSlimeSummon[ BossPhase ]["SummonMobs"][i], BossHandle )
if SummonMobHandle ~= nil
then
cSetAIScript ( MainLuaScriptPath, SummonMobHandle )
cAIScriptFunc( SummonMobHandle, "Entrance", "SummonMobRoutine" )
Var["Enemy"][ SummonMobHandle ] = SummonMobInfo
Var["Enemy"][ SummonMobHandle ]["Handle"] = SummonMobHandle
end
end
DebugLog( "End PhaseActionFunc::"..BossPhase )
end
function SummonMobRoutine( Handle, MapIndex )
cExecCheck "SummonMobRoutine"
local Var = InstanceField[ MapIndex ]
if Var == nil then
cAIScriptSet( Handle )
cNPCVanish( Handle )
return ReturnAI["END"]
end
-- // 0.1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> üũ<EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD>ƾ
local RoutineTimeIndex = ""..Handle
if Var["RoutineTime"][ RoutineTimeIndex ] == nil
then
Var["RoutineTime"][ RoutineTimeIndex ] = cCurrentSecond()
end
if Var["RoutineTime"][ RoutineTimeIndex ] + 0.1 > cCurrentSecond()
then
return ReturnAI["CPP"]
else
Var["RoutineTime"][ RoutineTimeIndex ] = cCurrentSecond()
end
-- 0.1<EFBFBD>ʸ<EFBFBD><EFBFBD><EFBFBD> üũ<EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD>ƾ //
if Var["Enemy"] == nil then
cAIScriptSet( Handle )
cNPCVanish( Handle )
Var["RoutineTime"][ RoutineTimeIndex ] = nil
return ReturnAI["END"]
end
if Var["Enemy"][ Handle ] == nil then
cAIScriptSet( Handle )
cNPCVanish( Handle )
Var["RoutineTime"][ RoutineTimeIndex ] = nil
return ReturnAI["END"]
end
if cIsObjectDead( Handle ) == 1
then
cAIScriptSet( Handle )
Var["Enemy"][ Handle ] = nil
Var["RoutineTime"][ RoutineTimeIndex ] = nil
return ReturnAI["END"]
end
return ReturnAI["CPP"]
end