Backports from 400 branch.

This commit is contained in:
tomrus88 2010-11-15 18:01:45 +03:00
parent bf774f49ce
commit 76dfdd336f
32 changed files with 223 additions and 210 deletions

View file

@ -1967,8 +1967,10 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
existExpired = true;
continue;
}
// Handle custom absorb auras
// TODO: try find better way
switch(spellProto->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
@ -2248,7 +2250,6 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
if (itr_spellProto->SpellFamilyName == SPELLFAMILY_GENERIC &&
itr_spellProto->SpellIconID == 2941)
{
int32 amount = int32(incanterAbsorption * (*itr)->GetModifier()->m_amount / 100);
// apply normalized part of already accumulated amount in aura
@ -2752,14 +2753,15 @@ uint32 Unit::CalculateDamage (WeaponAttackType attType, bool normalized)
float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const
{
if(spellProto->spellLevel <= 0)
uint32 spellLevel = spellProto->spellLevel;
if(spellLevel <= 0)
return 1.0f;
float LvlPenalty = 0.0f;
if(spellProto->spellLevel < 20)
LvlPenalty = 20.0f - spellProto->spellLevel * 3.75f;
float LvlFactor = (float(spellProto->spellLevel) + 6.0f) / float(getLevel());
if(spellLevel < 20)
LvlPenalty = 20.0f - spellLevel * 3.75f;
float LvlFactor = (float(spellLevel) + 6.0f) / float(getLevel());
if(LvlFactor > 1.0f)
LvlFactor = 1.0f;
@ -4030,7 +4032,7 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder)
}
}
// passive auras not stacable with other ranks
// passive auras not stackable with other ranks
if (!IsPassiveSpellStackableWithRanks(aurSpellInfo))
{
if (!RemoveNoStackAurasDueToAuraHolder(holder))
@ -5956,8 +5958,6 @@ void Unit::_RemoveTotem(Totem* totem)
}
}
void Unit::UnsummonAllTotems()
{
for (int i = 0; i < MAX_TOTEM_SLOT; ++i)
@ -6597,6 +6597,7 @@ bool Unit::IsSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolM
break;
}
}
// Custom crit by class
switch(spellProto->SpellFamilyName)
{
@ -6995,7 +6996,7 @@ bool Unit::IsImmuneToSpell(SpellEntry const* spellInfo)
if (!spellInfo)
return false;
//TODO add spellEffect immunity checks!, player with flag in bg is imune to imunity buffs from other friendly players!
//TODO add spellEffect immunity checks!, player with flag in bg is immune to immunity buffs from other friendly players!
//SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_EFFECT];
SpellImmuneList const& dispelList = m_spellImmune[IMMUNITY_DISPEL];
@ -7106,13 +7107,12 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008000))
mechanicMask |= (1 << (MECHANIC_BLEED-1));
// FLAT damage bonus auras
// =======================
int32 DoneFlat = 0;
int32 APbonus = 0;
// ..done flat, already included in wepon damage based spells
// ..done flat, already included in weapon damage based spells
if (!isWeaponDamageBasedSpell)
{
AuraList const& mModDamageDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
@ -7173,7 +7173,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
// ..done pct (by creature type mask)
DonePercent *= GetTotalAuraMultiplierByMiscMask(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS, creatureTypeMask);
// special dummys/class sripts and other effects
// special dummys/class scripts and other effects
// =============================================
Unit *owner = GetOwner();
if (!owner)
@ -7297,7 +7297,6 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
}
}
// final calculation
// =================
@ -7351,7 +7350,7 @@ uint32 Unit::MeleeDamageBonusDone(Unit *pVictim, uint32 pdamage,WeaponAttackType
*/
uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackType attType, SpellEntry const *spellProto, DamageEffectType damagetype, uint32 stack)
{
if (!pCaster)
if (!pCaster)
return pdamage;
if (pdamage == 0)
@ -7366,7 +7365,6 @@ uint32 Unit::MeleeDamageBonusTaken(Unit *pCaster, uint32 pdamage,WeaponAttackTyp
if (spellProto && spellProto->SpellFamilyName==SPELLFAMILY_DRUID && spellProto->SpellFamilyFlags & UI64LIT(0x00008000))
mechanicMask |= (1 << (MECHANIC_BLEED-1));
// FLAT damage bonus auras
// =======================
int32 TakenFlat = 0;
@ -7475,7 +7473,6 @@ void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
}
}
}
}
void Unit::ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply)
@ -8691,7 +8688,7 @@ int32 Unit::CalculateSpellDuration(SpellEntry const* spellProto, SpellEffectInde
int32 mechanic = GetEffectMechanic(spellProto, effect_index);
// Find total mod value (negative bonus)
int32 durationMod_always = target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MECHANIC_DURATION_MOD, mechanic);
// Modify from SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL aura for negatve effects (stack always ?)
// Modify from SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL aura for negative effects (stack always ?)
if (!IsPositiveEffect(spellProto->Id, effect_index))
durationMod_always+=target->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL, spellProto->Dispel);
// Find max mod (negative bonus)
@ -8835,7 +8832,7 @@ uint32 Unit::GetCreatureType() const
{
if(GetTypeId() == TYPEID_PLAYER)
{
SpellShapeshiftEntry const* ssEntry = sSpellShapeshiftStore.LookupEntry(m_form);
SpellShapeshiftFormEntry const* ssEntry = sSpellShapeshiftFormStore.LookupEntry(m_form);
if(ssEntry && ssEntry->creatureType > 0)
return ssEntry->creatureType;
else
@ -9243,17 +9240,16 @@ void Unit::ApplyAuraProcTriggerDamage( Aura* aura, bool apply )
uint32 Unit::GetCreatePowers( Powers power ) const
{
// POWER_FOCUS and POWER_HAPPINESS only have hunter pet
switch(power)
{
case POWER_HEALTH: return 0;
case POWER_HEALTH: return 0; // is it really should be here?
case POWER_MANA: return GetCreateMana();
case POWER_RAGE: return 1000;
case POWER_FOCUS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 100);
case POWER_FOCUS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 100);
case POWER_ENERGY: return 100;
case POWER_HAPPINESS: return (GetTypeId()==TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType()!=HUNTER_PET ? 0 : 1050000);
case POWER_RUNIC_POWER: return 1000;
case POWER_RUNE: return 0;
case POWER_HAPPINESS: return (GetTypeId() == TYPEID_PLAYER || !((Creature const*)this)->IsPet() || ((Pet const*)this)->getPetType() != HUNTER_PET ? 0 : 1050000);
case POWER_RUNE: return (GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_DEATH_KNIGHT ? 8 : 0);
case POWER_RUNIC_POWER: return (GetTypeId() == TYPEID_PLAYER && ((Player const*)this)->getClass() == CLASS_DEATH_KNIGHT ? 1000 : 0);
}
return 0;
@ -9386,13 +9382,13 @@ void CharmInfo::InitCharmCreateSpells()
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if(!spellInfo) onlyselfcast = false;
for(uint32 i = 0;i<3 && onlyselfcast;++i) //nonexistent spell will not make any problems as onlyselfcast would be false -> break right away
for(uint32 i = 0; i < 3 && onlyselfcast; ++i) //nonexistent spell will not make any problems as onlyselfcast would be false -> break right away
{
if(spellInfo->EffectImplicitTargetA[i] != TARGET_SELF && spellInfo->EffectImplicitTargetA[i] != 0)
onlyselfcast = false;
}
if(onlyselfcast || !IsPositiveSpell(spellId)) //only self cast and spells versus enemies are autocastable
if(onlyselfcast || !IsPositiveSpell(spellId)) // only self cast and spells versus enemies are autocastable
newstate = ACT_DISABLED;
else
newstate = ACT_PASSIVE;
@ -9729,7 +9725,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
if (!removedSpells.empty())
{
// Sort spells and remove dublicates
// Sort spells and remove duplicates
removedSpells.sort();
removedSpells.unique();
// Remove auras from removedAuras
@ -10496,7 +10492,7 @@ void Unit::KnockBackFrom(Unit* target, float horizontalSpeed, float verticalSpee
float vsin = sin(angle);
float vcos = cos(angle);
// Effect propertly implemented only for players
// Effect properly implemented only for players
if(GetTypeId()==TYPEID_PLAYER)
{
WorldPacket data(SMSG_MOVE_KNOCK_BACK, 8+4+4+4+4+4);