mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
[11973] Various Cleanups
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
c243c42c3c
commit
f3f3349661
50 changed files with 153 additions and 134 deletions
|
|
@ -1420,8 +1420,8 @@ void Unit::CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *da
|
|||
// Add melee damage bonus
|
||||
damage = MeleeDamageBonusDone(damageInfo->target, damage, damageInfo->attackType);
|
||||
damage = damageInfo->target->MeleeDamageBonusTaken(this, damage, damageInfo->attackType);
|
||||
// Calculate armor reduction
|
||||
|
||||
// Calculate armor reduction
|
||||
uint32 armor_affected_damage = CalcNotIgnoreDamageReduction(damage, damageInfo->damageSchoolMask);
|
||||
damageInfo->damage = damage - armor_affected_damage + CalcArmorReducedDamage(damageInfo->target, armor_affected_damage);
|
||||
damageInfo->cleanDamage += damage - damageInfo->damage;
|
||||
|
|
@ -2032,8 +2032,8 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
|
|||
reflectTriggeredBy->SetInUse(true); // lock aura from final deletion until processing
|
||||
break;
|
||||
}
|
||||
if (spellProto->Id == 39228 || // Argussian Compass
|
||||
spellProto->Id == 60218) // Essence of Gossamer
|
||||
if (spellProto->Id == 39228 || // Argussian Compass
|
||||
spellProto->Id == 60218) // Essence of Gossamer
|
||||
{
|
||||
// Max absorb stored in 1 dummy effect
|
||||
int32 max_absorb = spellProto->CalculateSimpleValue(EFFECT_INDEX_1);
|
||||
|
|
@ -2069,9 +2069,9 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
|
|||
if (spellProto->SpellIconID == 2109)
|
||||
{
|
||||
if (!preventDeathSpell &&
|
||||
GetTypeId()==TYPEID_PLAYER && // Only players
|
||||
GetTypeId()==TYPEID_PLAYER && // Only players
|
||||
!((Player*)this)->HasSpellCooldown(31231) &&
|
||||
// Only if no cooldown
|
||||
// Only if no cooldown
|
||||
roll_chance_i((*i)->GetModifier()->m_amount))
|
||||
// Only if roll
|
||||
{
|
||||
|
|
@ -2222,11 +2222,10 @@ void Unit::CalculateDamageAbsorbAndResist(Unit *pCaster, SpellSchoolMask schoolM
|
|||
// Cast back reflect damage spell
|
||||
if (canReflect && reflectSpell)
|
||||
{
|
||||
CastCustomSpell(pCaster, reflectSpell, &reflectDamage, NULL, NULL, true, NULL, reflectTriggeredBy);
|
||||
CastCustomSpell(pCaster, reflectSpell, &reflectDamage, NULL, NULL, true, NULL, reflectTriggeredBy);
|
||||
reflectTriggeredBy->SetInUse(false); // free lock from deletion
|
||||
}
|
||||
|
||||
|
||||
// absorb by mana cost
|
||||
AuraList const& vManaShield = GetAurasByType(SPELL_AURA_MANA_SHIELD);
|
||||
for(AuraList::const_iterator i = vManaShield.begin(), next; i != vManaShield.end() && RemainingDamage > 0; i = next)
|
||||
|
|
@ -4052,7 +4051,6 @@ bool Unit::AddSpellAuraHolder(SpellAuraHolder *holder)
|
|||
|
||||
if(stop)
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -4365,7 +4363,7 @@ void Unit::RemoveAuraHolderDueToSpellByDispel(uint32 spellId, uint32 stackAmount
|
|||
{
|
||||
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId);
|
||||
|
||||
// Custom dispel cases
|
||||
// Custom dispel case
|
||||
// Unstable Affliction
|
||||
if(spellEntry->SpellFamilyName == SPELLFAMILY_WARLOCK && (spellEntry->SpellFamilyFlags & UI64LIT(0x010000000000)))
|
||||
{
|
||||
|
|
@ -6250,13 +6248,13 @@ uint32 Unit::SpellDamageBonusDone(Unit *pVictim, SpellEntry const *spellProto, u
|
|||
AuraList const& mModDamagePercentDone = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
|
||||
for(AuraList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
|
||||
{
|
||||
if( ((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto)) &&
|
||||
if (((*i)->GetModifier()->m_miscvalue & GetSpellSchoolMask(spellProto)) &&
|
||||
(*i)->GetSpellProto()->EquippedItemClass == -1 &&
|
||||
// -1 == any item class (not wand then)
|
||||
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0 )
|
||||
(*i)->GetSpellProto()->EquippedItemInventoryTypeMask == 0)
|
||||
// 0 == any inventory type (not wand then)
|
||||
{
|
||||
DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
|
||||
DoneTotalMod *= ((*i)->GetModifier()->m_amount + 100.0f) / 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6942,7 +6940,7 @@ uint32 Unit::SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 dama
|
|||
*/
|
||||
uint32 Unit::SpellHealingBonusDone(Unit *pVictim, SpellEntry const *spellProto, int32 healamount, DamageEffectType damagetype, uint32 stack)
|
||||
{
|
||||
// For totems get healing bonus from owner (statue isn't totem in fact)
|
||||
// For totems get healing bonus from owner (statue isn't totem in fact)
|
||||
if( GetTypeId()==TYPEID_UNIT && ((Creature*)this)->IsTotem() && ((Totem*)this)->GetTotemType()!=TOTEM_STATUE)
|
||||
if(Unit* owner = GetOwner())
|
||||
return owner->SpellHealingBonusDone(pVictim, spellProto, healamount, damagetype, stack);
|
||||
|
|
@ -7170,13 +7168,13 @@ int32 Unit::SpellBaseHealingBonusTaken(SpellSchoolMask schoolMask)
|
|||
|
||||
bool Unit::IsImmunedToDamage(SpellSchoolMask shoolMask)
|
||||
{
|
||||
//If m_immuneToSchool type contain this school type, IMMUNE damage.
|
||||
// If m_immuneToSchool type contain this school type, IMMUNE damage.
|
||||
SpellImmuneList const& schoolList = m_spellImmune[IMMUNITY_SCHOOL];
|
||||
for (SpellImmuneList::const_iterator itr = schoolList.begin(); itr != schoolList.end(); ++itr)
|
||||
if (itr->type & shoolMask)
|
||||
return true;
|
||||
|
||||
//If m_immuneToDamage type contain magic, IMMUNE damage.
|
||||
// If m_immuneToDamage type contain magic, IMMUNE damage.
|
||||
SpellImmuneList const& damageList = m_spellImmune[IMMUNITY_DAMAGE];
|
||||
for (SpellImmuneList::const_iterator itr = damageList.begin(); itr != damageList.end(); ++itr)
|
||||
if (itr->type & shoolMask)
|
||||
|
|
@ -7233,7 +7231,7 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i
|
|||
if (itr->type == effect)
|
||||
return true;
|
||||
|
||||
if(uint32 mechanic = spellInfo->EffectMechanic[index])
|
||||
if (uint32 mechanic = spellInfo->EffectMechanic[index])
|
||||
{
|
||||
SpellImmuneList const& mechanicList = m_spellImmune[IMMUNITY_MECHANIC];
|
||||
for (SpellImmuneList::const_iterator itr = mechanicList.begin(); itr != mechanicList.end(); ++itr)
|
||||
|
|
@ -7246,7 +7244,7 @@ bool Unit::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex i
|
|||
return true;
|
||||
}
|
||||
|
||||
if(uint32 aura = spellInfo->EffectApplyAuraName[index])
|
||||
if (uint32 aura = spellInfo->EffectApplyAuraName[index])
|
||||
{
|
||||
SpellImmuneList const& list = m_spellImmune[IMMUNITY_STATE];
|
||||
for(SpellImmuneList::const_iterator itr = list.begin(); itr != list.end(); ++itr)
|
||||
|
|
@ -8749,6 +8747,7 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProt
|
|||
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)
|
||||
|
|
@ -8756,6 +8755,7 @@ int32 Unit::CalculateSpellDamage(Unit const* target, SpellEntry const* spellProt
|
|||
|
||||
basePoints += randvalue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int32 value = basePoints;
|
||||
|
|
@ -9050,14 +9050,14 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
|
|||
case UNIT_MOD_ENERGY:
|
||||
case UNIT_MOD_HAPPINESS:
|
||||
case UNIT_MOD_RUNE:
|
||||
case UNIT_MOD_RUNIC_POWER: UpdateMaxPower(GetPowerTypeByAuraGroup(unitMod)); break;
|
||||
case UNIT_MOD_RUNIC_POWER: UpdateMaxPower(GetPowerTypeByAuraGroup(unitMod)); break;
|
||||
|
||||
case UNIT_MOD_RESISTANCE_HOLY:
|
||||
case UNIT_MOD_RESISTANCE_FIRE:
|
||||
case UNIT_MOD_RESISTANCE_NATURE:
|
||||
case UNIT_MOD_RESISTANCE_FROST:
|
||||
case UNIT_MOD_RESISTANCE_SHADOW:
|
||||
case UNIT_MOD_RESISTANCE_ARCANE: UpdateResistances(GetSpellSchoolByAuraGroup(unitMod)); break;
|
||||
case UNIT_MOD_RESISTANCE_ARCANE: UpdateResistances(GetSpellSchoolByAuraGroup(unitMod)); break;
|
||||
|
||||
case UNIT_MOD_ATTACK_POWER: UpdateAttackPowerAndDamage(); break;
|
||||
case UNIT_MOD_ATTACK_POWER_RANGED: UpdateAttackPowerAndDamage(true); break;
|
||||
|
|
@ -10216,6 +10216,7 @@ void Unit::ClearAllReactives()
|
|||
ModifyAuraState(AURA_STATE_DEFENSE, false);
|
||||
if (getClass() == CLASS_HUNTER && HasAuraState( AURA_STATE_HUNTER_PARRY))
|
||||
ModifyAuraState(AURA_STATE_HUNTER_PARRY, false);
|
||||
|
||||
if(getClass() == CLASS_WARRIOR && GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)this)->ClearComboPoints();
|
||||
}
|
||||
|
|
@ -10304,6 +10305,7 @@ Unit* Unit::SelectRandomFriendlyTarget(Unit* except /*= NULL*/, float radius /*=
|
|||
MaNGOS::UnitListSearcher<MaNGOS::AnyFriendlyUnitInObjectRangeCheck> searcher(targets, u_check);
|
||||
|
||||
Cell::VisitAllObjects(this, searcher, radius);
|
||||
|
||||
// remove current target
|
||||
if(except)
|
||||
targets.remove(except);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue