mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Player.cpp
This commit is contained in:
parent
18ecba8b5f
commit
ded3b8a00d
1 changed files with 47 additions and 0 deletions
|
|
@ -19587,6 +19587,53 @@ uint8 Player::CanEquipUniqueItem( ItemPrototype const* itemProto, uint8 except_s
|
|||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
void Player::HandleFall(MovementInfo const& movementInfo)
|
||||
{
|
||||
// calculate total z distance of the fall
|
||||
float z_diff = m_lastFallZ - movementInfo.z;
|
||||
sLog.outDebug("zDiff = %f", z_diff);
|
||||
|
||||
//Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
|
||||
// 14.57 can be calculated by resolving damageperc formular below to 0
|
||||
if (z_diff >= 14.57f && !isDead() && !isGameMaster() &&
|
||||
!HasAuraType(SPELL_AURA_HOVER) && !HasAuraType(SPELL_AURA_FEATHER_FALL) &&
|
||||
!HasAuraType(SPELL_AURA_FLY) && !IsImmunedToDamage(SPELL_SCHOOL_MASK_NORMAL) )
|
||||
{
|
||||
//Safe fall, fall height reduction
|
||||
int32 safe_fall = GetTotalAuraModifier(SPELL_AURA_SAFE_FALL);
|
||||
|
||||
float damageperc = 0.018f*(z_diff-safe_fall)-0.2426f;
|
||||
|
||||
if(damageperc >0 )
|
||||
{
|
||||
uint32 damage = (uint32)(damageperc * GetMaxHealth()*sWorld.getRate(RATE_DAMAGE_FALL));
|
||||
|
||||
float height = movementInfo.z;
|
||||
UpdateGroundPositionZ(movementInfo.x,movementInfo.y,height);
|
||||
|
||||
if (damage > 0)
|
||||
{
|
||||
//Prevent fall damage from being more than the player maximum health
|
||||
if (damage > GetMaxHealth())
|
||||
damage = GetMaxHealth();
|
||||
|
||||
// Gust of Wind
|
||||
if (GetDummyAura(43621))
|
||||
damage = GetMaxHealth()/2;
|
||||
|
||||
EnvironmentalDamage(GetGUID(), DAMAGE_FALL, damage);
|
||||
|
||||
// recheck alive, might have died of EnvironmentalDamage
|
||||
if (isAlive())
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FALL_WITHOUT_DYING, uint32(z_diff*100));
|
||||
}
|
||||
|
||||
//Z given by moveinfo, LastZ, FallTime, WaterZ, MapZ, Damage, Safefall reduction
|
||||
DEBUG_LOG("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d" , movementInfo.z, height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Player::BuildPlayerTalentsInfoData(WorldPacket *data)
|
||||
{
|
||||
*data << uint32(GetFreeTalentPoints()); // unspentTalentPoints
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue