mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-15 06:29:13 +01:00
Core/Spells: expand personal spawn handling for summons to all kind of summons
* personal summon target checks for spells will now always happen instead of only if a player is the caster
This commit is contained in:
@@ -735,7 +735,7 @@ class TC_GAME_API Spell
|
||||
HitTriggerSpellList m_hitTriggerSpells;
|
||||
|
||||
// effect helpers
|
||||
void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons);
|
||||
void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons, bool visibleBySummonerOnly = false);
|
||||
void CalculateJumpSpeeds(uint8 i, float dist, float & speedxy, float & speedz);
|
||||
|
||||
void UpdateSpellCastDataTargets(WorldPackets::Spells::SpellHitInfo& data);
|
||||
|
||||
@@ -1885,7 +1885,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
case SUMMON_CATEGORY_UNK:
|
||||
if (properties->Flags & 512)
|
||||
{
|
||||
SummonGuardian(effIndex, entry, properties, numSummons);
|
||||
SummonGuardian(effIndex, entry, properties, numSummons, personalSpawn);
|
||||
break;
|
||||
}
|
||||
switch (properties->Title)
|
||||
@@ -1894,12 +1894,12 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
case SUMMON_TYPE_GUARDIAN:
|
||||
case SUMMON_TYPE_GUARDIAN2:
|
||||
case SUMMON_TYPE_MINION:
|
||||
SummonGuardian(effIndex, entry, properties, numSummons);
|
||||
SummonGuardian(effIndex, entry, properties, numSummons, personalSpawn);
|
||||
break;
|
||||
// Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE)
|
||||
case SUMMON_TYPE_VEHICLE:
|
||||
case SUMMON_TYPE_VEHICLE2:
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id);
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn);
|
||||
break;
|
||||
case SUMMON_TYPE_LIGHTWELL:
|
||||
case SUMMON_TYPE_TOTEM:
|
||||
@@ -1964,7 +1964,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
}//switch
|
||||
break;
|
||||
case SUMMON_CATEGORY_PET:
|
||||
SummonGuardian(effIndex, entry, properties, numSummons);
|
||||
SummonGuardian(effIndex, entry, properties, numSummons, personalSpawn);
|
||||
break;
|
||||
case SUMMON_CATEGORY_PUPPET:
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_originalCaster, m_spellInfo->Id, 0, personalSpawn);
|
||||
@@ -1972,7 +1972,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
case SUMMON_CATEGORY_VEHICLE:
|
||||
// Summoning spells (usually triggered by npc_spellclick) that spawn a vehicle and that cause the clicker
|
||||
// to cast a ride vehicle spell on the summoned unit.
|
||||
summon = m_originalCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_caster, m_spellInfo->Id);
|
||||
summon = m_originalCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_caster, m_spellInfo->Id, 0, personalSpawn);
|
||||
if (!summon || !summon->IsVehicle())
|
||||
return;
|
||||
|
||||
@@ -5315,7 +5315,7 @@ void Spell::EffectGameObjectSetDestructionState(SpellEffIndex effIndex)
|
||||
gameObjTarget->SetDestructibleState(GameObjectDestructibleState(m_spellInfo->Effects[effIndex].MiscValue), player, true);
|
||||
}
|
||||
|
||||
void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians)
|
||||
void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians, bool visibleBySummonerOny /*= false*/)
|
||||
{
|
||||
Unit* caster = m_originalCaster;
|
||||
if (!caster)
|
||||
@@ -5352,7 +5352,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
|
||||
// randomize position for multiple summons
|
||||
pos = m_caster->GetRandomPoint(*destTarget, radius);
|
||||
|
||||
TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, caster, m_spellInfo->Id);
|
||||
TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, caster, m_spellInfo->Id, 0, visibleBySummonerOny);
|
||||
if (!summon)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1923,10 +1923,9 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, WorldObject const* ta
|
||||
if (HasEffect(SPELL_EFFECT_SELF_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT_NEW))
|
||||
return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED;
|
||||
|
||||
if (caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (TempSummon const* summon = unitTarget->ToTempSummon())
|
||||
if (summon->IsVisibleBySummonerOnly() && summon->GetSummonerGUID() != caster->GetGUID())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
if (TempSummon const* summon = unitTarget->ToTempSummon())
|
||||
if (summon->IsVisibleBySummonerOnly() && summon->GetSummonerGUID() != caster->GetGUID())
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user