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/Psy_Psyken.lua

197 lines
5.2 KiB

-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ
-- <EFBFBD><EFBFBD>ų 1 : <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>ų 2 : HP<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ߵ<EFBFBD>
-- <EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD>
ReturnAI = {}
ReturnAI.END = 1 -- Return_AI_END = 1;// -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> AI<EFBFBD><EFBFBD>ƾ <EFBFBD><EFBFBD>
ReturnAI.CPP = 2 -- Return_AI_CPP = 2;// -- <EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD> <EFBFBD>Ϻ<EFBFBD> ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> cpp<EFBFBD><EFBFBD> AI<EFBFBD><EFBFBD>ƾ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
C = {}
C.Immune = {} -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ų
C.Immune.SkillIndex = "Psy_Psyken_Skill_N_MRS" -- <EFBFBD><EFBFBD>ų <EFBFBD≯<EFBFBD> -- MobAttackSequence<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
C.Immune.Interval = 20 -- 20<EFBFBD><EFBFBD> <EFBFBD><EFBFBD> 20000 <EFBFBD>̻<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>޾<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>
C.Immune.Damage = 50000 --
C.SummonTable = {} -- <EFBFBD>ʻ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>̺<EFBFBD>
C.SummonTable[1] = {}
C.SummonTable[1].HPRate = 950 -- 95% <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>ѹ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
C.SummonTable[1].Summon = {}
C.SummonTable[1].Summon[1] = "Psy_PsykenDog"
--C.SummonTable[1].Summon[2] = "Psy_PsykenDog"
-- PsykenDog 2<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȯ(<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> C.SummonTable[1].Summon[3] <EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD> <EFBFBD>߰<EFBFBD>
C.SummonTable[2] = {}
C.SummonTable[2].HPRate = 700 -- 70% <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>ѹ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
C.SummonTable[2].Summon = {}
C.SummonTable[2].Summon[1] = "Psy_PsykenDog"
C.SummonTable[2].Summon[2] = "Psy_PsykenDog"
--C.SummonTable[2].Summon[3] = "Psy_PsykenDog"
-- PsykenDog 3<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȯ(<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> C.SummonTable[2].Summon[3] <EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD> <EFBFBD>߰<EFBFBD>
C.SummonTable[3] = {}
C.SummonTable[3].HPRate = 300 -- 30% <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD> <EFBFBD>ѹ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
C.SummonTable[3].Summon = {}
C.SummonTable[3].Summon[1] = "Psy_PsykenDog"
C.SummonTable[3].Summon[2] = "Psy_PsykenDog"
C.SummonTable[3].Summon[3] = "Psy_PsykenDog"
-- PsykenDog 3<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȯ(<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> C.SummonTable[2].Summon[3] <EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD> <EFBFBD>߰<EFBFBD>
MemBlock = {}
function Psy_Psyken(Handle, MapIndex)
cExecCheck "Psy_Psyken"
if cIsObjectDead(Handle) then -- <EFBFBD>׾<EFBFBD><EFBFBD><EFBFBD>
cAIScriptSet(Handle) -- <EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MemBlock[Handle] = nil -- <EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cDebugLog "Psy_Psyken Dead"
return
end
local Var = MemBlock[Handle]
if Var == nil then
MemBlock[Handle] = {}
Var = MemBlock[Handle]
Var.Handle = Handle
Var.MapIndex = MapIndex
Var.LastCheck = cCurSec() -- 1<EFBFBD>ʿ<EFBFBD> <EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD> üũ<EFBFBD>ϱ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Var.ImmunManage = {} -- HP <EFBFBD><EFBFBD><EFBFBD>Ҹ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>̺<EFBFBD>(<EFBFBD><EFBFBD><EFBFBD>ų<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
Var.ImmunManage.QueueHead = 1
for k = 1, C.Immune.Interval do
Var.ImmunManage[k] = cObjectHP(Var.Handle)
end
Var.NextSummonIndex = 1 -- <EFBFBD>ʻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>̺<EFBFBD> C.SummonTable[1].HPRate<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ٸ<EFBFBD>
Var.StepFunc = Psyken_Default
end
Var.StepFunc(Var)
return ReturnAI.CPP
end
function Psyken_Default(Var)
cExecCheck "Psyken_Default"
local CurSec = cCurSec()
if Var.LastCheck == CurSec then
return
end
Var.LastCheck = CurSec
-- 1<EFBFBD>ʿ<EFBFBD> <EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD> üũ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local CurHP, MaxHP = cObjectHP(Var.Handle)
-- HP <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Var.ImmunManage.QueueHead = Var.ImmunManage.QueueHead + 1
if Var.ImmunManage.QueueHead > C.Immune.Interval then
Var.ImmunManage.QueueHead = 1
end
local LastHP = Var.ImmunManage[Var.ImmunManage.QueueHead]
Var.ImmunManage[Var.ImmunManage.QueueHead] = CurHP
if LastHP - CurHP > C.Immune.Damage then
Var.StepFunc = Psyken_ImmunSkill -- <EFBFBD><EFBFBD><EFBFBD>ų <EFBFBD>ߵ<EFBFBD>
return
end
-- HP <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if CurHP == MaxHP then
Var.NextSummonIndex = 1
else
local HPRate = CurHP * 1000 / MaxHP
if C.SummonTable[Var.NextSummonIndex] ~= nil and HPRate < C.SummonTable[Var.NextSummonIndex].HPRate then
Var.StepFunc = Psyken_Summon -- <EFBFBD><EFBFBD>ȯ<EFBFBD><EFBFBD>ų
return
end
end
end
function Psyken_ImmunSkill(Var) -- <EFBFBD><EFBFBD><EFBFBD>ų <EFBFBD>ߵ<EFBFBD>
cExecCheck "Psyken_ImmunSkill"
if cSkillBlast(Var.Handle, Var.Handle, C.Immune.SkillIndex) == nil then -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cDebugLog "Psyken_ImmunSkill : Other Skill using"
return -- <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>
end
cDebugLog "Psyken_ImmunSkill : Blast"
for k = 1, C.Immune.Interval do
Var.ImmunManage[k] = cObjectHP(Var.Handle)
end
Var.StepFunc = Psyken_Default
end
function Psyken_Summon(Var) -- <EFBFBD><EFBFBD>ȯ<EFBFBD><EFBFBD>ų
cExecCheck "Psyken_Summon"
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ų <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
--if cSkillBlast(Var.Handle, var.Handle, C.SummonTable.SkillIndexA) == nil then -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-- cDebugLog "Psyken_SummonA : Other Skill using"
-- return -- <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>
--end
-- <EFBFBD><EFBFBD>ȯ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for k = 1, #C.SummonTable[Var.NextSummonIndex].Summon do
local Handle = cMobRegen_Obj(C.SummonTable[Var.NextSummonIndex].Summon[k], Var.Handle)
MemBlock[Handle] = {}
MemBlock[Handle].Handle = Handle
MemBlock[Handle].Master = Var.Handle
cAIScriptSet(Handle, Var.Handle)
cAIScriptFunc(Handle, "Entrance", "PsykenPet") --<EFBFBD>Ա<EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD> PsykenPet
end
Var.NextSummonIndex = Var.NextSummonIndex + 1
Var.StepFunc = Psyken_Default
end
---------------------------------------------------------------
function PsykenPet(Handle, MapIndex)
cExecCheck "Psyken_Summon"
if cIsObjectDead(Handle) then -- <EFBFBD>׾<EFBFBD><EFBFBD><EFBFBD>
cAIScriptSet(Handle) -- <EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MemBlock[Handle] = nil -- <EFBFBD>޸<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cDebugLog "Pen Dead"
return ReturnAI.END
end
local Var = MemBlock[Handle]
if Var == nil then
MemBlock[Handle] = nil
cNPCVanish(Handle)
cAIScriptSet(Handle) -- <EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return ReturnAI.END
end
if cIsObjectDead(Var.Master) then -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>׾<EFBFBD><EFBFBD><EFBFBD>
MemBlock[Handle] = nil
cNPCVanish(Handle)
cAIScriptSet(Handle) -- <EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return ReturnAI.END
end
local HP, MaxHP = cObjectHP(Var.Master)
if HP == MaxHP then -- <EFBFBD><EFBFBD>ȭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ǰ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> á<EFBFBD><EFBFBD>
MemBlock[Handle] = nil
cNPCVanish(Handle)
cAIScriptSet(Handle) -- <EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return ReturnAI.END
end
return ReturnAI.CPP
end