Code for Diminishing Returns optimize

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2009-01-18 21:07:45 +03:00
parent 125416d242
commit 39754133aa

View file

@ -2379,13 +2379,6 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
// Explicit Diminishing Groups // Explicit Diminishing Groups
switch(spellproto->SpellFamilyName) switch(spellproto->SpellFamilyName)
{ {
case SPELLFAMILY_MAGE:
{
// Polymorph
if ((spellproto->SpellFamilyFlags & 0x00001000000LL) && spellproto->EffectApplyAuraName[0]==SPELL_AURA_MOD_CONFUSE)
return DIMINISHING_POLYMORPH;
break;
}
case SPELLFAMILY_ROGUE: case SPELLFAMILY_ROGUE:
{ {
// Kidney Shot // Kidney Shot
@ -2398,9 +2391,6 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
} }
case SPELLFAMILY_WARLOCK: case SPELLFAMILY_WARLOCK:
{ {
// Death Coil
if (spellproto->SpellFamilyFlags & 0x00000080000LL)
return DIMINISHING_DEATHCOIL;
// Fear // Fear
else if (spellproto->SpellFamilyFlags & 0x40840000000LL) else if (spellproto->SpellFamilyFlags & 0x40840000000LL)
return DIMINISHING_WARLOCK_FEAR; return DIMINISHING_WARLOCK_FEAR;
@ -2428,30 +2418,21 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellEntry const* spellproto
} }
// Get by mechanic // Get by mechanic
for (uint8 i=0;i<3;++i) uint32 mechanic = GetAllSpellMechanicMask(spellproto);
{ if (mechanic == MECHANIC_NONE) return DIMINISHING_NONE;
if (spellproto->Mechanic == MECHANIC_STUN || spellproto->EffectMechanic[i] == MECHANIC_STUN) if (mechanic & (1<<MECHANIC_STUN)) return triggered ? DIMINISHING_TRIGGER_STUN : DIMINISHING_CONTROL_STUN;
return triggered ? DIMINISHING_TRIGGER_STUN : DIMINISHING_CONTROL_STUN; if (mechanic & (1<<MECHANIC_SLEEP)) return DIMINISHING_SLEEP;
else if (spellproto->Mechanic == MECHANIC_SLEEP || spellproto->EffectMechanic[i] == MECHANIC_SLEEP) if (mechanic & (1<<MECHANIC_POLYMORPH)) return DIMINISHING_POLYMORPH;
return DIMINISHING_SLEEP; if (mechanic & (1<<MECHANIC_ROOT)) return triggered ? DIMINISHING_TRIGGER_ROOT : DIMINISHING_CONTROL_ROOT;
else if (spellproto->Mechanic == MECHANIC_ROOT || spellproto->EffectMechanic[i] == MECHANIC_ROOT) if (mechanic & (1<<MECHANIC_FEAR)) return DIMINISHING_FEAR;
return triggered ? DIMINISHING_TRIGGER_ROOT : DIMINISHING_CONTROL_ROOT; if (mechanic & (1<<MECHANIC_CHARM)) return DIMINISHING_CHARM;
else if (spellproto->Mechanic == MECHANIC_FEAR || spellproto->EffectMechanic[i] == MECHANIC_FEAR) if (mechanic & (1<<MECHANIC_SILENCE)) return DIMINISHING_SILENCE;
return DIMINISHING_FEAR; if (mechanic & (1<<DIMINISHING_DISARM)) return DIMINISHING_DISARM;
else if (spellproto->Mechanic == MECHANIC_CHARM || spellproto->EffectMechanic[i] == MECHANIC_CHARM) if (mechanic & (1<<MECHANIC_FREEZE)) return DIMINISHING_FREEZE;
return DIMINISHING_CHARM; if (mechanic & ((1<<MECHANIC_KNOCKOUT) | (1<<MECHANIC_SAPPED))) return DIMINISHING_KNOCKOUT;
else if (spellproto->Mechanic == MECHANIC_SILENCE || spellproto->EffectMechanic[i] == MECHANIC_SILENCE) if (mechanic & (1<<MECHANIC_BANISH)) return DIMINISHING_BANISH;
return DIMINISHING_SILENCE; if (mechanic & (1<<MECHANIC_HORROR)) return DIMINISHING_DEATHCOIL;
else if (spellproto->Mechanic == MECHANIC_DISARM || spellproto->EffectMechanic[i] == MECHANIC_DISARM)
return DIMINISHING_DISARM;
else if (spellproto->Mechanic == MECHANIC_FREEZE || spellproto->EffectMechanic[i] == MECHANIC_FREEZE)
return DIMINISHING_FREEZE;
else if (spellproto->Mechanic == MECHANIC_KNOCKOUT|| spellproto->EffectMechanic[i] == MECHANIC_KNOCKOUT ||
spellproto->Mechanic == MECHANIC_SAPPED || spellproto->EffectMechanic[i] == MECHANIC_SAPPED)
return DIMINISHING_KNOCKOUT;
else if (spellproto->Mechanic == MECHANIC_BANISH || spellproto->EffectMechanic[i] == MECHANIC_BANISH)
return DIMINISHING_BANISH;
}
return DIMINISHING_NONE; return DIMINISHING_NONE;
} }