-- /\/\ __ _ _ __ __ _ ___ / _\ ___ _ __(_)_ __ | |_
-- / \ / _` | '_ \ / _` |/ _ \\ \ / __| '__| | '_ \| __|
-- / /\/\ \ (_| | | | | (_| | (_) |\ \ (__| | | | |_) | |_
-- \/ \/\__,_|_| |_|\__, |\___/\__/\___|_| |_| .__/ \__|
-- |___/ |_|
-- A WHOLE NEW WORLD
-- MangoScript - Bringing a whole new world to MaNGOS
--
-- arcanist_doan_AI.lua - Script for generic spell casting mobs
-- based on ther Herod script by SinnerG
--
-- (c) Copyright 2006-2007 by the MangoScript Team <http://www.mangoscript.org>
--
-- 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: arcanist_doan_AI.lua 01 2007-03-20 15:20:09Z Homie $
-- 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"] == false) then
end
if (100 / MaxHP * HP <= 50) then
end
local num = rand_range(0,100)
if (num >= 50) then
end
LuaAI:DoShout("Burn in righteous fire!", 0);
else
LuaAI:DoSay("Burn in righteous fire!", 0);
LuaAI:DoCast(unit, 9438);
data["Arcane Bubble"] = true;
LuaAI:SetData(data)
return;
if (data["Detonation"] == false) then
end
if (100 / MaxHP * HP < 50) then
end
local num1 = rand_range(0,100)
if (num1 > 50) then spellid = 9435
end
else if (num1 > 50) then spellid = 9435
end
LuaAI:DoCast(unit,spellid)
data["Detonation"] = true;
LuaAI:SetData(data)
return;
if data["Arcane Explosion Time"] == nil then
data["Arcane Explosion Time"] = os.time();
end
local nowtime = os.time();
local casttimecheck = (nowtime - data["Arcane Explosion Time"])
if (data["Silence"] == false) then
if casttimecheck >= 8 then
end
-- Arcane Explosion
local num = rand_range(0,100)
if (num >= 50) then
end
LuaAI:DoCast(unit, 9433);
data["Arcane Explosion Time"] = os.time();
data["Arcane Explosion"] = true;
LuaAI:SetData(data)
return;
end
-- Assign the functions
arcanist_doan_AI.Init = arcanist_doan_AI_Init;
arcanist_doan_AI.MoveInLineOfSight = arcanist_doan_AI_MoveInLineOfSight;
arcanist_doan_AI.AttackStart = arcanist_doan_AI_AttackStart;
arcanist_doan_AI.DamageInflict = arcanist_doan_AI_DamageInflict;
-- Link the AI to the different scripts
-- Note: Only the ones who use the Mango.Scripts method of scripting can use arcanist_doan_AI
arcanist_doan_AI:Register('arcanist_doan');