mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 10:26:28 +01:00
Core/Spells: Fix some problems with spells summoning to many objects.
This commit is contained in:
@@ -643,7 +643,7 @@ class Spell
|
||||
|
||||
// effect helpers
|
||||
void GetSummonPosition(uint32 i, Position &pos, float radius = 0.0f, uint32 count = 0);
|
||||
void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties);
|
||||
void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons);
|
||||
void CalculateJumpSpeeds(uint8 i, float dist, float & speedxy, float & speedz);
|
||||
|
||||
SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue);
|
||||
|
||||
@@ -3044,6 +3044,33 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
|
||||
TempSummon* summon = NULL;
|
||||
|
||||
// determine how many units should be summoned
|
||||
uint32 numSummons;
|
||||
|
||||
// some spells need to summon many units, for those spells number of summons is stored in effect value
|
||||
// however so far noone found a generic check to find all of those (there's no related data in summonproperties.dbc
|
||||
// and in spell attributes, possibly we need to add a table for those)
|
||||
// so here's a list of MiscValueB values, which is currently most generic check
|
||||
switch (properties->Id)
|
||||
{
|
||||
case 64:
|
||||
case 61:
|
||||
case 1101:
|
||||
case 66:
|
||||
case 648:
|
||||
case 2301:
|
||||
case 1061:
|
||||
case 1261:
|
||||
case 629:
|
||||
case 181:
|
||||
case 715:
|
||||
numSummons = (damage > 0) ? damage : 1;
|
||||
break;
|
||||
default:
|
||||
numSummons = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (properties->Category)
|
||||
{
|
||||
case SUMMON_CATEGORY_WILD:
|
||||
@@ -3051,7 +3078,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
case SUMMON_CATEGORY_UNK:
|
||||
if (properties->Flags & 512)
|
||||
{
|
||||
SummonGuardian(effIndex, entry, properties);
|
||||
SummonGuardian(effIndex, entry, properties, numSummons);
|
||||
break;
|
||||
}
|
||||
switch (properties->Type)
|
||||
@@ -3060,7 +3087,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
case SUMMON_TYPE_GUARDIAN:
|
||||
case SUMMON_TYPE_GUARDIAN2:
|
||||
case SUMMON_TYPE_MINION:
|
||||
SummonGuardian(effIndex, entry, properties);
|
||||
SummonGuardian(effIndex, entry, properties, numSummons);
|
||||
break;
|
||||
// Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE)
|
||||
case SUMMON_TYPE_VEHICLE:
|
||||
@@ -3102,14 +3129,9 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
{
|
||||
float radius = m_spellInfo->Effects[effIndex].CalcRadius();
|
||||
|
||||
uint32 amount = damage > 0 ? damage : 1;
|
||||
if (m_spellInfo->Id == 18662 || // Curse of Doom
|
||||
properties->Id == 2081) // Mechanical Dragonling, Arcanite Dragonling, Mithril Dragonling TODO: Research on meaning of basepoints
|
||||
amount = 1;
|
||||
|
||||
TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
|
||||
|
||||
for (uint32 count = 0; count < amount; ++count)
|
||||
for (uint32 count = 0; count < numSummons; ++count)
|
||||
{
|
||||
GetSummonPosition(effIndex, pos, radius, count);
|
||||
|
||||
@@ -3131,7 +3153,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)
|
||||
}//switch
|
||||
break;
|
||||
case SUMMON_CATEGORY_PET:
|
||||
SummonGuardian(effIndex, entry, properties);
|
||||
SummonGuardian(effIndex, entry, properties, numSummons);
|
||||
break;
|
||||
case SUMMON_CATEGORY_PUPPET:
|
||||
summon = m_caster->GetMap()->SummonCreature(entry, pos, properties, duration, m_originalCaster, m_spellInfo->Id);
|
||||
@@ -3834,7 +3856,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
|
||||
{
|
||||
SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(67);
|
||||
if (properties)
|
||||
SummonGuardian(effIndex, petentry, properties);
|
||||
SummonGuardian(effIndex, petentry, properties, 1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -7099,7 +7121,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)
|
||||
void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians)
|
||||
{
|
||||
Unit* caster = m_originalCaster;
|
||||
if (!caster)
|
||||
@@ -7118,15 +7140,10 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
|
||||
if (uint16 skill202 = caster->ToPlayer()->GetSkillValue(SKILL_ENGINEERING))
|
||||
level = skill202 / 5;
|
||||
|
||||
//float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
|
||||
float radius = 5.0f;
|
||||
uint32 amount = damage > 0 ? damage : 1;
|
||||
int32 duration = m_spellInfo->GetDuration();
|
||||
switch (m_spellInfo->Id)
|
||||
{
|
||||
case 1122: // Inferno
|
||||
amount = 1;
|
||||
break;
|
||||
case 49028: // Dancing Rune Weapon
|
||||
if (AuraEffect* aurEff = m_originalCaster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon
|
||||
duration += aurEff->GetAmount();
|
||||
@@ -7138,7 +7155,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const*
|
||||
//TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
|
||||
Map* map = caster->GetMap();
|
||||
|
||||
for (uint32 count = 0; count < amount; ++count)
|
||||
for (uint32 count = 0; count < numGuardians; ++count)
|
||||
{
|
||||
Position pos;
|
||||
GetSummonPosition(i, pos, radius, count);
|
||||
|
||||
Reference in New Issue
Block a user