-- /\/\ __ _ _ __ __ _ ___ / _\ ___ _ __(_)_ __ | |_ -- / \ / _` | '_ \ / _` |/ _ \\ \ / __| '__| | '_ \| __| -- / /\/\ \ (_| | | | | (_| | (_) |\ \ (__| | | | |_) | |_ -- \/ \/\__,_|_| |_|\__, |\___/\__/\___|_| |_| .__/ \__| -- |___/ |_| -- A WHOLE NEW WORLD -- MangoScript - Bringing a whole new world to MaNGOS -- -- ULD_Revelosh_AI.lua - Script for generic spell casting mobs -- based on ther Herod script by SinnerG -- -- (c) Copyright 2006-2007 by the MangoScript Team -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -- -- $Id: ULD_Revelosh_AI.lua 01 2007-02-05 13:15:09Z biglad $ -- Create the Mango AIScript Base object arcanist_doan_AI = Mango.AIScripts.Create('arcanist_doan_AI'); arcanist_doan_AI.AgroDistance = 20; -- Experiment with this :p -- Function prototypes (to keep it clean) local arcanist_doan_AI_Init; local arcanist_doan_AI_MoveInLineOfSight; local arcanist_doan_AI_AttackStart; local arcanist_doan_AI_DamageInflict; -- this will check if player is drawing agro function arcanist_doan_AI.CheckAggro(LuaAI,unit) local data = LuaAI:Data() if LuaAI:GetCreature():GetDistanceSq(unit) < arcanist_doan_AI.AgroDistance then LuaAI:DoStartAttack(unit); if (data["IsAttacking"] == false) then data["IsAttacking"] = true; -- Cast first spell (9433 - Arcane Explosion) -- LuaAI:DoSay("You will not defile these mysteries!",0); LuaAI:DoCast(LuaAI:GetCreature(), 9433); LuaAI:SetData(data) end end end function arcanist_doan_AI_Init(LuaAI) local data = LuaAI:Data() -- Initialize AI data data = { } data["IsAttacking"] = true; data["Silence"] = false; data["Detonation"] = false; data["Arcane Explosion"] = false; data["Arcane Bubble"] = false; LuaAI:SetData(data) return true end function arcanist_doan_AI_MoveInLineOfSight(LuaAI,unit) arcanist_doan_AI.CheckAggro(LuaAI,unit) -- Check if the guard has to talk or not :) LuaAI:MoveInLineOfSight_agr(unit) end -- Called at each attack of creature by any victim function arcanist_doan_AI_AttackStart(LuaAI,unit) local data = LuaAI:Data() --LuaAI:GetCreature():StopMoving() --LuaAI:DoCast(unit,spellid) arcanist_doan_AI.CheckAggro(LuaAI, unit); LuaAI:DoStartAttack(unit) end function arcanist_doan_AI_DamageInflict(LuaAI,unit,amount_damage) local data = LuaAI:Data() local HP = LuaAI:GetCreature():GetHealth(); local MaxHP = LuaAI:GetCreature():GetMaxHealth(); if data["Arcane Bubble Time"] == nil then data["Arcane Bubble Time"] = os.time(); end local nowtime = os.time(); local casttimecheck = (nowtime - data["Arcane Bubble Time"]) if (data["Silence"] == false) then if casttimecheck >= 8 then -- Silence local num = rand_range(0,100) if (num >= 50) then LuaAI:DoShout("Burn in righteous fire!", 0); -- Burn in Fire else LuaAI:DoSay("Burn in righteous fire!", 0); -- Fire2 end LuaAI:DoCast(unit, 9438); data["Arcane Bubble Time"] = os.time(); data["Arcane Bubble"] = true; LuaAI:SetData(data) return; end end if (data["Detonation"] == false) then if (100 / MaxHP * HP < 50) then local num1 = rand_range(0,100) if (num1 > 50) then spellid = 9435 else if (num1 > 50) then spellid = 9435 end LuaAI:DoCast(unit,spellid) data["Detonation"] = true; LuaAI:SetData(data) return; end end if (data["Lightning Bolt2"] == false) then if (100 / MaxHP * HP < 45) then -- not sure if this works -- Lightning Bolt -- Don't know exact spellid, using this one atm : 6041 -- Description: Lashes out in a vicious arc, inflicting damage to enemies in a cone in front of the caster. local num2 = rand_range(0,100) if (num2 > 80) then spellid = 6041 elseif (num1 < 80) then spellid = 6603 end LuaAI:DoCast(unit,spellid) data["Lightning Bolt2"] = true; LuaAI:SetData(data) return; end end end -- Assign the functions ULD_Revelosh_AI.Init = ULD_Revelosh_AI_Init; ULD_Revelosh_AI.MoveInLineOfSight = ULD_Revelosh_AI_MoveInLineOfSight; ULD_Revelosh_AI.AttackStart = ULD_Revelosh_AI_AttackStart; ULD_Revelosh_AI.DamageInflict = ULD_Revelosh_AI_DamageInflict; -- Link the AI to the different scripts -- Note: Only the ones who use the Mango.Scripts method of scripting can use ULD_Revelosh_AI ULD_Revelosh_AI:Register('uld_revelosh');