Skip to content

Commit

Permalink
Core/Spells: restore DieSides effect handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovahlord committed Jan 29, 2024
1 parent 693329a commit 3af5abf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/server/game/Spells/SpellEffects.cpp
Expand Up @@ -2286,7 +2286,7 @@ void Spell::EffectLearnSkill()
if (!playerTarget)
return;

if (damage < 0)
if (damage < 1)
return;

uint32 skillid = effectInfo->MiscValue;
Expand All @@ -2299,12 +2299,12 @@ void Spell::EffectLearnSkill()
return;

uint16 skillval = std::max<uint16>(1, playerTarget->GetPureSkillValue(skillid));
uint16 maxSkillVal = tier->GetValueForTierIndex(damage);
uint16 maxSkillVal = tier->GetValueForTierIndex(damage - 1);

if (rcEntry->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
skillval = maxSkillVal;

playerTarget->SetSkill(skillid, (damage + 1), skillval, maxSkillVal);
playerTarget->SetSkill(skillid, damage, skillval, maxSkillVal);
}

void Spell::EffectPlayMovie()
Expand Down Expand Up @@ -4550,11 +4550,11 @@ void Spell::EffectSkill()
if (!playerTarget)
return;

if (damage < 0)
if (damage < 1)
return;

uint32 skillid = effectInfo->MiscValue;
if (playerTarget->GetSkillStep(skillid) >= (damage + 1))
if (playerTarget->GetSkillStep(skillid) >= damage)
return;

SkillRaceClassInfoEntry const* rcEntry = sDB2Manager.GetSkillRaceClassInfo(skillid, playerTarget->GetRace(), playerTarget->GetClass());
Expand All @@ -4566,12 +4566,12 @@ void Spell::EffectSkill()
return;

uint16 skillval = std::max<uint16>(1, playerTarget->GetPureSkillValue(skillid));
uint16 maxSkillVal = tier->GetValueForTierIndex(damage);
uint16 maxSkillVal = tier->GetValueForTierIndex(damage - 1);

if (rcEntry->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
skillval = maxSkillVal;

playerTarget->SetSkill(skillid, (damage + 1), skillval, maxSkillVal);
playerTarget->SetSkill(skillid, damage, skillval, maxSkillVal);
}

void Spell::EffectSpiritHeal()
Expand Down
10 changes: 10 additions & 0 deletions src/server/game/Spells/SpellInfo.cpp
Expand Up @@ -429,6 +429,7 @@ SpellEffectInfo::SpellEffectInfo(SpellInfo const* spellInfo, SpellEffectEntry co
TargetARadiusEntry = sSpellRadiusStore.LookupEntry(_effect.EffectRadiusIndex[0]);
TargetBRadiusEntry = sSpellRadiusStore.LookupEntry(_effect.EffectRadiusIndex[1]);
ChainTargets = _effect.EffectChainTargets;
DieSides = _effect.EffectDieSides;
ItemType = _effect.EffectItemType;
TriggerSpell = _effect.EffectTriggerSpell;
SpellClassMask = _effect.EffectSpellClassMask;
Expand Down Expand Up @@ -513,6 +514,15 @@ int32 SpellEffectInfo::CalcValue(WorldObject const* caster /*= nullptr*/, int32
*variance = valueVariance;
}

// roll in a range <1;EffectDieSides> as of patch 3.3.3
if (DieSides)
{
if (DieSides == 1)
value += DieSides;
else
value += (DieSides >= 1) ? irand(1, DieSides) : irand(DieSides, 1);
}

// base amount modification based on spell lvl vs caster lvl
if (Scaling.Coefficient != 0.0f)
{
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Spells/SpellInfo.h
Expand Up @@ -233,6 +233,7 @@ class TC_GAME_API SpellEffectInfo
SpellRadiusEntry const* TargetARadiusEntry;
SpellRadiusEntry const* TargetBRadiusEntry;
int32 ChainTargets;
int32 DieSides;
uint32 ItemType;
uint32 TriggerSpell;
flag128 SpellClassMask;
Expand Down

0 comments on commit 3af5abf

Please sign in to comment.