require( "common" ) LoussierMemBlock = {} function AdlFH_Loussier( Handle, MapIndex ) cExecCheck "AdlFH_Loussier" local Var = LoussierMemBlock[Handle] if cIsObjectDead( Handle ) then -- Á×¾úÀ½ cAIScriptSet( Handle ) -- ½ºÅ©¸³Æ® ¾ø¾Ú LoussierMemBlock[Handle] = nil -- ¸Þ¸ð¸®ÇØÁ¦ cMobDialog( MapIndex, DialogInfo.Loussier_Death[1].Portrait, DialogInfo.Loussier_Death[1].FileName, DialogInfo.Loussier_Death[1].Index ) cDebugLog( "AdlF_Loussier Dead" ) return ReturnAI.END end local cursec = cCurrentSecond() if Var == nil then LoussierMemBlock[Handle] = {} Var = LoussierMemBlock[Handle] Var.Handle = Handle Var.MapIndex = MapIndex Var.MoveToChkTime = nil Var.MoveTo = nil Var.CurSec = cursec Var.StepFunc = Loussier_Default cAIScriptFunc( Var.Handle, "NPCClick", "Loussier_Click" ) cAIScriptFunc( Var.Handle, "NPCMenu", "Loussier_Menu" ) cSetNPCParam ( Var.Handle, "HPRegen", RegenInfo.Loussier.HPRegen ) end if Var.CurSec < cursec then Var.CurSec = cursec + 0.5 local PlayerList = { cGetPlayerList( Var.MapIndex ) } for i=1, #PlayerList do if cDistanceSquar( Var.Handle, PlayerList[i] ) < 160000 then cSetAbstate( PlayerList[i], LOUSSIBUF, 1, 999 ) end end end return Var.StepFunc( Var ) end function Loussier_Default( Var ) if Var == nil then return ReturnAI.CPP end if InstanceField[Var.MapIndex] == nil then return ReturnAI.CPP end local Field = InstanceField[Var.MapIndex] -- ¼Òȯ¸¶¹ý¼® ÀÛµ¿ ÀÌÈÄ¿¡´Â ¾Æ¹« ÇൿÀ» ÇÏÁö ¾Êµµ·Ï ÇÔ if Field.SummonStone_Active ~= nil then return ReturnAI.END end -- ·ç½Ã¿¡ °ü·Ã ¿¬Ãâ ÁßÀ϶§´Â ¾Æ¹« ÇൿÀ» ÇÏÁö ¾Êµµ·Ï ÇÔ if Field.Loussier_Stop ~= nil then return ReturnAI.END end -- ¼Òȯ¸¶¹ý¼® ij½ºÆÃÁß¿¡´Â ¾Æ¹« ÇൿÀ» ÇÏÁö ¾Êµµ·Ï ÇÔ if Var.StepFunc == LoussierSummonStoneCasting then return ReturnAI.END end return ReturnAI.CPP end function MoveToPlayer( Var ) cExecCheck "MoveToPlayer" if Var == nil then Var.StepFunc = Loussier_Default return ReturnAI.CPP end -- ¸ñÇ¥°¡ ÀÖ´ÂÁö üũ if Var.MoveTo == nil then Var.StepFunc = Loussier_Default return ReturnAI.CPP end -- À̵¿Ã³¸®°¡ ÇÊ¿äÇÑ °Å¸®¸é 1ÃÊ ´ÜÀ§·Î ¸ñÇ¥Á¡À» ¹Ù²ãÁÖ¸ç À̵¿ local CurSec = cCurrentSecond() if Var.MoveToChkTime == nil or Var.MoveToChkTime <= CurSec then if cFollow( Var.Handle, Var.MoveTo, 100, 1000 ) == nil then Var.StepFunc = Loussier_Default Var.MoveTo = nil return ReturnAI.CPP end Var.MoveToChkTime = CurSec + 1 end return ReturnAI.CPP end function Loussier_Click(NPCHandle, PlyHandle, RegistNumber) cExecCheck "Loussier_Click" local Var = LoussierMemBlock[NPCHandle] if Var == nil then cDebugLog( "Loussier_Click : nil NPC " .. NPCHandle ) return 0 end if InstanceField[Var.MapIndex] == nil then return end local Field = InstanceField[Var.MapIndex] -- ¼Òȯ¸¶¹ý¼® ÀÛµ¿ ÀÌÈÄ¿¡´Â ¾Æ¹« ÇൿÀ» ÇÏÁö ¾Êµµ·Ï ÇÔ if Field.SummonStone_Active ~= nil then return end -- ·ç½Ã¿¡ °ü·Ã ¿¬Ãâ ÁßÀ϶§´Â ¾Æ¹« ÇൿÀ» ÇÏÁö ¾Êµµ·Ï ÇÔ if Field.Loussier_Stop ~= nil then return end -- ¼Òȯ¸¶¹ý¼® ij½ºÆÃÁß¿¡´Â ¾Æ¹« ÇൿÀ» ÇÏÁö ¾Êµµ·Ï ÇÔ if Var.StepFunc == LoussierSummonStoneCasting then return end cNPCMenuOpen( NPCHandle, PlyHandle ) end function Loussier_Menu(NPCHandle, PlyHandle, RegistNumber, Menu) cExecCheck "Loussier_Menu" local Var = LoussierMemBlock[NPCHandle] if Var == nil then cDebugLog( "Loussier_Menu : nil NPC " .. NPCHandle ) return end if Menu == 1 then LussierFollow( NPCHandle, PlyHandle, RegistNumber ) elseif Menu == 2 then LussierWait( NPCHandle, PlyHandle, RegistNumber ) elseif Menu == 3 then LussierSummonStone( NPCHandle, PlyHandle, RegistNumber ) else cDebugLog( "Loussier_Menu : Invalid Menu " .. Menu ) end end -- µû¶ó°¡±â ¼³Á¤ function LussierFollow( NPCHandle, PlyHandle, RegistNumber ) cExecCheck "LussierFollow" local Var = LoussierMemBlock[NPCHandle] if Var == nil then cDebugLog( "LussierFollow : nil NPC " .. NPCHandle ) return end Var.StepFunc = MoveToPlayer Var.MoveTo = PlyHandle cScriptMessage( Var.MapIndex, AnnounceInfo.AdlF_Loussier_Follow, cGetPlayerName( PlyHandle ) ) end -- µû¶ó°¡±â ÇØÁ¦ function LussierWait( NPCHandle, PlyHandle, RegistNumber ) cExecCheck "LussierWait" local Var = LoussierMemBlock[NPCHandle] if Var == nil then cDebugLog( "LussierWait : nil NPC " .. NPCHandle ) return end Var.StepFunc = Loussier_Default Var.MoveTo = nil end -- ¼Òȯ¼® ÀÛµ¿ function LussierSummonStone( NPCHandle, PlyHandle, RegistNumber ) cExecCheck "LussierSummonStone" local Var = LoussierMemBlock[NPCHandle] if Var == nil then cDebugLog( "LussierWait : nil NPC " .. NPCHandle ) return end if cGetAreaObject( Var.MapIndex, AreaIndex.Zone3_2, NPCHandle ) == nil then cScriptMessage( Var.MapIndex, AnnounceInfo.AdlF_Loussier_RStone ) return end Var.StepFunc = LoussierSummonStoneCastingStart end function LoussierSummonStoneCastingStart( Var ) cExecCheck "LoussierSummonStoneCastingStart" if Var == nil then return ReturnAI.CPP end -- Çʵå Àü¿ªº¯¼ö if InstanceField[Var.MapIndex] == nil then Var.StepFunc = Loussier_Default return ReturnAI.CPP end local Field = InstanceField[Var.MapIndex] if Field.SummonStone_Active ~= nil then Var.StepFunc = Loussier_Default return ReturnAI.CPP end if Field.SummonStone == nil then Var.StepFunc = Loussier_Default return ReturnAI.CPP end if cDistanceSquar( Var.Handle, Field.SummonStone ) <= 30000 then cSkillBlast( Var.Handle, Field.SummonStone, "AdlF_Loussier_Skill04_N" ) Var.StepFunc = LoussierSummonStoneCasting return ReturnAI.CPP else if cFollow( Var.Handle, Field.SummonStone, 170, 10000 ) == nil then Var.StepFunc = Loussier_Default Var.MoveTo = nil return ReturnAI.CPP end end return ReturnAI.END end function LoussierSummonStoneCasting( Var ) if Var == nil then return ReturnAI.CPP end -- Çʵå Àü¿ªº¯¼ö if InstanceField[Var.MapIndex] == nil then Var.StepFunc = Loussier_Default return ReturnAI.CPP end local Field = InstanceField[Var.MapIndex] local CurSec = cCurrentSecond() if Var.Casting_Step == nil then Var.Casting_Step = 1 Var.Casting_Step_Delay = CurSec + 2 return ReturnAI.CPP end if Var.Casting_Step == 1 then if Var.Casting_Step_Delay > CurSec then return ReturnAI.END end Field.SummonStone_Active= "Loussier" Var.Casting_Step = 2 Var.Casting_Step_Delay = CurSec return ReturnAI.CPP end Var.Casting_Step = nil Var.Casting_Step_Delay = nil Var.StepFunc = Loussier_Default return ReturnAI.END end