Build 0.20.6.0
This commit is contained in:
@@ -2182,8 +2182,6 @@ namespace Barotrauma
|
||||
private AttackTargetData currentAttackTarget;
|
||||
public void SetAttackTarget(Limb attackLimb, IDamageable damageTarget, Vector2 attackPos)
|
||||
{
|
||||
DebugConsole.NewMessage($"SetAttackTarget {this.ToString()}: " + (damageTarget?.ToString() ?? null));
|
||||
|
||||
currentAttackTarget = new AttackTargetData()
|
||||
{
|
||||
AttackLimb = attackLimb,
|
||||
|
||||
@@ -71,6 +71,13 @@ namespace Barotrauma
|
||||
/// </summary>
|
||||
public Character Source;
|
||||
|
||||
private readonly static LocalizedString[] strengthTexts = new LocalizedString[]
|
||||
{
|
||||
TextManager.Get("AfflictionStrengthLow"),
|
||||
TextManager.Get("AfflictionStrengthMedium"),
|
||||
TextManager.Get("AfflictionStrengthHigh")
|
||||
};
|
||||
|
||||
public Affliction(AfflictionPrefab prefab, float strength)
|
||||
{
|
||||
#if CLIENT
|
||||
@@ -89,6 +96,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Serialize(XElement element)
|
||||
{
|
||||
SerializableProperty.SerializeProperties(this, element);
|
||||
@@ -108,6 +116,17 @@ namespace Barotrauma
|
||||
|
||||
public override string ToString() => Prefab == null ? "Affliction (Invalid)" : $"Affliction ({Prefab.Name})";
|
||||
|
||||
public LocalizedString GetStrengthText()
|
||||
{
|
||||
return GetStrengthText(Strength, Prefab.MaxStrength);
|
||||
}
|
||||
|
||||
public static LocalizedString GetStrengthText(float strength, float maxStrength)
|
||||
{
|
||||
return strengthTexts[
|
||||
MathHelper.Clamp((int)Math.Floor(strength / maxStrength * strengthTexts.Length), 0, strengthTexts.Length - 1)];
|
||||
}
|
||||
|
||||
public AfflictionPrefab.Effect GetActiveEffect() => Prefab.GetActiveEffect(Strength);
|
||||
|
||||
public float GetVitalityDecrease(CharacterHealth characterHealth)
|
||||
|
||||
+2
-1
@@ -10,7 +10,8 @@
|
||||
public override void Update(CharacterHealth characterHealth, Limb targetLimb, float deltaTime)
|
||||
{
|
||||
base.Update(characterHealth, targetLimb, deltaTime);
|
||||
characterHealth.BloodlossAmount += Strength * (1.0f / 60.0f) * deltaTime;
|
||||
float bloodlossResistance = GetResistance(characterHealth.BloodlossAffliction.Identifier);
|
||||
characterHealth.BloodlossAmount += Strength * (1.0f - bloodlossResistance) / 60.0f * deltaTime;
|
||||
if (Source != null)
|
||||
{
|
||||
characterHealth.BloodlossAffliction.Source = Source;
|
||||
|
||||
@@ -880,17 +880,19 @@ namespace Barotrauma
|
||||
{
|
||||
if (!Character.NeedsOxygen) { return; }
|
||||
|
||||
float oxygenlowResistance = GetResistance(oxygenLowAffliction.Prefab);
|
||||
float prevOxygen = OxygenAmount;
|
||||
if (IsUnconscious)
|
||||
{
|
||||
//clamp above 0.1 (no amount of oxygen low resistance should keep the character alive indefinitely)
|
||||
float decreaseSpeed = Math.Max(0.1f, 1f - oxygenlowResistance);
|
||||
//the character dies of oxygen deprivation in 100 seconds after losing consciousness
|
||||
OxygenAmount = MathHelper.Clamp(OxygenAmount - 1.0f * deltaTime, -100.0f, 100.0f);
|
||||
OxygenAmount = MathHelper.Clamp(OxygenAmount - decreaseSpeed * deltaTime, -100.0f, 100.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
float decreaseSpeed = -5.0f;
|
||||
float increaseSpeed = 10.0f;
|
||||
float oxygenlowResistance = GetResistance(oxygenLowAffliction.Prefab);
|
||||
decreaseSpeed *= (1f - oxygenlowResistance);
|
||||
increaseSpeed *= (1f + oxygenlowResistance);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user