public void TakeDamage_Falling(float amount) { if (IsDead || Invincible) { return; } // handle lifestone protection? if (UnderLifestoneProtection) { HandleLifestoneProtection(); return; } // scale by bludgeon protection var resistance = EnchantmentManager.GetResistanceMod(DamageType.Bludgeon); var damage = (uint)Math.Round(amount * resistance); // update health var damageTaken = (uint)-UpdateVitalDelta(Health, (int)-damage); DamageHistory.Add(this, DamageType.Bludgeon, damageTaken); var msg = Strings.GetFallMessage(damageTaken, Health.MaxValue); SendMessage(msg, ChatMessageType.Combat); if (Health.Current <= 0) { OnDeath(new DamageHistoryInfo(this), DamageType.Bludgeon, false); Die(); } else { EnqueueBroadcast(new GameMessageSound(Guid, Sound.Wound3, 1.0f)); } }
public float GetResistanceMod(DamageType damageType, WorldObject damageSource, float weaponResistanceMod) { var enchantmentMod = damageSource != null && damageSource.IgnoreMagicResist ? 1.0f : EnchantmentManager.GetResistanceMod(damageType); return(enchantmentMod * weaponResistanceMod); }