aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Creature/Creature.h5
-rw-r--r--src/server/game/Entities/Player/Player.cpp14
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h3
-rwxr-xr-xsrc/server/game/Entities/Unit/StatSystem.cpp11
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp65
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.h19
-rw-r--r--src/server/game/Spells/SpellEffects.cpp17
7 files changed, 21 insertions, 113 deletions
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 5f933bc6ca1..4b2582ec558 100755
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -525,11 +525,6 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
bool SetDisableGravity(bool disable, bool packetOnly = false);
bool SetHover(bool enable);
- uint32 GetShieldBlockValue() const //dunno mob block value
- {
- return (getLevel()/2 + uint32(GetStat(STAT_STRENGTH)/20));
- }
-
SpellSchoolMask GetMeleeDamageSchoolMask() const { return m_meleeDamageSchoolMask; }
void SetMeleeDamageSchool(SpellSchools school) { m_meleeDamageSchoolMask = SpellSchoolMask(1 << school); }
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index fb26bbc7b37..618ed545822 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -3270,7 +3270,9 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetFloatValue(PLAYER_PARRY_PERCENTAGE, 0.0f);
SetFloatValue(PLAYER_BLOCK_PERCENTAGE, 0.0f);
- SetUInt32Value(PLAYER_SHIELD_BLOCK, 0);
+
+ // Static 30% damage blocked
+ SetUInt32Value(PLAYER_SHIELD_BLOCK, 30);
// Dodge percentage
SetFloatValue(PLAYER_DODGE_PERCENTAGE, 0.0f);
@@ -5673,7 +5675,6 @@ void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, floa
case CRIT_PERCENTAGE: UpdateCritPercentage(BASE_ATTACK); break;
case RANGED_CRIT_PERCENTAGE: UpdateCritPercentage(RANGED_ATTACK); break;
case OFFHAND_CRIT_PERCENTAGE: UpdateCritPercentage(OFF_ATTACK); break;
- case SHIELD_BLOCK_VALUE: UpdateShieldBlockValue(); break;
default: break;
}
}
@@ -5706,15 +5707,6 @@ float Player::GetTotalBaseModValue(BaseModGroup modGroup) const
return m_auraBaseMod[modGroup][FLAT_MOD] * m_auraBaseMod[modGroup][PCT_MOD];
}
-uint32 Player::GetShieldBlockValue() const
-{
- float value = (m_auraBaseMod[SHIELD_BLOCK_VALUE][FLAT_MOD] + GetStat(STAT_STRENGTH) * 0.5f - 10)*m_auraBaseMod[SHIELD_BLOCK_VALUE][PCT_MOD];
-
- value = (value < 0) ? 0 : value;
-
- return uint32(value);
-}
-
float Player::GetMeleeCritFromAgility()
{
uint8 level = getLevel();
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index a0bb5513028..ab4c738f119 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1940,7 +1940,6 @@ class Player : public Unit, public GridObject<Player>
void UpdateMaxHealth();
void UpdateMaxPower(Powers power);
void UpdateAttackPowerAndDamage(bool ranged = false);
- void UpdateShieldBlockValue();
void UpdateDamagePhysical(WeaponAttackType attType);
void ApplySpellPowerBonus(int32 amount, bool apply);
void UpdateSpellDamageAndHealingBonus();
@@ -2128,7 +2127,7 @@ class Player : public Unit, public GridObject<Player>
void UpdateCorpseReclaimDelay();
void SendCorpseReclaimDelay(bool load = false);
- uint32 GetShieldBlockValue() const; // overwrite Unit version (virtual)
+ uint32 GetBlockPercent() { return GetUInt32Value(PLAYER_SHIELD_BLOCK); }
bool CanParry() const { return m_canParry; }
void SetCanParry(bool value);
bool CanBlock() const { return m_canBlock; }
diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp
index 4bc33dd10f1..18fa16488ea 100755
--- a/src/server/game/Entities/Unit/StatSystem.cpp
+++ b/src/server/game/Entities/Unit/StatSystem.cpp
@@ -70,9 +70,6 @@ bool Player::UpdateStats(Stats stat)
switch (stat)
{
- case STAT_STRENGTH:
- UpdateShieldBlockValue();
- break;
case STAT_AGILITY:
UpdateArmor();
UpdateAllCritPercentages();
@@ -171,7 +168,6 @@ bool Player::UpdateAllStats()
UpdateAllCritPercentages();
UpdateAllSpellCritChances();
UpdateDefenseBonusesMod();
- UpdateShieldBlockValue();
UpdateSpellDamageAndHealingBonus();
UpdateManaRegen();
UpdateExpertise(BASE_ATTACK);
@@ -413,11 +409,6 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
}
}
-void Player::UpdateShieldBlockValue()
-{
- SetUInt32Value(PLAYER_SHIELD_BLOCK, GetShieldBlockValue());
-}
-
void Player::CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, bool addTotalPct, float& min_damage, float& max_damage)
{
UnitMods unitMod;
@@ -519,8 +510,6 @@ void Player::UpdateBlockPercentage()
{
// Base value
value = 5.0f;
- // Modify value from defense skill
- value += (int32(GetDefenseSkillValue()) - int32(GetMaxSkillValueForLevel())) * 0.04f;
// Increase from SPELL_AURA_MOD_BLOCK_PERCENT aura
value += GetTotalAuraModifier(SPELL_AURA_MOD_BLOCK_PERCENT);
// Increase from rating
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 06b082de155..a987b7b072f 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -988,12 +988,11 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 dama
// Spell weapon based damage CAN BE crit & blocked at same time
if (blocked)
{
- damageInfo->blocked = victim->GetShieldBlockValue();
// double blocked amount if block is critical
+ uint32 value = victim->GetBlockPercent();
if (victim->isBlockCritical())
- damageInfo->blocked += damageInfo->blocked;
- if (damage < int32(damageInfo->blocked))
- damageInfo->blocked = uint32(damage);
+ value *= 2; // double blocked percent
+ damageInfo->blocked = CalculatePctN(damage, value);
damage -= damageInfo->blocked;
}
@@ -1189,19 +1188,9 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* dam
case MELEE_HIT_BLOCK:
damageInfo->TargetState = VICTIMSTATE_HIT;
damageInfo->HitInfo |= HITINFO_BLOCK;
- damageInfo->procEx |= PROC_EX_BLOCK;
- damageInfo->blocked_amount = damageInfo->target->GetShieldBlockValue();
- // double blocked amount if block is critical
- if (damageInfo->target->isBlockCritical())
- damageInfo->blocked_amount+=damageInfo->blocked_amount;
- if (damageInfo->blocked_amount >= damageInfo->damage)
- {
- damageInfo->TargetState = VICTIMSTATE_BLOCKS;
- damageInfo->blocked_amount = damageInfo->damage;
- damageInfo->procEx |= PROC_EX_FULL_BLOCK;
- }
- else
- damageInfo->procEx |= PROC_EX_NORMAL_HIT;
+ damageInfo->procEx |= PROC_EX_BLOCK | PROC_EX_NORMAL_HIT;
+ // 30% damage blocked, double blocked amount if block is critical
+ damageInfo->blocked_amount = CalculatePctN(damageInfo->damage, damageInfo->target->isBlockCritical() ? damageInfo->target->GetBlockPercent() * 2 : damageInfo->target->GetBlockPercent());
damageInfo->damage -= damageInfo->blocked_amount;
damageInfo->cleanDamage += damageInfo->blocked_amount;
break;
@@ -1916,7 +1905,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy
// Miss chance based on melee
//float miss_chance = MeleeMissChanceCalc(victim, attType);
- float miss_chance = MeleeSpellMissChance(victim, attType, int32(GetWeaponSkillValue(attType, victim)) - int32(GetMaxSkillValueForLevel(this)), 0);
+ float miss_chance = MeleeSpellMissChance(victim, attType, 0);
// Critical hit chance
float crit_chance = GetUnitCriticalChance(attType, victim);
@@ -2187,9 +2176,7 @@ bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttac
victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
return false;
- float blockChance = victim->GetUnitBlockChance();
- blockChance += (int32(GetWeaponSkillValue(attackType)) - int32(victim->GetMaxSkillValueForLevel())) * 0.04f;
- if (roll_chance_f(blockChance))
+ if (roll_chance_f(victim->GetUnitBlockChance()))
return true;
}
return false;
@@ -2237,19 +2224,9 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
if (spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED)
attType = RANGED_ATTACK;
- int32 attackerWeaponSkill;
- // skill value for these spells (for example judgements) is 5* level
- if (spell->DmgClass == SPELL_DAMAGE_CLASS_RANGED && !spell->IsRangedWeaponSpell())
- attackerWeaponSkill = getLevel() * 5;
- // bonus from skills is 0.04% per skill Diff
- else
- attackerWeaponSkill = int32(GetWeaponSkillValue(attType, victim));
-
- int32 skillDiff = attackerWeaponSkill - int32(victim->GetMaxSkillValueForLevel(this));
-
uint32 roll = urand (0, 10000);
- uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, skillDiff, spell->Id) * 100.0f);
+ uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, spell->Id) * 100.0f);
// Roll miss
uint32 tmp = missChance;
if (roll < tmp)
@@ -2349,7 +2326,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
if (canDodge)
{
// Roll dodge
- int32 dodgeChance = int32(victim->GetUnitDodgeChance() * 100.0f) - skillDiff * 4;
+ int32 dodgeChance = int32(victim->GetUnitDodgeChance() * 100.0f);
// Reduce enemy dodge chance by SPELL_AURA_MOD_COMBAT_RESULT_CHANCE
dodgeChance += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_COMBAT_RESULT_CHANCE, VICTIMSTATE_DODGE) * 100;
dodgeChance = int32(float(dodgeChance) * GetTotalAuraMultiplier(SPELL_AURA_MOD_ENEMY_DODGE));
@@ -2368,7 +2345,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
if (canParry)
{
// Roll parry
- int32 parryChance = int32(victim->GetUnitParryChance() * 100.0f) - skillDiff * 4;
+ int32 parryChance = int32(victim->GetUnitParryChance() * 100.0f);
// Reduce parry chance by attacker expertise rating
if (GetTypeId() == TYPEID_PLAYER)
parryChance -= int32(ToPlayer()->GetExpertiseDodgeOrParryReduction(attType) * 100.0f);
@@ -2384,7 +2361,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
if (canBlock)
{
- int32 blockChance = int32(victim->GetUnitBlockChance() * 100.0f) - skillDiff * 4;
+ int32 blockChance = int32(victim->GetUnitBlockChance() * 100.0f);
if (blockChance < 0)
blockChance = 0;
tmp += blockChance;
@@ -5856,14 +5833,6 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
target = this;
break;
}
- // Damage Shield
- if (dummySpell->SpellIconID == 3214)
- {
- triggered_spell_id = 59653;
- // % of amount blocked
- basepoints0 = CalculatePctN(int32(GetShieldBlockValue()), triggerAmount);
- break;
- }
// Glyph of Blocking
if (dummySpell->Id == 58375)
{
@@ -17012,7 +16981,7 @@ void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool
// Melee based spells can be miss, parry or dodge on this step
// Crit or block - determined on damage calculation phase! (and can be both in some time)
-float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const
+float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, uint32 spellId) const
{
//calculate miss chance
float missChance = victim->GetUnitMissChance(attType);
@@ -17020,14 +16989,6 @@ float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, i
if (!spellId && haveOffhandWeapon())
missChance += 19;
- // bonus from skills is 0.04%
- //miss_chance -= skillDiff * 0.04f;
- int32 diff = -skillDiff;
- if (victim->GetTypeId() == TYPEID_PLAYER)
- missChance += diff > 0 ? diff * 0.04f : diff * 0.02f;
- else
- missChance += diff > 10 ? 1 + (diff - 10) * 0.4f : diff * 0.1f;
-
// Calculate hit chance
float hitChance = 100.0f;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 96ee32274ef..00a1017daf6 100755
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1455,7 +1455,7 @@ class Unit : public WorldObject
void ApplyResilience(const Unit* victim, float * crit, int32 * damage, bool isCrit, CombatRating type) const;
- float MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const;
+ float MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, uint32 spellId) const;
SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spell);
SpellMissInfo MagicSpellHitResult(Unit* victim, SpellInfo const* spell);
SpellMissInfo SpellHitResult(Unit* victim, SpellInfo const* spell, bool canReflect = false);
@@ -1477,21 +1477,8 @@ class Unit : public WorldObject
return true;
}
- virtual uint32 GetShieldBlockValue() const =0;
- uint32 GetShieldBlockValue(uint32 soft_cap, uint32 hard_cap) const
- {
- uint32 value = GetShieldBlockValue();
- if (value >= hard_cap)
- {
- value = (soft_cap + hard_cap) / 2;
- }
- else if (value > soft_cap)
- {
- value = soft_cap + ((value - soft_cap) / 2);
- }
-
- return value;
- }
+ virtual uint32 GetBlockPercent() { return 30; }
+
uint32 GetUnitMeleeSkill(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
uint32 GetDefenseSkillValue(Unit const* target = NULL) const;
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = NULL) const;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 909d47c4b92..058a7b5564c 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -383,15 +383,8 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
}
case SPELLFAMILY_WARRIOR:
{
- // Shield Slam
- if (m_spellInfo->SpellFamilyFlags[1] & 0x200 && m_spellInfo->Category == 1209)
- {
- uint8 level = m_caster->getLevel();
- uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 24.5f), uint32(float(level) * 34.5f));
- damage += int32(m_caster->ApplyEffectModifiers(m_spellInfo, effIndex, float(block_value)));
- }
// Victory Rush
- else if (m_spellInfo->SpellFamilyFlags[1] & 0x100)
+ if (m_spellInfo->SpellFamilyFlags[1] & 0x100)
ApplyPctF(damage, m_caster->GetTotalAttackPowerValue(BASE_ATTACK));
// Shockwave
else if (m_spellInfo->Id == 46968)
@@ -646,14 +639,6 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
damage += count * int32(average * IN_MILLISECONDS) / m_caster->GetAttackTime(BASE_ATTACK);
break;
}
- // Shield of Righteousness
- if (m_spellInfo->SpellFamilyFlags[EFFECT_1] & 0x100000)
- {
- uint8 level = m_caster->getLevel();
- uint32 block_value = m_caster->GetShieldBlockValue(uint32(float(level) * 29.5f), uint32(float(level) * 39.5f));
- damage += CalculatePctN(block_value, m_spellInfo->Effects[EFFECT_1].CalcValue());
- break;
- }
break;
}
case SPELLFAMILY_DEATHKNIGHT: