Core/Mechanics: cleanup shapeshift form code (by VladimirMangos)

--HG--
branch : trunk
This commit is contained in:
azazel committed 2010-12-09 17:03:42 +06:00
1 parent 8c2ce7f86d
commit e7eb4e22e2
8 files changed
+62 -56

No files matched your search

+14 -10
View File
@@ -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: