aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKandera <KanderaDev@gmail.com>2012-06-13 12:39:56 -0400
committerKandera <KanderaDev@gmail.com>2012-06-13 12:39:56 -0400
commit0ddaeaddc8d433908aa3ba3f3828507bed914fc1 (patch)
tree8f64d828c753a4bda0bda5999e3275102b1a1207 /src
parent50bd43661ca2e70a6f068ae8ba7c63e3ede646c0 (diff)
Core/Pets: more updates for pets and add spell_pet.cpp to the cmakelist file
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/CMakeLists.txt1
-rw-r--r--src/server/scripts/Spells/spell_pet.cpp194
2 files changed, 81 insertions, 114 deletions
diff --git a/src/server/scripts/Spells/CMakeLists.txt b/src/server/scripts/Spells/CMakeLists.txt
index 04dcee9287c..2bb695bd8a9 100644
--- a/src/server/scripts/Spells/CMakeLists.txt
+++ b/src/server/scripts/Spells/CMakeLists.txt
@@ -24,6 +24,7 @@ set(scripts_STAT_SRCS
Spells/spell_paladin.cpp
Spells/spell_item.cpp
Spells/spell_holiday.cpp
+ Spells/spell_pet.cpp
)
message(" -> Prepared: Spells")
diff --git a/src/server/scripts/Spells/spell_pet.cpp b/src/server/scripts/Spells/spell_pet.cpp
index 0f16a340863..6ed0f18c785 100644
--- a/src/server/scripts/Spells/spell_pet.cpp
+++ b/src/server/scripts/Spells/spell_pet.cpp
@@ -56,6 +56,7 @@ enum WarlockPetCalculate
ENTRY_FELHUNTER = 417,
ENTRY_SUCCUBUS = 1863,
ENTRY_IMP = 416,
+ SPELL_WARLOCK_GLYPH_OF_VOIDWALKER = 56247,
};
enum DKPetCalculate
@@ -261,6 +262,7 @@ public:
case ENTRY_IMP:
healthMod = uint32(_tempBonus * 8.4f);
break;
+ case ENTRY_FELGUARD:
case ENTRY_VOIDWALKER:
healthMod = _tempBonus * 11;
break;
@@ -270,9 +272,6 @@ public:
case ENTRY_FELHUNTER:
healthMod = uint32(_tempBonus * 9.5f);
break;
- case ENTRY_FELGUARD:
- healthMod = _tempBonus * 11;
- break;
default:
healthMod = 0;
break;
@@ -371,7 +370,7 @@ public:
{
if (!GetCaster() || !GetCaster()->GetOwner() || GetCaster()->GetOwner()->GetTypeId() != TYPEID_PLAYER)
return false;
- _tempMana = 0;
+ _tempBonus = 0;
return true;
}
@@ -386,58 +385,70 @@ public:
ownerBonus = CalculatePctN(owner->GetStat(STAT_INTELLECT), 30);
amount += ownerBonus;
+ _tempBonus = ownerBonus;
}
}
void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* pet = GetUnitOwner())
- if (_tempMana)
- pet->SetPower(POWER_MANA, _tempMana);
+ if (_tempBonus)
+ {
+ PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
+ uint32 manaMod = 0;
+ uint32 baseMana = pInfo->mana;
+ switch (pet->GetEntry())
+ {
+ case ENTRY_IMP:
+ manaMod = uint32(_tempBonus * 4.9f);
+ break;
+ case ENTRY_VOIDWALKER:
+ case ENTRY_SUCCUBUS:
+ case ENTRY_FELHUNTER:
+ case ENTRY_FELGUARD:
+ manaMod = uint32(_tempBonus * 11.5f);
+ break;
+ default:
+ manaMod = 0;
+ break;
+ }
+ if (manaMod)
+ pet->ToPet()->SetCreateMana(baseMana + manaMod);
+ }
}
void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* pet = GetUnitOwner())
- _tempMana = pet->GetPower(POWER_MANA);
+ if (pet->isPet())
+ {
+ PetLevelInfo const* pInfo = sObjectMgr->GetPetLevelInfo(pet->GetEntry(), pet->getLevel());
+ pet->ToPet()->SetCreateMana(pInfo->mana);
+ }
}
void CalculateArmorAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* pet = GetUnitOwner())
- {
- if (!pet->isPet())
- return;
-
- Unit* owner = pet->ToPet()->GetOwner();
- if (!owner)
- return;
-
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePctN(owner->GetArmor(), 35);
-
- amount += ownerBonus;
- }
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetArmor(), 35);
+ amount += ownerBonus;
+ }
}
void CalculateFireResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* pet = GetUnitOwner())
- {
- if (!pet->isPet())
- return;
-
- Unit* owner = pet->ToPet()->GetOwner();
- if (!owner)
- return;
-
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
-
- amount += ownerBonus;
- }
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FIRE), 40);
+ amount += ownerBonus;
+ }
}
void Register()
@@ -450,7 +461,7 @@ public:
}
private:
- uint32 _tempMana;
+ uint32 _tempBonus;
};
AuraScript* GetAuraScript() const
@@ -478,58 +489,37 @@ public:
void CalculateFrostResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* pet = GetUnitOwner())
- {
- if (!pet->isPet())
- return;
-
- Unit* owner = pet->ToPet()->GetOwner();
- if (!owner)
- return;
-
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
-
- amount += ownerBonus;
- }
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_FROST), 40);
+ amount += ownerBonus;
+ }
}
void CalculateArcaneResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* pet = GetUnitOwner())
- {
- if (!pet->isPet())
- return;
-
- Unit* owner = pet->ToPet()->GetOwner();
- if (!owner)
- return;
-
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
-
- amount += ownerBonus;
- }
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_ARCANE), 40);
+ amount += ownerBonus;
+ }
}
void CalculateNatureResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* pet = GetUnitOwner())
- {
- if (!pet->isPet())
- return;
-
- Unit* owner = pet->ToPet()->GetOwner();
- if (!owner)
- return;
-
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
-
- amount += ownerBonus;
- }
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_NATURE), 40);
+ amount += ownerBonus;
+ }
}
void Register()
@@ -566,20 +556,13 @@ public:
void CalculateShadowResistanceAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* pet = GetUnitOwner())
- {
- if (!pet->isPet())
- return;
-
- Unit* owner = pet->ToPet()->GetOwner();
- if (!owner)
- return;
-
- float ownerBonus = 0.0f;
-
- ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
-
- amount += ownerBonus;
- }
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ {
+ float ownerBonus = 0.0f;
+ ownerBonus = CalculatePctN(owner->GetResistance(SPELL_SCHOOL_SHADOW), 40);
+ amount += ownerBonus;
+ }
}
void Register()
@@ -612,8 +595,6 @@ public:
void CalculateAmountMeleeHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
- if (!GetCaster() || !GetCaster()->GetOwner())
- return;
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
{
// For others recalculate it from:
@@ -629,8 +610,6 @@ public:
void CalculateAmountSpellHit(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
- if (!GetCaster() || !GetCaster()->GetOwner())
- return;
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
{
// For others recalculate it from:
@@ -646,8 +625,6 @@ public:
void CalculateAmountExpertise(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
- if (!GetCaster() || !GetCaster()->GetOwner())
- return;
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
{
// For others recalculate it from:
@@ -693,8 +670,6 @@ public:
void CalculateAmountCritSpell(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
- if (!GetCaster() || !GetCaster()->GetOwner())
- return;
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
{
// For others recalculate it from:
@@ -717,8 +692,6 @@ public:
void CalculateAmountCritMelee(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
{
- if (!GetCaster() || !GetCaster()->GetOwner())
- return;
if (Player* owner = GetCaster()->GetOwner()->ToPlayer())
{
// For others recalculate it from:
@@ -751,7 +724,7 @@ public:
return new spell_warl_pet_passive_AuraScript();
}
};
-
+// this doesnt actually fit in here
class spell_warl_pet_passive_damage_done : public SpellScriptLoader
{
public:
@@ -822,17 +795,10 @@ public:
void CalculateAmount(AuraEffect const* aurEff, int32& amount, bool& /*canBeRecalculated*/)
{
if (Unit* pet = GetUnitOwner())
- {
- if (!pet->isPet())
- return;
-
- Unit* owner = pet->ToPet()->GetOwner();
- if (!owner)
- return;
-
- if (AuraEffect* aurEffect = owner->GetAuraEffect(56247, EFFECT_0))
- amount += aurEffect->GetAmount();
- }
+ if (pet->isPet())
+ if (Unit* owner = pet->ToPet()->GetOwner())
+ if (AuraEffect* aurEffect = owner->GetAuraEffect(SPELL_WARLOCK_GLYPH_OF_VOIDWALKER, EFFECT_0))
+ amount += aurEffect->GetAmount();
}
void Register()