[8146] Fixed handling of eventchance for CreatureEventAI. Author: ApoC
Check event chance after timers advances othewise event is
not scheduled to next time period and event chance is again
checked on next AI update.
--HG--
branch : trunk
This commit is contained in:
@@ -113,13 +113,6 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
|||||||
if (pHolder.Event.event_inverse_phase_mask & (1 << Phase))
|
if (pHolder.Event.event_inverse_phase_mask & (1 << Phase))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
//Store random here so that all random actions match up
|
|
||||||
uint32 rnd = rand();
|
|
||||||
|
|
||||||
//Return if chance for event is not met
|
|
||||||
if (pHolder.Event.event_chance <= rnd % 100)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
CreatureEventAI_Event const& event = pHolder.Event;
|
CreatureEventAI_Event const& event = pHolder.Event;
|
||||||
|
|
||||||
//Check event conditions based on the event type, also reset events
|
//Check event conditions based on the event type, also reset events
|
||||||
@@ -331,6 +324,13 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
|
|||||||
if (!(pHolder.Event.event_flags & EFLAG_REPEATABLE))
|
if (!(pHolder.Event.event_flags & EFLAG_REPEATABLE))
|
||||||
pHolder.Enabled = false;
|
pHolder.Enabled = false;
|
||||||
|
|
||||||
|
//Store random here so that all random actions match up
|
||||||
|
uint32 rnd = rand();
|
||||||
|
|
||||||
|
//Return if chance for event is not met
|
||||||
|
if (pHolder.Event.event_chance <= rnd % 100)
|
||||||
|
return false;
|
||||||
|
|
||||||
//Process actions
|
//Process actions
|
||||||
for (uint32 j = 0; j < MAX_ACTIONS; j++)
|
for (uint32 j = 0; j < MAX_ACTIONS; j++)
|
||||||
ProcessAction(pHolder.Event.action[j], rnd, pHolder.Event.event_id, pActionInvoker);
|
ProcessAction(pHolder.Event.action[j], rnd, pHolder.Event.event_id, pActionInvoker);
|
||||||
|
|||||||
Reference in New Issue
Block a user