aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells
diff options
context:
space:
mode:
authorazazel <none@none>2010-12-09 17:03:42 +0600
committerazazel <none@none>2010-12-09 17:03:42 +0600
commite7eb4e22e2e6b990a11a3fbe55379f0949b02af0 (patch)
treebfb801890ce283123343bfd8407bb4b4e9359467 /src/server/game/Spells
parent8c2ce7f86d85b5961998af74b08ed6d579ab3de6 (diff)
Core/Mechanics: cleanup shapeshift form code (by VladimirMangos)
--HG-- branch : trunk
Diffstat (limited to 'src/server/game/Spells')
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp15
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp8
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp4
3 files changed, 9 insertions, 18 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 5d9f9aee68c..577deee44e1 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -754,7 +754,7 @@ int32 AuraEffect::CalculateAmount(Unit * caster)
case SPELL_AURA_MOD_INCREASE_SPEED:
// Dash - do not set speed if not in cat form
if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID && GetSpellProto()->SpellFamilyFlags[2] & 0x00000008)
- amount = GetBase()->GetUnitOwner()->m_form == FORM_CAT ? amount : 0;
+ amount = GetBase()->GetUnitOwner()->GetShapeshiftForm() == FORM_CAT ? amount : 0;
break;
default:
break;
@@ -3054,10 +3054,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
if (apply)
{
// remove other shapeshift before applying a new one
- if (target->m_ShapeShiftFormSpellId)
- target->RemoveAurasDueToSpell(target->m_ShapeShiftFormSpellId);
-
- target->SetByteValue(UNIT_FIELD_BYTES_2, 3, form);
+ target->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT, 0, GetBase());
if (modelid > 0)
target->SetDisplayId(modelid);
@@ -3106,8 +3103,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
}
}
- target->m_ShapeShiftFormSpellId = GetId();
- target->m_form = form;
+ target->SetShapeshiftForm(form);
}
else
{
@@ -3116,8 +3112,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 m
target->SetByteValue(UNIT_FIELD_BYTES_2, 3, FORM_NONE);
if (target->getClass() == CLASS_DRUID)
target->setPowerType(POWER_MANA);
- target->m_ShapeShiftFormSpellId = 0;
- target->m_form = FORM_NONE;
+ target->SetShapeshiftForm(FORM_NONE);
switch(form)
{
@@ -6134,7 +6129,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, boo
uint32 spellId = 62071;
if (apply)
{
- if (target->m_form != FORM_CAT)
+ if (target->GetShapeshiftForm() != FORM_CAT)
break;
target->CastSpell(target, spellId, true, NULL, NULL, GetCasterGUID());
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 1ae359f38fa..05efbd1bb2c 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4786,7 +4786,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (checkForm)
{
// Cannot be used in this stance/form
- SpellCastResult shapeError = GetErrorAtShapeshiftedCast(m_spellInfo, m_caster->m_form);
+ SpellCastResult shapeError = GetErrorAtShapeshiftedCast(m_spellInfo, m_caster->GetShapeshiftForm());
if (shapeError != SPELL_CAST_OK)
return shapeError;
@@ -5565,11 +5565,7 @@ SpellCastResult Spell::CheckCast(bool strict)
if (m_caster->GetTypeId() == TYPEID_PLAYER && !AllowMount && !m_IsTriggeredSpell && !m_spellInfo->AreaGroupId)
return SPELL_FAILED_NO_MOUNTS_ALLOWED;
- ShapeshiftForm form = m_caster->m_form;
- if (form == FORM_CAT || form == FORM_TREE || form == FORM_TRAVEL ||
- form == FORM_AQUA || form == FORM_BEAR || form == FORM_DIREBEAR ||
- form == FORM_CREATUREBEAR || form == FORM_GHOSTWOLF || form == FORM_FLIGHT ||
- form == FORM_FLIGHT_EPIC || form == FORM_MOONKIN || form == FORM_METAMORPHOSIS)
+ if (m_caster->IsInDisallowedMountForm())
return SPELL_FAILED_NOT_SHAPESHIFT;
break;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 5754d247b0e..23fe73ef738 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -566,7 +566,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
else if (m_spellInfo->SpellFamilyFlags[2] & 0x00002000)
{
// We are in Shadow Form
- if (m_caster->m_form == FORM_SHADOW)
+ if (m_caster->GetShapeshiftForm() == FORM_SHADOW)
// We have Improved Mind Blast
if (AuraEffect * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST,95,0))
// Chance has been successfully rolled
@@ -582,7 +582,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex)
damage += damage * aurEff->GetAmount() / 100;
}
// Improved Mind Blast (Mind Blast in shadow form bonus)
- else if (m_caster->m_form == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000))
+ else if (m_caster->GetShapeshiftForm() == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000))
{
Unit::AuraEffectList const& ImprMindBlast = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_FLAT_MODIFIER);
for (Unit::AuraEffectList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i)