@@ -13943,45 +13943,45 @@ InventoryResult Player::CanEquipUniqueItem(ItemTemplate const* itemProto, uint8
1394313943 return EQUIP_ERR_OK;
1394413944}
1394513945
13946+ static constexpr float FALL_DMG_EQU_SLOPE = 0.018f;
13947+ static constexpr float FALL_DMG_EQU_INTERCEPT = -0.2426f;
13948+ static constexpr float MIN_FALL_DMG_DIST = 13.48f; // Minimum fall distance that deals damage
13949+ // 13.48 can be calculated by resolving damageperc to 0 in the fall damage equation below, and assuming safe_fall reduction = 0
13950+
13951+ static constexpr uint32 SPELL_GUST_OF_WIND = 43621;
13952+ static constexpr uint32 SPELL_DIVINE_PROTECTION = 498;
13953+
1394613954void Player::HandleFall(MovementInfo const& movementInfo)
1394713955{
1394813956 // calculate total z distance of the fall
1394913957 float z_diff = m_lastFallZ - movementInfo.pos.GetPositionZ();
1395013958
1395113959 //Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
13952- // 14.57 can be calculated by resolving damageperc formula below to 0
13953- if (z_diff >= 14.57f && !isDead() && !IsGameMaster() && !GetCommandStatus(CHEAT_GOD) &&
13960+ if (z_diff >= MIN_FALL_DMG_DIST && !isDead() && !IsGameMaster() && !GetCommandStatus(CHEAT_GOD) &&
1395413961 !HasHoverAura() && !HasFeatherFallAura() &&
1395513962 !HasFlyAura())
1395613963 {
1395713964 //Safe fall, fall height reduction
1395813965 int32 safe_fall = GetTotalAuraModifier(SPELL_AURA_SAFE_FALL);
1395913966
13960- float damageperc = 0.018f * (z_diff - safe_fall) - 0.2426f ;
13967+ float damageperc = FALL_DMG_EQU_SLOPE * (z_diff - safe_fall) + FALL_DMG_EQU_INTERCEPT ;
1396113968 uint32 original_health = GetHealth(), final_damage = 0;
1396213969
1396313970 if (damageperc > 0 && !IsImmunedToDamageOrSchool(SPELL_SCHOOL_MASK_NORMAL))
1396413971 {
1396513972 uint32 damage = (uint32)(damageperc * GetMaxHealth() * sWorld->getRate(RATE_DAMAGE_FALL));
1396613973
13967- //float height = movementInfo.pos.m_positionZ;
13968- //UpdateGroundPositionZ(movementInfo.pos.m_positionX, movementInfo.pos.m_positionY, height);
13969-
1397013974 if (damage > 0)
1397113975 {
1397213976 //Prevent fall damage from being more than the player maximum health
1397313977 if (damage > GetMaxHealth())
1397413978 damage = GetMaxHealth();
1397513979
13976- // Gust of Wind
13977- if (HasAura(43621))
13980+ if (HasAura(SPELL_GUST_OF_WIND))
1397813981 damage = GetMaxHealth() / 2;
1397913982
13980- // Divine Protection
13981- if (HasAura(498))
13982- {
13983+ if (HasAura(SPELL_DIVINE_PROTECTION))
1398313984 damage /= 2;
13984- }
1398513985
1398613986 final_damage = EnvironmentalDamage(DAMAGE_FALL, damage);
1398713987 }
0 commit comments