mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
converted all tabs to 4 spaces
This commit is contained in:
@@ -230,7 +230,7 @@ void Player::UpdateResistances(uint32 school)
|
||||
for(AuraEffectList::const_iterator i = mResbyIntellect.begin();i != mResbyIntellect.end(); ++i)
|
||||
{
|
||||
if((*i)->GetMiscValue() & (1 << (school-1)) )
|
||||
value += int32(GetStat(Stats((*i)->GetMiscValueB())) * (*i)->GetAmount() / 100.0f);
|
||||
value += int32(GetStat(Stats((*i)->GetMiscValueB())) * (*i)->GetAmount() / 100.0f);
|
||||
}
|
||||
|
||||
value *= GetModifierValue(unitMod, TOTAL_PCT);
|
||||
@@ -407,35 +407,35 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
|
||||
if (!proto)
|
||||
continue;
|
||||
|
||||
uint32 ap = proto->getFeralBonus();
|
||||
// Get AP Bonuses from weapon
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||
{
|
||||
if (i >= proto->StatsCount)
|
||||
break;
|
||||
uint32 ap = proto->getFeralBonus();
|
||||
// Get AP Bonuses from weapon
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
|
||||
{
|
||||
if (i >= proto->StatsCount)
|
||||
break;
|
||||
|
||||
if (proto->ItemStat[i].ItemStatType == ITEM_MOD_ATTACK_POWER)
|
||||
ap += proto->ItemStat[i].ItemStatValue;
|
||||
}
|
||||
if (proto->ItemStat[i].ItemStatType == ITEM_MOD_ATTACK_POWER)
|
||||
ap += proto->ItemStat[i].ItemStatValue;
|
||||
}
|
||||
|
||||
// Get AP Bonuses from weapon spells
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
{
|
||||
// no spell
|
||||
if (!proto->Spells[i].SpellId || proto->Spells[i].SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP)
|
||||
continue;
|
||||
// Get AP Bonuses from weapon spells
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
{
|
||||
// no spell
|
||||
if (!proto->Spells[i].SpellId || proto->Spells[i].SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP)
|
||||
continue;
|
||||
|
||||
// check if it is valid spell
|
||||
SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId);
|
||||
if (!spellproto)
|
||||
continue;
|
||||
// check if it is valid spell
|
||||
SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId);
|
||||
if (!spellproto)
|
||||
continue;
|
||||
|
||||
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
if (spellproto->Effects[j].ApplyAuraName == SPELL_AURA_MOD_ATTACK_POWER)
|
||||
ap += spellproto->Effects[j].CalcValue();
|
||||
}
|
||||
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
|
||||
if (spellproto->Effects[j].ApplyAuraName == SPELL_AURA_MOD_ATTACK_POWER)
|
||||
ap += spellproto->Effects[j].CalcValue();
|
||||
}
|
||||
|
||||
weapon_bonus = CalculatePct(float(ap), aurEff->GetAmount());
|
||||
weapon_bonus = CalculatePct(float(ap), aurEff->GetAmount());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -586,13 +586,13 @@ void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bo
|
||||
minDamage = ((weaponMinDamage + baseValue) * basePct + totalValue) * totalPct;
|
||||
maxDamage = ((weaponMaxDamage + baseValue) * basePct + totalValue) * totalPct;
|
||||
|
||||
// pussywizard: crashfix (casting negative to uint => min > max => assertion in urand)
|
||||
if (minDamage < 0.0f || minDamage > 1000000000.0f)
|
||||
minDamage = 0.0f;
|
||||
if (maxDamage < 0.0f || maxDamage > 1000000000.0f)
|
||||
maxDamage = 0.0f;
|
||||
if (minDamage > maxDamage)
|
||||
minDamage = maxDamage;
|
||||
// pussywizard: crashfix (casting negative to uint => min > max => assertion in urand)
|
||||
if (minDamage < 0.0f || minDamage > 1000000000.0f)
|
||||
minDamage = 0.0f;
|
||||
if (maxDamage < 0.0f || maxDamage > 1000000000.0f)
|
||||
maxDamage = 0.0f;
|
||||
if (minDamage > maxDamage)
|
||||
minDamage = maxDamage;
|
||||
}
|
||||
|
||||
void Player::UpdateDefenseBonusesMod()
|
||||
@@ -728,7 +728,7 @@ void Player::UpdateParryPercentage()
|
||||
|
||||
// No parry
|
||||
float value = 0.0f;
|
||||
m_realParry = 0.0f;
|
||||
m_realParry = 0.0f;
|
||||
uint32 pclass = getClass()-1;
|
||||
if (CanParry() && parry_cap[pclass] > 0.0f)
|
||||
{
|
||||
@@ -744,7 +744,7 @@ void Player::UpdateParryPercentage()
|
||||
m_realParry = nondiminishing + diminishing * parry_cap[pclass] / (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]);
|
||||
m_realParry = m_realParry < 0.0f ? 0.0f : m_realParry;
|
||||
|
||||
value = std::max(diminishing + nondiminishing, 0.0f);
|
||||
value = std::max(diminishing + nondiminishing, 0.0f);
|
||||
}
|
||||
|
||||
SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value);
|
||||
@@ -779,9 +779,9 @@ void Player::UpdateDodgePercentage()
|
||||
// apply diminishing formula to diminishing dodge chance
|
||||
uint32 pclass = getClass()-1;
|
||||
m_realDodge = nondiminishing + (diminishing * dodge_cap[pclass] / (diminishing + dodge_cap[pclass] * m_diminishing_k[pclass]));
|
||||
|
||||
m_realDodge = m_realDodge < 0.0f ? 0.0f : m_realDodge;
|
||||
float value = std::max(diminishing + nondiminishing, 0.0f);
|
||||
|
||||
m_realDodge = m_realDodge < 0.0f ? 0.0f : m_realDodge;
|
||||
float value = std::max(diminishing + nondiminishing, 0.0f);
|
||||
|
||||
SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, value);
|
||||
}
|
||||
@@ -890,12 +890,12 @@ void Player::ApplyHealthRegenBonus(int32 amount, bool apply)
|
||||
|
||||
void Player::UpdateManaRegen()
|
||||
{
|
||||
if( HasAuraTypeWithMiscvalue(SPELL_AURA_PREVENT_REGENERATE_POWER, POWER_MANA+1) )
|
||||
{
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, 0);
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0);
|
||||
return;
|
||||
}
|
||||
if( HasAuraTypeWithMiscvalue(SPELL_AURA_PREVENT_REGENERATE_POWER, POWER_MANA+1) )
|
||||
{
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER, 0);
|
||||
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
float Intellect = GetStat(STAT_INTELLECT);
|
||||
// Mana regen from spirit and intellect
|
||||
@@ -1089,8 +1089,8 @@ void Creature::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized,
|
||||
weaponMaxDamage = 0.0f;
|
||||
}
|
||||
|
||||
// pussywizard: subtract value from database till its fixed (the way it worked before creature_levelstats damage implementation)
|
||||
float attackPower = GetTotalAttackPowerValue(attType) - (attType == RANGED_ATTACK ? GetCreatureTemplate()->rangedattackpower : GetCreatureTemplate()->attackpower);
|
||||
// pussywizard: subtract value from database till its fixed (the way it worked before creature_levelstats damage implementation)
|
||||
float attackPower = GetTotalAttackPowerValue(attType) - (attType == RANGED_ATTACK ? GetCreatureTemplate()->rangedattackpower : GetCreatureTemplate()->attackpower);
|
||||
float baseValue = GetModifierValue(unitMod, BASE_VALUE) + (attackPower * GetAPMultiplier(attType, normalized) / 14.0f);
|
||||
float basePct = GetModifierValue(unitMod, BASE_PCT);
|
||||
float totalValue = GetModifierValue(unitMod, TOTAL_VALUE);
|
||||
@@ -1100,13 +1100,13 @@ void Creature::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized,
|
||||
minDamage = ((weaponMinDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
|
||||
maxDamage = ((weaponMaxDamage + baseValue) * dmgMultiplier * basePct + totalValue) * totalPct;
|
||||
|
||||
// pussywizard: crashfix (casting negative to uint => min > max => assertion in urand)
|
||||
if (minDamage < 0.0f || minDamage > 1000000000.0f)
|
||||
minDamage = 0.0f;
|
||||
if (maxDamage < 0.0f || maxDamage > 1000000000.0f)
|
||||
maxDamage = 0.0f;
|
||||
if (minDamage > maxDamage)
|
||||
minDamage = maxDamage;
|
||||
// pussywizard: crashfix (casting negative to uint => min > max => assertion in urand)
|
||||
if (minDamage < 0.0f || minDamage > 1000000000.0f)
|
||||
minDamage = 0.0f;
|
||||
if (maxDamage < 0.0f || maxDamage > 1000000000.0f)
|
||||
maxDamage = 0.0f;
|
||||
if (minDamage > maxDamage)
|
||||
minDamage = maxDamage;
|
||||
}
|
||||
|
||||
/*#######################################
|
||||
@@ -1122,7 +1122,7 @@ bool Guardian::UpdateStats(Stats stat)
|
||||
if (stat >= MAX_STATS)
|
||||
return false;
|
||||
|
||||
float value = GetTotalStatValue(stat);
|
||||
float value = GetTotalStatValue(stat);
|
||||
SetStat(stat, int32(value));
|
||||
|
||||
switch (stat)
|
||||
@@ -1153,7 +1153,7 @@ void Guardian::UpdateArmor()
|
||||
{
|
||||
float value = GetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE);
|
||||
value *= GetModifierValue(UNIT_MOD_ARMOR, BASE_PCT);
|
||||
value += std::max<float>(GetStat(STAT_AGILITY) - GetCreateStat(STAT_AGILITY), 0.0f) * 2.0f;
|
||||
value += std::max<float>(GetStat(STAT_AGILITY) - GetCreateStat(STAT_AGILITY), 0.0f) * 2.0f;
|
||||
value += GetModifierValue(UNIT_MOD_ARMOR, TOTAL_VALUE);
|
||||
value *= GetModifierValue(UNIT_MOD_ARMOR, TOTAL_PCT);
|
||||
SetArmor(int32(value));
|
||||
@@ -1162,14 +1162,14 @@ void Guardian::UpdateArmor()
|
||||
void Guardian::UpdateMaxHealth()
|
||||
{
|
||||
UnitMods unitMod = UNIT_MOD_HEALTH;
|
||||
float stamina = std::max<float>(GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA), 0.0f);
|
||||
float stamina = std::max<float>(GetStat(STAT_STAMINA) - GetCreateStat(STAT_STAMINA), 0.0f);
|
||||
|
||||
float multiplicator;
|
||||
switch (GetEntry())
|
||||
{
|
||||
case NPC_IMP: multiplicator = 8.4f; break;
|
||||
case NPC_WATER_ELEMENTAL_TEMP: multiplicator = 7.5f; break;
|
||||
case NPC_WATER_ELEMENTAL_PERM: multiplicator = 7.5f; break;
|
||||
case NPC_WATER_ELEMENTAL_TEMP: multiplicator = 7.5f; break;
|
||||
case NPC_WATER_ELEMENTAL_PERM: multiplicator = 7.5f; break;
|
||||
case NPC_VOIDWALKER: multiplicator = 11.0f; break;
|
||||
case NPC_SUCCUBUS: multiplicator = 9.1f; break;
|
||||
case NPC_FELHUNTER: multiplicator = 9.5f; break;
|
||||
@@ -1190,29 +1190,29 @@ void Guardian::UpdateMaxPower(Powers power)
|
||||
{
|
||||
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
|
||||
|
||||
float addValue = (power == POWER_MANA) ? std::max<float>(GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT), 0.0f) : 0.0f;
|
||||
float addValue = (power == POWER_MANA) ? std::max<float>(GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT), 0.0f) : 0.0f;
|
||||
float multiplicator = 15.0f;
|
||||
|
||||
switch (GetEntry())
|
||||
{
|
||||
case NPC_IMP:
|
||||
case NPC_WATER_ELEMENTAL_TEMP:
|
||||
case NPC_WATER_ELEMENTAL_PERM:
|
||||
multiplicator = 4.95f;
|
||||
break;
|
||||
case NPC_WATER_ELEMENTAL_TEMP:
|
||||
case NPC_WATER_ELEMENTAL_PERM:
|
||||
multiplicator = 4.95f;
|
||||
break;
|
||||
case NPC_VOIDWALKER:
|
||||
case NPC_SUCCUBUS:
|
||||
case NPC_FELHUNTER:
|
||||
case NPC_FELGUARD:
|
||||
multiplicator = 11.5f;
|
||||
break;
|
||||
multiplicator = 11.5f;
|
||||
break;
|
||||
default:
|
||||
multiplicator = 15.0f;
|
||||
break;
|
||||
multiplicator = 15.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
// xinef: Do NOT add base mana TWICE
|
||||
float value = GetModifierValue(unitMod, BASE_VALUE) + (power != POWER_MANA ? GetCreatePowers(power) : 0);
|
||||
// xinef: Do NOT add base mana TWICE
|
||||
float value = GetModifierValue(unitMod, BASE_VALUE) + (power != POWER_MANA ? GetCreatePowers(power) : 0);
|
||||
value *= GetModifierValue(unitMod, BASE_PCT);
|
||||
value += GetModifierValue(unitMod, TOTAL_VALUE) + addValue * multiplicator;
|
||||
value *= GetModifierValue(unitMod, TOTAL_PCT);
|
||||
@@ -1231,12 +1231,12 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
|
||||
if (GetEntry() == NPC_IMP) // imp's attack power
|
||||
val = GetStat(STAT_STRENGTH) - 10.0f;
|
||||
else if (IsPetGhoul()) // DK's ghoul attack power
|
||||
val = 589 /*xinef: base ap!*/ + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY);
|
||||
else
|
||||
val = 589 /*xinef: base ap!*/ + GetStat(STAT_STRENGTH) + GetStat(STAT_AGILITY);
|
||||
else
|
||||
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
|
||||
|
||||
SetModifierValue(unitMod, BASE_VALUE, val);
|
||||
|
||||
|
||||
//in BASE_VALUE of UNIT_MOD_ATTACK_POWER for creatures we store data of meleeattackpower field in DB
|
||||
float base_attPower = GetModifierValue(unitMod, BASE_VALUE) * GetModifierValue(unitMod, BASE_PCT);
|
||||
float attPowerMod = GetModifierValue(unitMod, TOTAL_VALUE);
|
||||
@@ -1273,12 +1273,12 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
|
||||
float mindamage = ((base_value + weapon_mindamage) * base_pct + total_value) * total_pct;
|
||||
float maxdamage = ((base_value + weapon_maxdamage) * base_pct + total_value) * total_pct;
|
||||
|
||||
if (mindamage < 0.0f || mindamage > 10000000.0f)
|
||||
mindamage = BASE_MINDAMAGE;
|
||||
if (maxdamage < 0.0f || maxdamage > 10000000.0f)
|
||||
maxdamage = BASE_MAXDAMAGE;
|
||||
if (mindamage > maxdamage)
|
||||
mindamage = maxdamage;
|
||||
if (mindamage < 0.0f || mindamage > 10000000.0f)
|
||||
mindamage = BASE_MINDAMAGE;
|
||||
if (maxdamage < 0.0f || maxdamage > 10000000.0f)
|
||||
maxdamage = BASE_MAXDAMAGE;
|
||||
if (mindamage > maxdamage)
|
||||
mindamage = maxdamage;
|
||||
|
||||
// Pet's base damage changes depending on happiness
|
||||
if (IsHunterPet() && attType == BASE_ATTACK)
|
||||
|
||||
Reference in New Issue
Block a user