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.
SigFiesta/LuaScript/AIScript/E_MomSlime.lua

383 lines
9.0 KiB

require( "common" )
KING = { Index = "E_DadSlime", RegenX = 16298, RegenY = 13384, RegenD = 270 }
QUEEN = { Index = "E_MomSlime", }
DANNY = { Index = "E_DannySlime", RegenR = 300, }
MIKE = { Index = "E_MikeSlime", RegenR = 300, }
TREE =
{
{ Index = "E_HiveTree", RegenX = 13594, RegenY = 14599, RegenR = 70, RegenT = 2, },
{ Index = "E_HiveTree", RegenX = 13704, RegenY = 14381, RegenR = 70, RegenT = 2, },
{ Index = "E_HiveTree", RegenX = 13530, RegenY = 14584, RegenR = 70, RegenT = 2, },
{ Index = "E_HiveTree", RegenX = 13653, RegenY = 14859, RegenR = 70, RegenT = 2, },
{ Index = "E_HiveTree", RegenX = 13644, RegenY = 15093, RegenR = 70, RegenT = 2, },
{ Index = "E_HiveTree", RegenX = 13515, RegenY = 15391, RegenR = 70, RegenT = 2, },
{ Index = "E_HiveTree", RegenX = 13715, RegenY = 15532, RegenR = 70, RegenT = 2, },
{ Index = "E_HiveTree", RegenX = 13705, RegenY = 15779, RegenR = 70, RegenT = 2, },
{ Index = "E_HiveTree", RegenX = 13502, RegenY = 15813, RegenR = 70, RegenT = 2, },
{ Index = "E_HiveTree", RegenX = 13539, RegenY = 15508, RegenR = 70, RegenT = 2, },
}
EVENT_START_NOTICE = "ValenSlime_MobRegen" -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>1
EVENT_START_NOTICE2 = "ValenSlime_MobRegen2" -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>2
EVENT_START_NOTICE3 = "ValenSlime_MobRegen3" -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>3
EVENT_SUC_NOTICE = "ValenSlime_Success" -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
EVENT_REWARD_NOTICE = "ValenSlime_Reward" -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
EVENT_SUC_INTERVAL = (100 * 100) -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>Ÿ<EFBFBD>(<EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
EVENT_REWARD_ABSTATE = "StaValenReward" -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD>
EVENT_REWARD_KEEPTIME = (60 * 60 * 1000) -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̻<EFBFBD> <EFBFBD>ð<EFBFBD>
EVENT_REWARD_RANGE = 800 -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
EVENT_NOMOVE_TIME_MAX = 60 -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ȿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ <EFBFBD>ð<EFBFBD>
EVENT_MOB_CLEAR_DELAY = 3 -- Ŭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
EVENT_SUC_EFFECT_INDEX = "LoveFireworks" -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
EVENT_DIALOG =
{
KING = { FaceCut = "E_DadNPC", FileName = "Event", Index = "E_DadSlime_01" },
QUEEN = { FaceCut = "E_MomNPC", FileName = "Event", Index = "E_MomSlime_01" },
}
EVENT_MOBCHAT =
{
KING = { ChatTick = 30, FileName = "Event", Index = "E_DadSlime_Chat01" },
QUEEN = { ChatTick = 30, FileName = "Event", Index = "E_MomSlime01_Chat01" },
DANNY = { ChatTick = 10, FileName = "Event", Index = "E_DannySlime_Chat01" },
MIKE = { ChatTick = 10, FileName = "Event", Index = "E_MikeSlime01_Chat01" },
}
MemBlock = {}
function Dummy( Handle, MapIndex )
cExecCheck( "Dummy" )
return ReturnAI["END"]
end
function E_MomSlime( Handle, MapIndex )--
cExecCheck( "E_MomSlime" )
if MapIndex ~= "Eld" then
cAIScriptSet( Handle )
return ReturnAI["END"]
end
if cIsObjectDead( Handle ) == 1 then
cAIScriptSet( Handle )
MemBlock[Handle] = nil
return ReturnAI["END"]
end
local Var = MemBlock[Handle]
local CurSec = cCurrentSecond()
if Var == nil then
MemBlock[Handle] = {}
Var = MemBlock[Handle]
Var["MapIndex"] = MapIndex
Var["Handle"] = Handle
Var["RegenX"], Var["RegenY"] = cObjectLocate( Var["Handle"] )
Var["CurX"], Var["CurY"] = Var["RegenX"], Var["RegenY"]
Var["LastMoveTime"] = CurSec
Var["ChkTime"] = CurSec + 1
Var["EventStep"] = 1
if Var["RegenX"] == nil or Var["RegenY"] == nil then
cAIScriptSet( Handle )
cNPCVanish( Handle )
MemBlock[Handle] = nil
return ReturnAI["END"]
end
-- ŷ, <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Var["King"] = cMobRegen_XY( Var["MapIndex"], KING["Index"], KING["RegenX"], KING["RegenY"], KING["RegenD"] )
Var["Danny"] = cMobRegen_Circle( Var["MapIndex"], DANNY["Index"], KING["RegenX"], KING["RegenY"], DANNY["RegenR"] )
Var["Mike"] = cMobRegen_Circle( Var["MapIndex"], MIKE["Index"], Var["RegenX"], Var["RegenY"], MIKE["RegenR"] )
if Var["King"] == nil or Var["Danny"] == nil or Var["Mike"] == nil then
DeleteSubObject( Var )
cAIScriptSet( Handle )
cNPCVanish( Handle )
MemBlock[Handle] = nil
return ReturnAI["END"]
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> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ص<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if cAIScriptSet( Var["King"], Var["Handle"] ) ~= nil then
cAIScriptFunc( Var["King"], "Entrance", "Dummy" )
end
Var["TreeList"] = {}
Var["TreeRegenTList"] = {}
Var["KingChatTime"] = CurSec + EVENT_MOBCHAT["KING"]["ChatTick"]
Var["QueenChatTime"] = CurSec + EVENT_MOBCHAT["QUEEN"]["ChatTick"]
Var["DannyChatTime"] = CurSec + EVENT_MOBCHAT["DANNY"]["ChatTick"]
Var["MikeChatTime"] = CurSec + EVENT_MOBCHAT["MIKE"]["ChatTick"]
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ä<EFBFBD><EFBFBD>
if Var["KingChatTime"] <= CurSec then
cMobChat( Var["King"], EVENT_MOBCHAT["KING"]["FileName"], EVENT_MOBCHAT["KING"]["Index"] )
Var["KingChatTime"] = CurSec + EVENT_MOBCHAT["KING"]["ChatTick"]
end
if Var["QueenChatTime"] <= CurSec then
cMobChat( Handle, EVENT_MOBCHAT["QUEEN"]["FileName"], EVENT_MOBCHAT["QUEEN"]["Index"] )
Var["QueenChatTime"] = CurSec + EVENT_MOBCHAT["QUEEN"]["ChatTick"]
end
if Var["DannyChatTime"] <= CurSec then
cMobChat( Var["Danny"], EVENT_MOBCHAT["DANNY"]["FileName"], EVENT_MOBCHAT["DANNY"]["Index"] )
Var["DannyChatTime"] = CurSec + EVENT_MOBCHAT["DANNY"]["ChatTick"]
end
if Var["MikeChatTime"] <= CurSec then
cMobChat( Var["Mike"], EVENT_MOBCHAT["MIKE"]["FileName"], EVENT_MOBCHAT["MIKE"]["Index"] )
Var["MikeChatTime"] = CurSec + EVENT_MOBCHAT["MIKE"]["ChatTick"]
end
-- <EFBFBD>̺<EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if Var["EventStep"] == 1 then
if Var["ChkTime"] <= CurSec then
Var["ChkTime"] = CurSec + 1.5
cScriptMessage( Var["MapIndex"], EVENT_START_NOTICE )
Var["EventStep"] = Var["EventStep"] + 1
end
elseif Var["EventStep"] == 2 then
if Var["ChkTime"] <= CurSec then
Var["ChkTime"] = CurSec + 1.5
cScriptMessage( Var["MapIndex"], EVENT_START_NOTICE2 )
Var["EventStep"] = Var["EventStep"] + 1
end
elseif Var["EventStep"] == 3 then
if Var["ChkTime"] <= CurSec then
Var["ChkTime"] = CurSec + 1
cScriptMessage( Var["MapIndex"], EVENT_START_NOTICE3 )
Var["EventStep"] = Var["EventStep"] + 1
end
elseif Var["EventStep"] == 4 then
if Var["ChkTime"] <= CurSec then
Var["ChkTime"] = CurSec + 1
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> 10<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for i = 1, #TREE do
if Var["TreeList"][i] == nil or cIsObjectDead( Var["TreeList"][i] ) == 1 then
if Var["TreeRegenTList"][i] == nil then
Var["TreeRegenTList"][i] = CurSec + TREE[i]["RegenT"]
Var["TreeList"][i] = nil
end
end
if Var["TreeRegenTList"][i] ~= nil and Var["TreeRegenTList"][i] <= CurSec then
Var["TreeList"][i] = cMobRegen_Circle( Var["MapIndex"], TREE[i]["Index"], TREE[i]["RegenX"], TREE[i]["RegenY"], TREE[i]["RegenR"] )
Var["TreeRegenTList"][i] = nil
end
end
-- <EFBFBD><EFBFBD>ǥ üũ ( 1<EFBFBD>а<EFBFBD> <EFBFBD>ȿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> üũ )
local CurX, CurY = cObjectLocate( Var["Handle"] )
if CurX == nil or CurY == nil then
DeleteSubObject( Var )
cAIScriptSet( Handle )
cNPCVanish( Handle )
MemBlock[Handle] = nil
return ReturnAI["END"]
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>
if Var["CurX"] ~= CurX or Var["CurY"] ~= CurY then
Var["LastMoveTime"] = CurSec
Var["CurX"] = CurX
Var["CurY"] = CurY
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><EFBFBD><EFBFBD>
if CurX == Var["RegenX"] and CurY == Var["RegenY"] then
Var["LastMoveTime"] = CurSec
end
if Var["LastMoveTime"] + EVENT_NOMOVE_TIME_MAX <= CurSec then
cRunTo( Var["Handle"], Var["RegenX"], Var["RegenY"], 3000 )
Var["LastMoveTime"] = CurSec
return ReturnAI["END"]
end
if cDistanceSquar( Var["Handle"], Var["King"] ) <= EVENT_SUC_INTERVAL then
cEffectRegen_XY( Var["MapIndex"], EVENT_SUC_EFFECT_INDEX, KING["RegenX"], KING["RegenY"], 0, 4, 0, 1000 )
cScriptMessage( Var["MapIndex"], EVENT_SUC_NOTICE )
cSetAbstate_Range( Var["King"], EVENT_REWARD_RANGE, ObjectType["Player"], EVENT_REWARD_ABSTATE, 1, EVENT_REWARD_KEEPTIME )
cScriptMessage_Range( Var["King"], EVENT_REWARD_RANGE, EVENT_REWARD_NOTICE )
cMobDialog_Range( Var["King"], EVENT_DIALOG["KING"]["FaceCut"], EVENT_REWARD_RANGE, EVENT_DIALOG["KING"]["FileName"], EVENT_DIALOG["KING"]["Index"] )
Var["EventStep"] = Var["EventStep"] + 1
Var["ChkTime"] = CurSec + 4
end
end
elseif Var["EventStep"] == 5 then
if Var["ChkTime"] <= CurSec then
cMobDialog_Range( Var["King"], EVENT_DIALOG["QUEEN"]["FaceCut"], EVENT_REWARD_RANGE, EVENT_DIALOG["QUEEN"]["FileName"], EVENT_DIALOG["QUEEN"]["Index"] )
Var["EventStep"] = Var["EventStep"] + 1
Var["ChkTime"] = CurSec + EVENT_MOB_CLEAR_DELAY
end
elseif Var["EventStep"] == 6 then
if Var["ChkTime"] <= CurSec then
DeleteSubObject( Var )
cAIScriptSet( Handle )
cNPCVanish( Handle )
MemBlock[Handle] = nil
end
end
return ReturnAI["END"]
end
function DeleteSubObject( Var )
if Var == nil then
return
end
if Var["King"] ~= nil then
cNPCVanish( Var["King"] )
Var["King"] = nil
end
if Var["Danny"] ~= nil then
cNPCVanish( Var["Danny"] )
Var["Danny"] = nil
end
if Var["Mike"] ~= nil then
cNPCVanish( Var["Mike"] )
Var["Mike"] = nil
end
if Var["TreeList"] ~= nil then
for i = 1, #TREE do
if Var["TreeList"][i] ~= nil then
cNPCVanish( Var["TreeList"][i] )
Var["TreeList"][i] = nil
end
end
Var["TreeList"] = nil
end
end