All pastes #390108 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-03-11 04:08 UTC
rendered paste body
function TEST_Threat_AI.DoCastRandomChance(LuaAI, target, chance, spellID, casttime)
	local letsDoSpell = rand_range(1,100)

	if (letsDoSpell >= (100 - chance) ) then
		if( spellID > 0 ) then
			LuaAI:DoStopAttack();
			-- stopped attack to cast
			--need to make mob start cast here (emote with spell gfx)
			-- add if hit check and random cast time reset
			LuaAI:GetCreature():HandleEmoteCommand(EMOTE_STATE_SPELLPRECAST)
			LuaAI:SetUpdateInterval(casttime)
			LuaAI:DoCast(target, spellID);

			LuaAI:DoSay("waiting for "..tostring(casttime), 0)
			--start attack again
			LuaAI:DoStartAttack(target);
		end
	end

end