Fixed Carrion Feeder pet talent

Removed useless code for Wolverine Bite

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-08-04 12:12:58 +02:00
parent dc6c3f96b1
commit 705de07e7e
7 changed files with 96 additions and 5 deletions
@@ -349,5 +349,22 @@ bool CannibalizeObjectCheck::operator()(Corpse* u)
return false;
}
bool CarrionFeederObjectCheck::operator()(Corpse* u)
{
// ignore bones
if (u->GetType() == CORPSE_BONES)
return false;
Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID());
if (!owner || i_funit->IsFriendlyTo(owner))
return false;
if (i_funit->IsWithinDistInMap(u, i_range))
return true;
return false;
}
template void ObjectUpdater::Visit<GameObject>(GameObjectMapType &);
template void ObjectUpdater::Visit<DynamicObject>(DynamicObjectMapType &);
@@ -562,6 +562,32 @@ namespace Trinity
float i_range;
};
class CarrionFeederObjectCheck
{
public:
CarrionFeederObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {}
bool operator()(Player* u)
{
if (i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight())
return false;
return i_funit->IsWithinDistInMap(u, i_range);
}
bool operator()(Corpse* u);
bool operator()(Creature* u)
{
if (i_funit->IsFriendlyTo(u) || u->isAlive() || u->isInFlight() ||
(u->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL) != 0)
return false;
return i_funit->IsWithinDistInMap(u, i_range);
}
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
private:
Unit* const i_funit;
float i_range;
};
// WorldObject do classes
class RespawnDo
+6 -1
View File
@@ -542,8 +542,13 @@ void Spell::SelectSpellTargets()
switch(m_spellInfo->Id)
{
case 20577: // Cannibalize
case 54044: // Carrion Feeder
{
WorldObject* result = FindCorpseUsing<Trinity::CannibalizeObjectCheck> ();
WorldObject* result = NULL;
if (m_spellInfo->Id == 20577)
result = FindCorpseUsing<Trinity::CannibalizeObjectCheck>();
else
result = FindCorpseUsing<Trinity::CarrionFeederObjectCheck>();
if (result)
{
-3
View File
@@ -715,10 +715,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
damage += m_caster->ToPlayer()->GetAmmoDPS()*item->GetProto()->Delay*0.001f;
}
}
}
else if (m_spellInfo->Id == 53508)
damage *= m_caster->getLevel();
break;
}
case SPELLFAMILY_PALADIN:
@@ -31,6 +31,7 @@ enum HunterSpells
HUNTER_PET_HEART_OF_THE_PHOENIX = 55709,
HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED = 54114,
HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF = 55711,
HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED = 54045,
};
class spell_hun_last_stand_pet_SpellScript : public SpellScript
@@ -163,6 +164,42 @@ SpellScript * GetSpellScript_spell_hun_pet_heart_of_the_phoenix()
return new spell_hun_pet_heart_of_the_phoenix();
}
class spell_hun_pet_carrion_feeder : public SpellScript
{
bool Validate(SpellEntry const * spellEntry)
{
if (!sSpellStore.LookupEntry(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED))
return false;
return true;
}
void HandleDummy(SpellEffIndex effIndex)
{
if (!GetHitUnit())
return;
Unit *caster = GetCaster();
caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false);
}
void Register()
{
// add dummy effect spell handler to pet's Last Stand
EffectHandlers += EffectHandlerFn(spell_hun_pet_carrion_feeder::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
bool Load()
{
if (!GetCaster()->isPet())
return false;
return true;
}
};
SpellScript * GetSpellScript_spell_hun_pet_carrion_feeder()
{
return new spell_hun_pet_carrion_feeder();
}
void AddSC_hunter_spell_scripts()
{
Script *newscript;
@@ -186,4 +223,9 @@ void AddSC_hunter_spell_scripts()
newscript->Name = "spell_hun_pet_heart_of_the_phoenix";
newscript->GetSpellScript = &GetSpellScript_spell_hun_pet_heart_of_the_phoenix;
newscript->RegisterSelf();
newscript = new Script;
newscript->Name = "spell_hun_pet_carrion_feeder";
newscript->GetSpellScript = &GetSpellScript_spell_hun_pet_carrion_feeder;
newscript->RegisterSelf();
}