aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities/Player
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/Entities/Player
parent8c2ce7f86d85b5961998af74b08ed6d579ab3de6 (diff)
Core/Mechanics: cleanup shapeshift form code (by VladimirMangos)
--HG-- branch : trunk
Diffstat (limited to 'src/server/game/Entities/Player')
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index c12a5081f2d..7e230be6533 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -1547,7 +1547,7 @@ void Player::setDeathState(DeathState s)
clearResurrectRequestData();
// remove form before other mods to prevent incorrect stats calculation
- RemoveAurasDueToSpell(m_ShapeShiftFormSpellId);
+ RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
//FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DEAD) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD)
RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
@@ -3589,7 +3589,9 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
{
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
// talent dependent passives activated at form apply have proper stance data
- bool need_cast = (!spellInfo->Stances || (m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)))));
+ ShapeshiftForm form = GetShapeshiftForm();
+ bool need_cast = (!spellInfo->Stances || (form && (spellInfo->Stances & (1 << (form - 1)))) ||
+ (!form && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT)));
//Check CasterAuraStates
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
@@ -5906,7 +5908,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
if (IsInFeralForm())
return; // always maximized SKILL_FERAL_COMBAT in fact
- if (m_form == FORM_TREE)
+ if (GetShapeshiftForm() == FORM_TREE)
return; // use weapon but not skill up
if (pVictim && pVictim->GetTypeId() == TYPEID_UNIT && (pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
@@ -7796,7 +7798,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
if (apply)
{
// Cannot be used in this stance/form
- if (GetErrorAtShapeshiftedCast(spellInfo, m_form) != SPELL_CAST_OK)
+ if (GetErrorAtShapeshiftedCast(spellInfo, GetShapeshiftForm()) != SPELL_CAST_OK)
return;
if (form_change) // check aura active state from other form
@@ -7816,7 +7818,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
if (form_change) // check aura compatibility
{
// Cannot be used in this stance/form
- if (GetErrorAtShapeshiftedCast(spellInfo, m_form) == SPELL_CAST_OK)
+ if (GetErrorAtShapeshiftedCast(spellInfo, GetShapeshiftForm()) == SPELL_CAST_OK)
return; // and remove only not compatible at form change
}
@@ -19401,7 +19403,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
return false;
}
- if (m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW)
+ if (IsInDisallowedMountForm())
{
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
data << uint32(ERR_TAXIPLAYERSHAPESHIFTED);
@@ -19423,8 +19425,8 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
{
RemoveAurasByType(SPELL_AURA_MOUNTED);
- if (m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW)
- RemoveAurasDueToSpell(m_ShapeShiftFormSpellId);
+ if (IsInDisallowedMountForm())
+ RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
if (Spell* spell = GetCurrentSpell(CURRENT_GENERIC_SPELL))
if (spell->m_spellInfo->Id != spellid)
@@ -19693,7 +19695,9 @@ void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
void Player::InitDataForForm(bool reapplyMods)
{
- SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(m_form);
+ ShapeshiftForm form = GetShapeshiftForm();
+
+ SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(form);
if (ssEntry && ssEntry->attackSpeed)
{
SetAttackTime(BASE_ATTACK,ssEntry->attackSpeed);
@@ -19703,7 +19707,7 @@ void Player::InitDataForForm(bool reapplyMods)
else
SetRegularAttackTime();
- switch(m_form)
+ switch (form)
{
case FORM_GHOUL:
case FORM_CAT: