summaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp67
1 files changed, 44 insertions, 23 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index d8dcba2d5b..d725b682ec 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1,14 +1,14 @@
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Affero General Public License as published by the
- * Free Software Foundation; either version 3 of the License, or (at your
- * option) any later version.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
@@ -1952,13 +1952,10 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator itr = Auras.begin(); itr != Auras.end(); ++itr)
{
- SpellGroupSpecialFlags sFlag = sSpellMgr->GetSpellGroupSpecialFlags(itr->second->GetBase()->GetId());
- if (!guardianFound)
- if (sFlag & SPELL_GROUP_SPECIAL_FLAG_ELIXIR_GUARDIAN)
- guardianFound = true;
- if (!battleFound)
- if (sFlag & SPELL_GROUP_SPECIAL_FLAG_ELIXIR_BATTLE)
- battleFound = true;
+ if (!guardianFound && sSpellMgr->IsSpellMemberOfSpellGroup(itr->second->GetBase()->GetId(), SPELL_GROUP_ELIXIR_GUARDIAN))
+ guardianFound = true;
+ if (!battleFound && sSpellMgr->IsSpellMemberOfSpellGroup(itr->second->GetBase()->GetId(), SPELL_GROUP_ELIXIR_BATTLE))
+ battleFound = true;
if (battleFound && guardianFound)
break;
}
@@ -1966,9 +1963,9 @@ void Spell::EffectEnergize(SpellEffIndex effIndex)
// get all available elixirs by mask and spell level
std::set<uint32> availableElixirs;
if (!guardianFound)
- sSpellMgr->GetSetOfSpellsInSpellGroupWithFlag(1, SPELL_GROUP_SPECIAL_FLAG_ELIXIR_GUARDIAN, availableElixirs);
+ sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_GUARDIAN, availableElixirs);
if (!battleFound)
- sSpellMgr->GetSetOfSpellsInSpellGroupWithFlag(1, SPELL_GROUP_SPECIAL_FLAG_ELIXIR_BATTLE, availableElixirs);
+ sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_BATTLE, availableElixirs);
for (std::set<uint32>::iterator itr = availableElixirs.begin(); itr != availableElixirs.end();)
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(*itr);
@@ -2429,8 +2426,14 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
}
break;
}
- case SUMMON_TYPE_JEEVES:
case SUMMON_TYPE_MINIPET:
+ // For companions, recalculate the position to ensure they spawn at the intended π/4 angle.
+ destTarget->Relocate(m_originalCaster->GetNearPosition(
+ m_originalCaster->GetDistance2d(destTarget->GetPositionX(), destTarget->GetPositionY()),
+ MINI_PET_SUMMON_ANGLE
+ ));
+ [[fallthrough]];
+ case SUMMON_TYPE_JEEVES:
{
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn);
if (!summon || !summon->HasUnitTypeMask(UNIT_MASK_MINION))
@@ -2446,8 +2449,9 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
//summon->AI()->EnterEvadeMode();
if (properties->Type != SUMMON_TYPE_JEEVES)
{
+ summon->SetFacingToObject(m_originalCaster);
summon->GetMotionMaster()->Clear(false);
- summon->GetMotionMaster()->MoveFollow(m_originalCaster, PET_FOLLOW_DIST, summon->GetFollowAngle(), MOTION_SLOT_ACTIVE);
+ summon->GetMotionMaster()->MoveFollow(m_originalCaster, PET_FOLLOW_DIST, MINI_PET_FOLLOW_ANGLE, MOTION_SLOT_ACTIVE);
}
break;
}
@@ -3591,7 +3595,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
unitMod = UNIT_MOD_DAMAGE_RANGED;
break;
}
- float weapon_total_pct = m_caster->GetModifierValue(unitMod, TOTAL_PCT);
+ float weapon_total_pct = m_caster->GetPctModifierValue(unitMod, TOTAL_PCT);
fixed_bonus = int32(fixed_bonus * weapon_total_pct);
spell_bonus = int32(spell_bonus * weapon_total_pct);
}
@@ -4155,8 +4159,8 @@ void Spell::EffectDuel(SpellEffIndex effIndex)
WorldPacket data(SMSG_DUEL_REQUESTED, 8 + 8);
data << pGameObj->GetGUID();
data << caster->GetGUID();
- caster->GetSession()->SendPacket(&data);
- target->GetSession()->SendPacket(&data);
+ caster->SendDirectMessage(&data);
+ target->SendDirectMessage(&data);
// create duel-info
bool isMounted = (GetSpellInfo()->Id == 62875);
@@ -4238,7 +4242,7 @@ void Spell::EffectSummonPlayer(SpellEffIndex /*effIndex*/)
data << m_caster->GetGUID(); // summoner guid
data << uint32(m_caster->GetZoneId()); // summoner zone
data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS); // auto decline after msecs
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
}
void Spell::EffectActivateObject(SpellEffIndex effIndex)
@@ -5006,7 +5010,24 @@ void Spell::EffectKnockBack(SpellEffIndex effIndex)
return;
float x, y;
- if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_KNOCK_BACK_DEST)
+ Unit* reflectionSource = m_reflectionTarget;
+
+ if (!reflectionSource && !m_reflectionTargetGuid.IsEmpty())
+ {
+ if (Unit* resolvedSource = ObjectAccessor::GetUnit(*m_caster, m_reflectionTargetGuid))
+ reflectionSource = resolvedSource;
+ }
+
+ if (reflectionSource)
+ {
+ reflectionSource->GetPosition(x, y);
+ }
+ else if (!m_reflectionTargetGuid.IsEmpty())
+ {
+ x = m_reflectionTargetPosition.GetPositionX();
+ y = m_reflectionTargetPosition.GetPositionY();
+ }
+ else if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_KNOCK_BACK_DEST)
{
if (m_targets.HasDst())
destTarget->GetPosition(x, y);
@@ -5206,7 +5227,7 @@ void Spell::EffectResurrectPet(SpellEffIndex /*effIndex*/)
{
// Position passed to SummonPet is irrelevant with current implementation,
// pet will be relocated without using these coords in Pet::LoadPetFromDB
- player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0s, damage);
+ player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0ms, damage);
return;
}
@@ -6338,5 +6359,5 @@ void Spell::EffectSummonRaFFriend(SpellEffIndex /*effIndex*/)
data << m_caster->GetGUID();
data << uint32(m_caster->GetZoneId());
data << uint32(MAX_PLAYER_SUMMON_DELAY * IN_MILLISECONDS); // auto decline after msecs
- player->GetSession()->SendPacket(&data);
+ player->SendDirectMessage(&data);
}