diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/ScriptedCreature.cpp | 6 | ||||
-rw-r--r-- | src/game/ScriptedCreature.h | 2 | ||||
-rw-r--r-- | src/game/ScriptedGuardAI.cpp | 10 | ||||
-rw-r--r-- | src/scripts/world/mob_generic_creature.cpp | 10 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/game/ScriptedCreature.cpp b/src/game/ScriptedCreature.cpp index 1a2060f330c..8c4ddd14f07 100644 --- a/src/game/ScriptedCreature.cpp +++ b/src/game/ScriptedCreature.cpp @@ -197,7 +197,7 @@ Unit* ScriptedAI::SelectUnit(SelectAggroTarget pTarget, uint32 uiPosition) } } -SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects) +SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, uint32 uiSchool, uint32 uiMechanic, SelectTargetType selectTargets, uint32 uiPowerCostMin, uint32 uiPowerCostMax, float fRangeMin, float fRangeMax, SelectEffect selectEffects) { //No target so we can't cast if (!pTarget) @@ -235,11 +235,11 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* pTarget, int32 uiSchool, int32 u continue; //Check for school if specified - if (uiSchool >= 0 && pTempSpell->SchoolMask & uiSchool) + if (uiSchool && (pTempSpell->SchoolMask & uiSchool) == 0) continue; //Check for spell mechanic if specified - if (uiMechanic >= 0 && pTempSpell->Mechanic != uiMechanic) + if (uiMechanic && pTempSpell->Mechanic != uiMechanic) continue; //Make sure that the spell uses the requested amount of power diff --git a/src/game/ScriptedCreature.h b/src/game/ScriptedCreature.h index a275111ddf1..a7b8b530f66 100644 --- a/src/game/ScriptedCreature.h +++ b/src/game/ScriptedCreature.h @@ -156,7 +156,7 @@ struct ScriptedAI : public CreatureAI bool HealthBelowPct(uint32 pct) const { return me->GetHealth() * 100 < me->GetMaxHealth() * pct; } //Returns spells that meet the specified criteria from the creatures spell list - SpellEntry const* SelectSpell(Unit* Target, int32 School, int32 Mechanic, SelectTargetType Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect); + SpellEntry const* SelectSpell(Unit* Target, uint32 School, uint32 Mechanic, SelectTargetType Targets, uint32 PowerCostMin, uint32 PowerCostMax, float RangeMin, float RangeMax, SelectEffect Effect); //Checks if you can cast the specified spell bool CanCast(Unit* pTarget, SpellEntry const* pSpell, bool bTriggered = false); diff --git a/src/game/ScriptedGuardAI.cpp b/src/game/ScriptedGuardAI.cpp index 2fbf8bff1cb..68dc8690470 100644 --- a/src/game/ScriptedGuardAI.cpp +++ b/src/game/ScriptedGuardAI.cpp @@ -71,7 +71,7 @@ void guardAI::UpdateAI(const uint32 diff) if (BuffTimer <= diff) { //Find a spell that targets friendly and applies an aura (these are generally buffs) - SpellEntry const *info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); + SpellEntry const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); if (info && !GlobalCooldown) { @@ -102,11 +102,11 @@ void guardAI::UpdateAI(const uint32 diff) //Select a healing spell if less than 30% hp if (me->GetHealth()*100 / me->GetMaxHealth() < 30) - info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); //No healing spell available, select a hostile spell if (info) Healing = true; - else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); + else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); //20% chance to replace our white hit with a spell if (info && rand() % 5 == 0 && !GlobalCooldown) @@ -133,11 +133,11 @@ void guardAI::UpdateAI(const uint32 diff) //Select a healing spell if less than 30% hp ONLY 33% of the time if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0) - info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); //No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE) if (info) Healing = true; - else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); + else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); //Found a spell, check if we arn't on cooldown if (info && !GlobalCooldown) diff --git a/src/scripts/world/mob_generic_creature.cpp b/src/scripts/world/mob_generic_creature.cpp index 48845050a8f..3ab515d8206 100644 --- a/src/scripts/world/mob_generic_creature.cpp +++ b/src/scripts/world/mob_generic_creature.cpp @@ -61,7 +61,7 @@ struct generic_creatureAI : public ScriptedAI if (BuffTimer <= diff) { //Find a spell that targets friendly and applies an aura (these are generally buffs) - SpellEntry const *info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); + SpellEntry const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); if (info && !GlobalCooldown) { @@ -92,11 +92,11 @@ struct generic_creatureAI : public ScriptedAI //Select a healing spell if less than 30% hp if (me->GetHealth()*100 / me->GetMaxHealth() < 30) - info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); //No healing spell available, select a hostile spell if (info) Healing = true; - else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); + else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, 0, 0, SELECT_EFFECT_DONTCARE); //50% chance if elite or higher, 20% chance if not, to replace our white hit with a spell if (info && (rand() % (me->GetCreatureInfo()->rank > 1 ? 2 : 5) == 0) && !GlobalCooldown) @@ -123,11 +123,11 @@ struct generic_creatureAI : public ScriptedAI //Select a healing spell if less than 30% hp ONLY 33% of the time if (me->GetHealth()*100 / me->GetMaxHealth() < 30 && rand() % 3 == 0) - info = SelectSpell(me, -1, -1, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); + info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_HEALING); //No healing spell available, See if we can cast a ranged spell (Range must be greater than ATTACK_DISTANCE) if (info) Healing = true; - else info = SelectSpell(me->getVictim(), -1, -1, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); + else info = SelectSpell(me->getVictim(), 0, 0, SELECT_TARGET_ANY_ENEMY, 0, 0, NOMINAL_MELEE_RANGE, 0, SELECT_EFFECT_DONTCARE); //Found a spell, check if we arn't on cooldown if (info && !GlobalCooldown) |