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

292 lines
7.5 KiB

--[[
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <EFBFBD>ĸ<EFBFBD><EFBFBD><EFBFBD>
9Data/Here/World/FineScript.txt <EFBFBD>ʿ<EFBFBD>
9Data/Hero/Script/BH_Humar.txt <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>
--BossIndex = "BH_Humar"
FellowIndex = {}
FellowIndex[1] = "BH_Looter"
FellowIndex[2] = "BH_Guardian"
HumarBuffSkill = "BH_Humar_Skill_N_APU"
HumarBuffAbState = "StaMobAPU01"
HumarBuffSec = 60
SummonSkillName = "BH_Humar_Skill_S"
SummonSkillCastSecond = 5
--<EFBFBD><EFBFBD><EFBFBD>׷<EFBFBD> <EFBFBD><EFBFBD><EFBFBD>Ž<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ְ<EFBFBD> inactiv<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD>
SummonRate = {}
SummonRate[1] = 750 -- 75%, 50%, 25%<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SummonRate[2] = 500
SummonRate[3] = 250
SummonRate[4] = 0 -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>׻<EFBFBD> 0<EFBFBD>ΰ<EFBFBD> <EFBFBD>߰<EFBFBD> <EFBFBD>ʿ<EFBFBD>
MemBlock = {}
----------------------------------------------------------------------
-- Mantis 7984
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ȯ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BH_HumarBox =
{
{ Index = "BH_Humar_X", ItemDropMobIndex = "BH_Humar_O", x = 3060, y = 3126, width = 303, height = 494, rotate = 4 },
{ Index = "BH_Humar_X", ItemDropMobIndex = "BH_Humar_O_02", x = 3060, y = 3126, width = 303, height = 494, rotate = 4 },
{ Index = "BH_Humar_X", ItemDropMobIndex = "BH_Humar_O_03", x = 3060, y = 3126, width = 303, height = 494, rotate = 4 },
{ Index = "BH_Humar_X", ItemDropMobIndex = "BH_Humar_O_04", x = 3060, y = 3126, width = 303, height = 494, rotate = 4 },
}
----------------------------------------------------------------------
function Common_RemoveTreasure(MapIndex)
cExecCheck "Common_RemoveTreasure"
cDebugLog "Common_RemoveTreasure"
cRegenGroupActiv("BH_Cracker", "BH_HumarBox", 0) -- <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> 1<EFBFBD≯<EFBFBD> activ)
-- cVanishAll(MapIndex, "BH_Humar_O")
-- cVanishAll(MapIndex, "BH_Humar_O_02")
-- cVanishAll(MapIndex, "BH_Humar_O_03")
-- cVanishAll(MapIndex, "BH_Humar_O_04")
cVanishAll(MapIndex, "BH_Humar_X")
end
-- <EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈó<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> - CPP <EFBFBD><EFBFBD>ƾ <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
------------------------------------------------------------------
----------------------- Humar Part --------------------------
------------------------------------------------------------------
function BH_Humar(Handle, MapIndex)
cExecCheck "BH_Humar"
local Var = MemBlock[Handle]
if cIsObjectDead(Handle) ~= nil then
if Var ~= nil then -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>׾<EFBFBD><EFBFBD><EFBFBD>
cDebugLog("Boss Dead")
for k = 1, 2 do
if Var.FellowHandle[k] ~= -1 then
cNPCVanish(Var.FellowHandle[k])
Var.FellowHandle[k] = -1
end
end
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΰ<EFBFBD> <EFBFBD><EFBFBD>ȯ - <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local InvisibleHandle = cMobRegen_Obj("InvisibleMan", Handle)
cAIScriptSet(InvisibleHandle, Handle) -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AI<EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ<EFBFBD><EFBFBD> Var.Handle(<EFBFBD>ﰡ)<EFBFBD><EFBFBD> AI<EFBFBD><EFBFBD>ũ<EFBFBD><EFBFBD>Ʈ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MemBlock[InvisibleHandle] = {}
MemBlock[InvisibleHandle].Handle = InvisibleHandle
MemBlock[InvisibleHandle].MapIndex = MapIndex
MemBlock[InvisibleHandle].StepFunc = Invisible_Init
MemBlock[Handle] = nil
end
return ReturnAI.END
end
if Var == nil then -- ó<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><EFBFBD><EFBFBD>
MemBlock[Handle] = {}
Var = MemBlock[Handle]
Var.Handle = Handle
Var.MapIndex = MapIndex
Var.FellowHandle = {}
Var.FellowHandle[1] = -1
Var.FellowHandle[2] = -1
Var.NextSummonIndex = 1
Var.BoxVanish = 0 -- 10<EFBFBD>ʿ<EFBFBD> <EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ڽ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Var.TargetLostSec = 0 -- Ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD>
Var.NextBuff = 0 -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ð<EFBFBD>
Var.Wait = {}
Var.Wait.Second = 0;
Var.Wait.NextFunc = nil
Var.StepFunc = Boss_WaitInvader
end
return Var.StepFunc(Var)
end
function Boss_Wait(Var) -- Var.Wait.Second<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>ٸ<EFBFBD> <EFBFBD><EFBFBD> StepFunc<EFBFBD><EFBFBD> WaitFunction<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
cExecCheck "Boss_Wait"
if cCurSec() >= Var.Wait.Second then
Var.StepFunc = Var.Wait.NextFunc
end
end
function Boss_WaitInvader(Var)
cExecCheck "Boss_WaitInvader"
local CurSecond = cCurSec()
if CurSecond > Var.BoxVanish then
Common_RemoveTreasure(Var.MapIndex)
Var.BoxVanish = CurSecond + 10
end
local hp
local maxhp
hp, maxhp = cObjectHP(Var.Handle)
if hp < maxhp then
Var.NextBuff = cCurSec() + HumarBuffSec
Var.StepFunc = Boss_SummonCheck
end
if hp == maxhp and Var.NextSummonIndex ~= 1 then
Var.NextSummonIndex = 1
cDebugLog "Summon Reset"
end
return ReturnAI.END
end
function Boss_BuffCheck(Var)
cExecCheck "Boss_BuffCheck"
hp, maxhp = cObjectHP(Var.Handle)
if hp == maxhp then
Var.StepFunc = Boss_WaitInvader -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD>, <EFBFBD><EFBFBD> ȸ<EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><EFBFBD><EFBFBD>
return
end
if cCurSec() >= Var.NextBuff then
cDebugLog "Buffing"
if cNPCSkillUse(Var.Handle, Var.Handle, HumarBuffSkill) ~= nil then
Var.NextBuff = cCurSec() + HumarBuffSec
else
cDebugLog "Fail"
end
end
Var.StepFunc = Boss_SummonCheck
end
function Boss_SummonCheck(Var)
cExecCheck "Boss_SummonCheck"
local hp
local maxhp
hp, maxhp = cObjectHP(Var.Handle)
if hp * 1000 < maxhp * SummonRate[Var.NextSummonIndex] and cNPCSkillUse(Var.Handle, Var.Handle, SummonSkillName) == 1 then
cDebugLog("Summon Index " .. Var.NextSummonIndex)
Var.NextSummonIndex = Var.NextSummonIndex + 1
Var.Wait.Second = cCurSec() + SummonSkillCastSecond
Var.Wait.NextFunc = Boss_SummomFellow
Var.StepFunc = Boss_Wait
return
end
-- <EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD> <EFBFBD>׾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Ȯ<EFBFBD><EFBFBD>
for fel = 1, 2 do
if Var.FellowHandle[fel] ~= -1 and cIsObjectDead(Var.FellowHandle[fel]) ~= nil then
Var.FellowHandle[fel] = -1
end
end
if cTargetHandle(Var.Handle) ~= nil then -- Ÿ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Var.TargetLostSec = cCurSec()
elseif Var.TargetLostSec + 10 < cCurSec() then -- Ÿ<EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Var.StepFunc = Boss_WaitInvader
cResetAbstate(Var.Handle, HumarBuffAbState) -- <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
-- Remove fallows
for k = 1, 2 do
if Var.FellowHandle[k] ~= -1 then
cNPCVanish(Var.FellowHandle[k])
Var.FellowHandle[k] = -1
end
end
end
Var.StepFunc = Boss_BuffCheck
return ReturnAI.CPP
end
function Boss_SummomFellow(Var)
cExecCheck "Boss_SummomFellow"
local summon = false
for fel = 1, 2 do
if Var.FellowHandle[fel] == -1 then
Var.FellowHandle[fel] = cMobRegen_Obj(FellowIndex[fel], Var.Handle)
summon = true
end
end
if summon then
cNPCChat(Var.Handle, "BH_Humar_Sum")
end
Var.StepFunc = Boss_SummonCheck
end
-------------------------------------------------------------------------
----------------------- InvisibleMan Part --------------------------
-------------------------------------------------------------------------
-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ
function InvisibleMan(Handle, MapIndex)
cExecCheck "InvisibleMan"
local Var = MemBlock[Handle]
if Var == nil then
----cDebugLog("InvisibleMan Handle Error:" .. Handle)
return
end
if Var.StepFunc ~= nil then
Var.StepFunc(Var)
end
return ReturnAI.END
end
function Invisible_Init(Var)
cExecCheck "Invisible_Init"
cDebugLog "Invisible_Init"
----------------------------------------------------------------------
-- Mantis 7984
-- <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>
for i = 1, #BH_HumarBox
do
local BoxHandle = cMobRegen_Rectangle( Var["MapIndex"], BH_HumarBox[i]["Index"], BH_HumarBox[i]["x"], BH_HumarBox[i]["y"], BH_HumarBox[i]["width"], BH_HumarBox[i]["height"], BH_HumarBox[i]["rotate"] )
if BoxHandle ~= nil
then
cSetItemDropMobID( BoxHandle, BH_HumarBox[i]["ItemDropMobIndex"] )
end
end
----------------------------------------------------------------------
cGroupRegen("BH_Cracker", "BH_HumarBox") -- <EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Var.Wait = {}
Var.Wait.Second = cCurSec() + 60
Var.StepFunc = Invisible_AllVanish
end
function Invisible_AllVanish(Var)
cExecCheck "Invisible_AllVanish"
if cCurSec() > Var.Wait.Second then
cDebugLog "Invisible_AllVanish"
cRegenGroupActiv("BH_Cracker", "BH_HumarBox", 0) -- <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> 1<EFBFBD≯<EFBFBD> activ)
Common_RemoveTreasure(Var.MapIndex)
cNPCVanish(Var.Handle)
Var.StepFunc = nil
end
end