Style cleanup from the Mangos Futures Team

This commit is contained in:
Antz 2020-09-14 18:30:19 +01:00
parent 809eee0f50
commit 283c68b6a9
No known key found for this signature in database
GPG key ID: 0DF907270598C85F
203 changed files with 12039 additions and 353 deletions

View file

@ -53,7 +53,9 @@ bool Player::UpdateStats(Stats stat)
{
Pet* pet = GetPet();
if (pet)
{
pet->UpdateStats(stat);
}
}
switch (stat)
@ -90,12 +92,16 @@ bool Player::UpdateStats(Stats stat)
AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
for (AuraList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
if (Stats((*i)->GetMiscBValue()) == stat)
{
mask |= (*i)->GetMiscValue();
}
if (mask)
{
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
if (mask & (1 << rating))
{
ApplyRatingMod(CombatRating(rating), 0, true);
}
}
return true;
}
@ -174,7 +180,9 @@ void Player::UpdateResistances(uint32 school)
Pet* pet = GetPet();
if (pet)
{
pet->UpdateResistances(school);
}
}
else
{
@ -197,7 +205,9 @@ void Player::UpdateArmor()
{
Modifier* mod = (*i)->GetModifier();
if (mod->m_miscvalue & SPELL_SCHOOL_MASK_NORMAL)
{
value += int32(GetStat(Stats((*i)->GetMiscBValue())) * mod->m_amount / 100.0f);
}
}
value *= GetModifierValue(unitMod, TOTAL_PCT);
@ -206,7 +216,9 @@ void Player::UpdateArmor()
Pet* pet = GetPet();
if (pet)
{
pet->UpdateArmor();
}
UpdateAttackPowerAndDamage(); // armor dependent auras update for SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR
}
@ -220,7 +232,9 @@ float Player::GetHealthBonusFromStamina()
float baseStam = stamina < 20 ? stamina : 20;
float moreStam = stamina - baseStam;
if (moreStam < 0.0f)
{
moreStam = 0.0f;
}
return baseStam + moreStam * hpBase->ratio;
}
@ -321,7 +335,9 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
{
if (SpellShapeshiftFormEntry const * entry = sSpellShapeshiftFormStore.LookupEntry(uint32(GetShapeshiftForm())))
if (entry->flags1 & 0x20)
{
val2 += std::max(GetStat(STAT_AGILITY) - 10.0f, 0.0f) * chrEntry->apPerStr;
}
}
}
@ -352,7 +368,9 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
Pet* pet = GetPet(); // update pet's AP
if (pet)
{
pet->UpdateAttackPowerAndDamage();
}
}
else
{
@ -673,14 +691,20 @@ void Player::UpdateExpertise(WeaponAttackType attack)
{
// item neutral spell
if((*itr)->GetSpellProto()->GetEquippedItemClass() == -1)
{
expertise += (*itr)->GetModifier()->m_amount;
}
// item dependent spell
else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
{
expertise += (*itr)->GetModifier()->m_amount;
}
}
if (expertise < 0)
{
expertise = 0;
}
switch (attack)
{
@ -758,24 +782,32 @@ void Player::UpdateMasteryAuras()
{
SpellAuraHolder* holder = GetSpellAuraHolder(masterySpells->at(i));
if (!holder)
{
continue;
}
SpellEntry const* spellEntry = holder->GetSpellProto();
// calculate mastery scaling coef
int32 masteryCoef = GetMasteryCoefficient(spellEntry);
if (!masteryCoef)
{
continue;
}
// update aura modifiers
for (uint32 j = 0; j < MAX_EFFECT_INDEX; ++j)
{
Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(j));
if (!aura)
{
continue;
}
if (spellEntry->CalculateSimpleValue(SpellEffectIndex(j)))
{
continue;
}
aura->ApplyModifier(false, false);
aura->GetModifier()->m_amount = int32(masteryValue * masteryCoef / 100.0f);
@ -952,13 +984,17 @@ bool Pet::UpdateStats(Stats stat)
if (stat == STAT_STAMINA)
{
if (owner)
{
value += float(owner->GetStat(stat)) * 0.3f;
}
}
// warlock's and mage's pets gain 30% of owner's intellect
else if (stat == STAT_INTELLECT && getPetType() == SUMMON_PET)
{
if (owner && (owner->getClass() == CLASS_WARLOCK || owner->getClass() == CLASS_MAGE))
{
value += float(owner->GetStat(stat)) * 0.3f;
}
}
SetStat(stat, int32(value));
@ -1006,7 +1042,9 @@ void Pet::UpdateResistances(uint32 school)
Unit* owner = GetOwner();
// hunter and warlock pets gain 40% of owner's resistance
if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
{
value += float(owner->GetResistance(SpellSchools(school))) * 0.4f;
}
SetResistance(SpellSchools(school), int32(value));
}
@ -1025,7 +1063,9 @@ void Pet::UpdateArmor()
Unit* owner = GetOwner();
// hunter and warlock pets gain 35% of owner's armor value
if (owner && (getPetType() == HUNTER_PET || (getPetType() == SUMMON_PET && owner->getClass() == CLASS_WARLOCK)))
{
bonus_armor = 0.35f * float(owner->GetArmor());
}
value = GetModifierValue(unitMod, BASE_VALUE);
value *= GetModifierValue(unitMod, BASE_PCT);
@ -1100,7 +1140,9 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
int32 shadow = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_SHADOW)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_SHADOW);
int32 maximum = (fire > shadow) ? fire : shadow;
if (maximum < 0)
{
maximum = 0;
}
SetBonusDamage(int32(maximum * 0.15f));
bonusAP = maximum * 0.57f;
}
@ -1109,7 +1151,9 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
{
int32 frost = int32(owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS + SPELL_SCHOOL_FROST)) - owner->GetUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_NEG + SPELL_SCHOOL_FROST);
if (frost < 0)
{
frost = 0;
}
SetBonusDamage(int32(frost * 0.4f));
}
}