mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[0111] Implement rest of spell scaling
Signed-off-by: Yaki Khadafi <ElSolDolLo@gmail.com>
This commit is contained in:
parent
8d46aad160
commit
93c5b1cf1d
4 changed files with 61 additions and 35 deletions
|
|
@ -1798,7 +1798,7 @@ struct SpellScalingEntry
|
||||||
uint32 castTimeMin; // 1
|
uint32 castTimeMin; // 1
|
||||||
uint32 castTimeMax; // 2
|
uint32 castTimeMax; // 2
|
||||||
uint32 castScalingMaxLevel; // 3
|
uint32 castScalingMaxLevel; // 3
|
||||||
uint32 playerClass; // 4 (index * 100) + charLevel => gtSpellScaling.dbc
|
int32 playerClass; // 4 (index * 100) + charLevel => gtSpellScaling.dbc
|
||||||
float coeff1[3]; // 5-7
|
float coeff1[3]; // 5-7
|
||||||
float coeff2[3]; // 8-10
|
float coeff2[3]; // 8-10
|
||||||
float coeff3[3]; // 11-13
|
float coeff3[3]; // 11-13
|
||||||
|
|
|
||||||
|
|
@ -136,8 +136,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
|
||||||
{
|
{
|
||||||
if (levelsEntry->maxLevel)
|
if (levelsEntry->maxLevel)
|
||||||
level = std::min(level, levelsEntry->maxLevel);
|
level = std::min(level, levelsEntry->maxLevel);
|
||||||
if (levelsEntry->baseLevel)
|
level = std::max(level, levelsEntry->baseLevel) - levelsEntry->baseLevel;
|
||||||
level = std::max(level, levelsEntry->baseLevel) - levelsEntry->baseLevel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// currently only profession spells have CastTimePerLevel data filled, always negative
|
// currently only profession spells have CastTimePerLevel data filled, always negative
|
||||||
|
|
|
||||||
|
|
@ -9257,43 +9257,70 @@ bool Unit::SelectHostileTarget()
|
||||||
|
|
||||||
int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, SpellEffectIndex effect_index, int32 const* effBasePoints)
|
int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, SpellEffectIndex effect_index, int32 const* effBasePoints)
|
||||||
{
|
{
|
||||||
Player* unitPlayer = (GetTypeId() == TYPEID_PLAYER) ? (Player*)this : NULL;
|
|
||||||
|
|
||||||
uint8 comboPoints = unitPlayer ? unitPlayer->GetComboPoints() : 0;
|
|
||||||
|
|
||||||
int32 level = int32(getLevel());
|
|
||||||
uint32 maxLevel = spellProto->GetMaxLevel();
|
|
||||||
uint32 baseLevel = spellProto->GetBaseLevel();
|
|
||||||
uint32 spellLevel = spellProto->GetSpellLevel();
|
|
||||||
if (level > (int32)maxLevel && maxLevel > 0)
|
|
||||||
level = (int32)maxLevel;
|
|
||||||
else if (level < (int32)baseLevel)
|
|
||||||
level = (int32)baseLevel;
|
|
||||||
level-= (int32)spellLevel;
|
|
||||||
|
|
||||||
SpellEffectEntry const* spellEffect = spellProto->GetSpellEffect(effect_index);
|
SpellEffectEntry const* spellEffect = spellProto->GetSpellEffect(effect_index);
|
||||||
if(!spellEffect)
|
if(!spellEffect)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
float basePointsPerLevel = spellEffect->EffectRealPointsPerLevel;
|
Player* unitPlayer = (GetTypeId() == TYPEID_PLAYER) ? (Player*)this : NULL;
|
||||||
int32 basePoints = effBasePoints ? *effBasePoints - 1 : spellEffect->EffectBasePoints;
|
|
||||||
basePoints += int32(level * basePointsPerLevel);
|
|
||||||
int32 randomPoints = int32(spellEffect->EffectDieSides);
|
|
||||||
float comboDamage = spellEffect->EffectPointsPerComboPoint;
|
|
||||||
|
|
||||||
switch (randomPoints)
|
uint8 comboPoints = unitPlayer ? unitPlayer->GetComboPoints() : 0;
|
||||||
|
|
||||||
|
int32 basePoints = 0;
|
||||||
|
uint32 spellLevel = 0;
|
||||||
|
float comboDamage = 0.0f;
|
||||||
|
|
||||||
|
SpellScalingEntry const* scalingEntry = spellProto->GetSpellScaling();
|
||||||
|
GtSpellScalingEntry const* gtScalingEntry = NULL;
|
||||||
|
if (scalingEntry)
|
||||||
{
|
{
|
||||||
case 0: // not used
|
uint32 gtSpellScalingId = getLevel() - 1;
|
||||||
case 1: basePoints += 1; break; // range 1..1
|
if (scalingEntry->playerClass == -1)
|
||||||
default:
|
gtSpellScalingId += 11 * 100;
|
||||||
{
|
else
|
||||||
// range can have positive (1..rand) and negative (rand..1) values, so order its for irand
|
gtSpellScalingId += (getClass() - 1) * 100;
|
||||||
int32 randvalue = (randomPoints >= 1)
|
|
||||||
? irand(1, randomPoints)
|
|
||||||
: irand(randomPoints, 1);
|
|
||||||
|
|
||||||
basePoints += randvalue;
|
gtScalingEntry = sGtSpellScalingStore.LookupEntry(gtSpellScalingId);
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
if (gtScalingEntry)
|
||||||
|
{
|
||||||
|
basePoints = int32(scalingEntry->coeff1[effect_index] * gtScalingEntry->value);
|
||||||
|
int32 randomPoints = int32(scalingEntry->coeff1[effect_index] * gtScalingEntry->value * scalingEntry->coeff2[effect_index]);
|
||||||
|
basePoints += irand(-randomPoints, randomPoints) / 2;
|
||||||
|
comboDamage = uint32(scalingEntry->coeff3[effect_index] * gtScalingEntry->value);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
spellLevel = spellProto->GetSpellLevel();
|
||||||
|
uint32 level = getLevel();
|
||||||
|
uint32 maxLevel = spellProto->GetMaxLevel();
|
||||||
|
uint32 baseLevel = spellProto->GetBaseLevel();
|
||||||
|
|
||||||
|
if (maxLevel)
|
||||||
|
level = std::min(level, maxLevel);
|
||||||
|
level = std::max(level, baseLevel);
|
||||||
|
level = std::max(level, spellLevel) - spellLevel;
|
||||||
|
|
||||||
|
float basePointsPerLevel = spellEffect->EffectRealPointsPerLevel;
|
||||||
|
basePoints = effBasePoints ? *effBasePoints - 1 : spellEffect->EffectBasePoints;
|
||||||
|
basePoints += int32(level * basePointsPerLevel);
|
||||||
|
int32 randomPoints = int32(spellEffect->EffectDieSides);
|
||||||
|
comboDamage = spellEffect->EffectPointsPerComboPoint;
|
||||||
|
|
||||||
|
switch (randomPoints)
|
||||||
|
{
|
||||||
|
case 0: // not used
|
||||||
|
case 1: basePoints += 1; break; // range 1..1
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
// range can have positive (1..rand) and negative (rand..1) values, so order its for irand
|
||||||
|
int32 randvalue = (randomPoints >= 1)
|
||||||
|
? irand(1, randomPoints)
|
||||||
|
: irand(randomPoints, 1);
|
||||||
|
|
||||||
|
basePoints += randvalue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -9322,7 +9349,7 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(spellProto->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION && spellLevel &&
|
if (!gtScalingEntry && spellProto->Attributes & SPELL_ATTR_LEVEL_DAMAGE_CALCULATION && spellLevel &&
|
||||||
spellEffect->Effect != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE &&
|
spellEffect->Effect != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE &&
|
||||||
spellEffect->Effect != SPELL_EFFECT_KNOCK_BACK &&
|
spellEffect->Effect != SPELL_EFFECT_KNOCK_BACK &&
|
||||||
(spellEffect->Effect != SPELL_EFFECT_APPLY_AURA || spellEffect->EffectApplyAuraName != SPELL_AURA_MOD_DECREASE_SPEED))
|
(spellEffect->Effect != SPELL_EFFECT_APPLY_AURA || spellEffect->EffectApplyAuraName != SPELL_AURA_MOD_DECREASE_SPEED))
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "0110"
|
#define REVISION_NR "0111"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue