Melee rebalancing (#17520)
This commit is contained in:
@@ -36,12 +36,12 @@ public sealed class StaminaComponent : Component
|
||||
/// <summary>
|
||||
/// How much stamina damage is required to entire stam crit.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("excess")]
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("critThreshold")]
|
||||
public float CritThreshold = 100f;
|
||||
|
||||
/// <summary>
|
||||
/// To avoid continuously updating our data we track the last time we updated so we can extrapolate our current stamina.
|
||||
/// </summary>
|
||||
[DataField("lastUpdate", customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
[DataField("nextUpdate", customTypeSerializer:typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan NextUpdate = TimeSpan.Zero;
|
||||
}
|
||||
|
||||
@@ -227,6 +227,23 @@ public sealed class StaminaSystem : EntitySystem
|
||||
_alerts.ShowAlert(uid, AlertType.Stamina, (short) severity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to take stamina damage without raising the entity over the crit threshold.
|
||||
/// </summary>
|
||||
public bool TryTakeStamina(EntityUid uid, float value, StaminaComponent? component = null, EntityUid? source = null, EntityUid? with = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false))
|
||||
return false;
|
||||
|
||||
var oldStam = component.StaminaDamage;
|
||||
|
||||
if (oldStam + value > component.CritThreshold || component.Critical)
|
||||
return false;
|
||||
|
||||
TakeStaminaDamage(uid, value, component, source, with);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void TakeStaminaDamage(EntityUid uid, float value, StaminaComponent? component = null, EntityUid? source = null, EntityUid? with = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component, false))
|
||||
|
||||
Reference in New Issue
Block a user