diff options
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 7 | ||||
| -rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 49 |
2 files changed, 32 insertions, 24 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 0bd06d3e544..619b33057ae 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -26023,6 +26023,13 @@ void Player::ActivateSpec(uint8 spec) SetPower(POWER_MANA, 0); // Mana must be 0 even if it isn't the active power type. SetPower(pw, 0); + + Unit::AuraEffectList const& shapeshiftAuras = GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT); + for (AuraEffect* aurEff : shapeshiftAuras) + { + aurEff->HandleShapeshiftBoosts(this, false); + aurEff->HandleShapeshiftBoosts(this, true); + } } void Player::ResetTimeSync() diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index c7f89e1d242..6db6abd5177 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1171,15 +1171,15 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (apply) { if (spellId) - target->CastSpell(target, spellId, true, NULL, this); + target->CastSpell(target, spellId, true, nullptr, this); if (spellId2) - target->CastSpell(target, spellId2, true, NULL, this); + target->CastSpell(target, spellId2, true, nullptr, this); if (target->GetTypeId() == TYPEID_PLAYER) { - const PlayerSpellMap& sp_list = target->ToPlayer()->GetSpellMap(); - for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) + PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap(); + for (auto itr = sp_list.begin(); itr != sp_list.end(); ++itr) { if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue; @@ -1192,7 +1192,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const continue; if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1))) - target->CastSpell(target, itr->first, true, NULL, this); + target->CastSpell(target, itr->first, true, nullptr, this); } // Also do it for Glyphs @@ -1207,7 +1207,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const continue; if (spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1))) - target->CastSpell(target, glyph->SpellId, true, NULL, this); + target->CastSpell(target, glyph->SpellId, true, nullptr, this); } } } @@ -1217,7 +1217,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(24932); if (spellInfo && spellInfo->Stances & (UI64LIT(1) << (GetMiscValue() - 1))) - target->CastSpell(target, 24932, true, NULL, this); + target->CastSpell(target, 24932, true, nullptr, this); } // Improved Barkskin - apply/remove armor bonus due to shapeshift if (target->ToPlayer()->HasSpell(63410) || target->ToPlayer()->HasSpell(63411)) @@ -1230,14 +1230,14 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (HotWSpellId) { // hacky, but the only way as spell family is not SPELLFAMILY_DRUID Unit::AuraEffectList const& mModTotalStatPct = target->GetAuraEffectsByType(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE); - for (Unit::AuraEffectList::const_iterator i = mModTotalStatPct.begin(); i != mModTotalStatPct.end(); ++i) + for (AuraEffect const* aurEff : mModTotalStatPct) { // Heart of the Wild - if ((*i)->GetSpellInfo()->SpellIconID == 240 && (*i)->GetMiscValue() == 3) + if (aurEff->GetSpellInfo()->SpellIconID == 240 && aurEff->GetMiscValue() == 3) { - int32 HotWMod = (*i)->GetAmount() / 2; // For each 2% Intelligence, you get 1% stamina and 1% attack power. + int32 HotWMod = aurEff->GetAmount() / 2; // For each 2% Intelligence, you get 1% stamina and 1% attack power. - target->CastCustomSpell(target, HotWSpellId, &HotWMod, NULL, NULL, true, NULL, this); + target->CastCustomSpell(HotWSpellId, SPELLVALUE_BASE_POINT0, HotWMod, target, true, nullptr, this); break; } } @@ -1261,13 +1261,13 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const spellId3 = 47180; break; } - target->CastSpell(target, spellId3, true, NULL, this); + target->CastSpell(target, spellId3, true, nullptr, this); } // Master Shapeshifter - Cat if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) { int32 bp = aurEff->GetAmount(); - target->CastCustomSpell(target, 48420, &bp, NULL, NULL, true); + target->CastCustomSpell(48420, SPELLVALUE_BASE_POINT0, bp, target, true); } break; case FORM_DIREBEAR: @@ -1276,13 +1276,13 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) { int32 bp = aurEff->GetAmount(); - target->CastCustomSpell(target, 48418, &bp, NULL, NULL, true); + target->CastCustomSpell(48418, SPELLVALUE_BASE_POINT0, bp, target, true); } // Survival of the Fittest if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DRUID, 961, 0)) { int32 bp = aurEff->GetSpellInfo()->Effects[EFFECT_2].CalcValue(); - target->CastCustomSpell(target, 62069, &bp, NULL, NULL, true, 0, this); + target->CastCustomSpell(62069, SPELLVALUE_BASE_POINT0, bp, target, true, nullptr, this); } break; case FORM_MOONKIN: @@ -1290,7 +1290,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) { int32 bp = aurEff->GetAmount(); - target->CastCustomSpell(target, 48421, &bp, NULL, NULL, true); + target->CastCustomSpell(48421, SPELLVALUE_BASE_POINT0, bp, target, true); } break; // Master Shapeshifter - Tree of Life @@ -1298,7 +1298,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const if (AuraEffect const* aurEff = target->GetDummyAuraEffect(SPELLFAMILY_GENERIC, 2851, 0)) { int32 bp = aurEff->GetAmount(); - target->CastCustomSpell(target, 48422, &bp, NULL, NULL, true); + target->CastCustomSpell(48422, SPELLVALUE_BASE_POINT0, bp, target, true); } break; } @@ -1312,7 +1312,7 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const target->RemoveOwnedAura(spellId2, target->GetGUID()); // Improved Barkskin - apply/remove armor bonus due to shapeshift - if (Player* player=target->ToPlayer()) + if (Player* player = target->ToPlayer()) { if (player->HasSpell(63410) || player->HasSpell(63411)) { @@ -1321,19 +1321,20 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const } } - const Unit::AuraEffectList& shapeshifts = target->GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT); - AuraEffect* newAura = NULL; + Unit::AuraEffectList const& shapeshifts = target->GetAuraEffectsByType(SPELL_AURA_MOD_SHAPESHIFT); + AuraEffect const* newAura = nullptr; // Iterate through all the shapeshift auras that the target has, if there is another aura with SPELL_AURA_MOD_SHAPESHIFT, then this aura is being removed due to that one being applied - for (Unit::AuraEffectList::const_iterator itr = shapeshifts.begin(); itr != shapeshifts.end(); ++itr) + for (AuraEffect const* aurEff : shapeshifts) { - if ((*itr) != this) + if (aurEff != this) { - newAura = *itr; + newAura = aurEff; break; } } + Unit::AuraApplicationMap& tAuras = target->GetAppliedAuras(); - for (Unit::AuraApplicationMap::iterator itr = tAuras.begin(); itr != tAuras.end();) + for (auto itr = tAuras.begin(); itr != tAuras.end();) { // Use the new aura to see on what stance the target will be uint64 newStance = newAura ? (UI64LIT(1) << (newAura->GetMiscValue() - 1)) : 0; |
