fix(Core/Creature): Fire Elemental Invasion changes (#9372)

* fix(DB): Blazing elemental invasion event

- Fixed Elemental Invader's SmartAI;
- Re-arranged Elemental Rifts SmartAI for controlled spawning of
  Invaders.

* SmartAI: SetCounter to be able to subtract

* Target unit or summoner changed for worldobjects

* extra checks and last sql file

* Codestyle

* codestyle

* adding Baron to elemental invasions

* changed owner or summoner target (SmartAI)

* codestyle
This commit is contained in:
Cláudio Costa
2022-01-06 18:30:23 +00:00
committed by GitHub
parent cb7e355291
commit 5d45c52c3e
6 changed files with 61 additions and 19 deletions

View File

@@ -143,18 +143,28 @@ public:
return nullptr;
}
void StoreCounter(uint32 id, uint32 value, uint32 reset)
void StoreCounter(uint32 id, uint32 value, uint32 reset, uint32 subtract)
{
CounterMap::iterator itr = mCounterList.find(id);
if (itr != mCounterList.end())
{
if (reset == 0)
if (!reset && !subtract)
{
itr->second += value;
}
else if (subtract)
{
itr->second -= value;
}
else
{
itr->second = value;
}
}
else
{
mCounterList.insert(std::make_pair(id, value));
}
ProcessEventsFor(SMART_EVENT_COUNTER_SET, nullptr, id);
}