mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[10075] Attempt use more expected by result buffs downranking algo.
* In small rate more fast * Not affect non-buff ranked spells like 10909
This commit is contained in:
parent
07a931e141
commit
81851074ad
6 changed files with 45 additions and 31 deletions
|
|
@ -2216,37 +2216,44 @@ bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const
|
|||
return false;
|
||||
}
|
||||
|
||||
SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const
|
||||
SpellEntry const* SpellMgr::SelectAuraRankForLevel(SpellEntry const* spellInfo, uint32 level) const
|
||||
{
|
||||
// ignore passive spells
|
||||
if(IsPassiveSpell(spellInfo))
|
||||
// fast case
|
||||
if (level + 10 >= spellInfo->spellLevel)
|
||||
return spellInfo;
|
||||
|
||||
// ignore selection for passive spells
|
||||
if (IsPassiveSpell(spellInfo))
|
||||
return spellInfo;
|
||||
|
||||
bool needRankSelection = false;
|
||||
for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
|
||||
{
|
||||
if (IsPositiveEffect(spellInfo->Id, SpellEffectIndex(i)) && (
|
||||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA ||
|
||||
// for simple aura in check apply to any non caster based targets, in rank search mode to any explicit targets
|
||||
if (((spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
|
||||
(IsExplicitPositiveTarget(spellInfo->EffectImplicitTargetA[i]) ||
|
||||
IsAreaEffectPossitiveTarget(Targets(spellInfo->EffectImplicitTargetA[i])))) ||
|
||||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
|
||||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID))
|
||||
spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_RAID) &&
|
||||
IsPositiveEffect(spellInfo->Id, SpellEffectIndex(i)))
|
||||
{
|
||||
needRankSelection = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// not required
|
||||
if(!needRankSelection)
|
||||
// not required (rank check more slow so check it here)
|
||||
if (!needRankSelection || GetSpellRank(spellInfo->Id) == 0)
|
||||
return spellInfo;
|
||||
|
||||
for(uint32 nextSpellId = spellInfo->Id; nextSpellId != 0; nextSpellId = GetPrevSpellInChain(nextSpellId))
|
||||
{
|
||||
SpellEntry const *nextSpellInfo = sSpellStore.LookupEntry(nextSpellId);
|
||||
if(!nextSpellInfo)
|
||||
if (!nextSpellInfo)
|
||||
break;
|
||||
|
||||
// if found appropriate level
|
||||
if(playerLevel + 10 >= nextSpellInfo->spellLevel)
|
||||
if (level + 10 >= spellInfo->spellLevel)
|
||||
return nextSpellInfo;
|
||||
|
||||
// one rank less then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue