aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellInfo.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-10-22 18:39:59 +0200
committerShauren <shauren.trinity@gmail.com>2023-10-22 18:39:59 +0200
commitdc9361fcc2eb16a59b52dfd8b0d47dfc1bf639be (patch)
treeb25b12a693f3e60f940be7a78df72b7ba47f4718 /src/server/game/Spells/SpellInfo.cpp
parentb2393d6adeca9a54b6ff1fb62a87da48c068f010 (diff)
Core/Spells: Named and implemented most of SpellAttr8
Diffstat (limited to 'src/server/game/Spells/SpellInfo.cpp')
-rw-r--r--src/server/game/Spells/SpellInfo.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 541496075a1..9b4b12295e2 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -560,7 +560,7 @@ int32 SpellEffectInfo::CalcBaseValue(WorldObject const* caster, Unit const* targ
if (Scaling.Coefficient != 0.0f)
{
uint32 level = _spellInfo->SpellLevel;
- if (target && _spellInfo->IsPositiveEffect(EffectIndex) && (Effect == SPELL_EFFECT_APPLY_AURA))
+ if (target && _spellInfo->HasAttribute(SPELL_ATTR8_USE_TARGETS_LEVEL_FOR_SPELL_SCALING))
level = target->GetLevel();
else if (caster && caster->IsUnit())
level = caster->ToUnit()->GetLevel();
@@ -632,7 +632,12 @@ int32 SpellEffectInfo::CalcBaseValue(WorldObject const* caster, Unit const* targ
if (ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(contentTuningId))
expansion = contentTuning->ExpansionID;
- int32 level = caster && caster->IsUnit() ? int32(caster->ToUnit()->GetLevel()) : 1;
+ int32 level = 1;
+ if (target && _spellInfo->HasAttribute(SPELL_ATTR8_USE_TARGETS_LEVEL_FOR_SPELL_SCALING))
+ level = target->GetLevel();
+ else if (caster && caster->IsUnit())
+ level = caster->ToUnit()->GetLevel();
+
value = sDB2Manager.EvaluateExpectedStat(stat, level, expansion, 0, CLASS_NONE, 0) * BasePoints / 100.0f;
}
@@ -2034,6 +2039,20 @@ SpellCastResult SpellInfo::CheckLocation(uint32 map_id, uint32 zone_id, uint32 a
return SPELL_FAILED_NOT_IN_RAID_INSTANCE;
}
+ if (HasAttribute(SPELL_ATTR8_REMOVE_OUTSIDE_DUNGEONS_AND_RAIDS))
+ {
+ MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
+ if (!mapEntry || !mapEntry->IsDungeon())
+ return SPELL_FAILED_TARGET_NOT_IN_INSTANCE;
+ }
+
+ if (HasAttribute(SPELL_ATTR8_NOT_IN_BATTLEGROUND))
+ {
+ MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
+ if (!mapEntry || mapEntry->IsBattleground())
+ return SPELL_FAILED_NOT_IN_BATTLEGROUND;
+ }
+
// DB base check (if non empty then must fit at least single for allow)
SpellAreaMapBounds saBounds = sSpellMgr->GetSpellAreaMapBounds(Id);
if (saBounds.first != saBounds.second)
@@ -2153,6 +2172,10 @@ SpellCastResult SpellInfo::CheckTarget(WorldObject const* caster, WorldObject co
Unit const* unitTarget = target->ToUnit();
+ if (HasAttribute(SPELL_ATTR8_ONLY_TARGET_IF_SAME_CREATOR))
+ if (caster != target && caster->GetGUID() != target->GetOwnerGUID())
+ return SPELL_FAILED_BAD_TARGETS;
+
// creature/player specific target checks
if (unitTarget)
{
@@ -2203,6 +2226,10 @@ SpellCastResult SpellInfo::CheckTarget(WorldObject const* caster, WorldObject co
}
}
}
+
+ if (HasAttribute(SPELL_ATTR8_ONLY_TARGET_OWN_SUMMONS))
+ if (!unitTarget->IsSummon() || unitTarget->ToTempSummon()->GetSummonerGUID() != caster->GetGUID())
+ return SPELL_FAILED_BAD_TARGETS;
}
// corpse specific target checks
else if (Corpse const* corpseTarget = target->ToCorpse())
@@ -2294,7 +2321,7 @@ SpellCastResult SpellInfo::CheckTarget(WorldObject const* caster, WorldObject co
if (HasEffect(SPELL_EFFECT_SELF_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT))
return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED;
- if (HasAttribute(SPELL_ATTR8_BATTLE_RESURRECTION))
+ if (HasAttribute(SPELL_ATTR8_ENFORCE_IN_COMBAT_RESSURECTION_LIMIT))
if (Map* map = caster->GetMap())
if (InstanceMap* iMap = map->ToInstanceMap())
if (InstanceScript* instance = iMap->GetInstanceScript())