mirror of
https://github.com/araxiaonline/TrinityCore.git
synced 2026-06-14 12:12:34 -04:00
Creature/CreatureAI:
- Default range for DoZoneInCombat: 50.0f -> 250.0f. - Add optional second arg to SummonList::DoZoneInCombat to specify range. - Also a bunch of random NULL -> nullptr cleanup.
This commit is contained in:
@@ -32,7 +32,7 @@ struct TSpellSummary
|
||||
uint8 Effects; // set of enum SelectEffect
|
||||
} extern* SpellSummary;
|
||||
|
||||
void SummonList::DoZoneInCombat(uint32 entry)
|
||||
void SummonList::DoZoneInCombat(uint32 entry, float maxRangeToNearestTarget)
|
||||
{
|
||||
for (StorageType::iterator i = storage_.begin(); i != storage_.end();)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ void SummonList::DoZoneInCombat(uint32 entry)
|
||||
if (summon && summon->IsAIEnabled
|
||||
&& (!entry || summon->GetEntry() == entry))
|
||||
{
|
||||
summon->AI()->DoZoneInCombat();
|
||||
summon->AI()->DoZoneInCombat(nullptr, maxRangeToNearestTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,11 +183,11 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
|
||||
{
|
||||
//No target so we can't cast
|
||||
if (!target)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
//Silenced so we can't cast
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
//Using the extended script system we first create a list of viable spells
|
||||
SpellInfo const* apSpell[MAX_CREATURE_SPELLS];
|
||||
@@ -195,7 +195,7 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
|
||||
|
||||
uint32 spellCount = 0;
|
||||
|
||||
SpellInfo const* tempSpell = NULL;
|
||||
SpellInfo const* tempSpell = nullptr;
|
||||
|
||||
//Check if each spell is viable(set it to null if not)
|
||||
for (uint32 i = 0; i < MAX_CREATURE_SPELLS; i++)
|
||||
@@ -251,7 +251,7 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec
|
||||
|
||||
//We got our usable spells so now lets randomly pick one
|
||||
if (!spellCount)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return apSpell[urand(0, spellCount - 1)];
|
||||
}
|
||||
@@ -327,7 +327,7 @@ void ScriptedAI::DoTeleportAll(float x, float y, float z, float o)
|
||||
|
||||
Unit* ScriptedAI::DoSelectLowestHpFriendly(float range, uint32 minHPDiff)
|
||||
{
|
||||
Unit* unit = NULL;
|
||||
Unit* unit = nullptr;
|
||||
Trinity::MostHPMissingInRange u_check(me, range, minHPDiff);
|
||||
Trinity::UnitLastSearcher<Trinity::MostHPMissingInRange> searcher(me, unit, u_check);
|
||||
me->VisitNearbyObject(range, searcher);
|
||||
@@ -357,7 +357,7 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 u
|
||||
|
||||
Player* ScriptedAI::GetPlayerAtMinimumRange(float minimumRange)
|
||||
{
|
||||
Player* player = NULL;
|
||||
Player* player = nullptr;
|
||||
|
||||
CellCoord pair(Trinity::ComputeCellCoord(me->GetPositionX(), me->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
|
||||
Reference in New Issue
Block a user