Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stamina damage resist #2190

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Content.Shared/Armor/ArmorComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public sealed partial class ArmorComponent : Component
/// </summary>
[DataField]
public float PriceMultiplier = 1;

/// <summary>
/// DeltaV: The incoming stamina damage will get multiplied by this value.
/// </summary>
[DataField]
public float StaminaDamageCoefficient = 1;
}

/// <summary>
Expand Down
30 changes: 29 additions & 1 deletion Content.Shared/Damage/Systems/StaminaSystem.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
using System.Linq;
using Content.Shared.Administration.Logs;
using Content.Shared.Alert;
using Content.Shared.Armor; // DeltaV
using Content.Shared.CombatMode;
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Events;
using Content.Shared.Database;
using Content.Shared.Effects;
using Content.Shared.IdentityManagement;
using Content.Shared.Inventory; // DeltaV
using Content.Shared.Popups;
using Content.Shared.Projectiles;
using Content.Shared.Rejuvenate;
Expand Down Expand Up @@ -34,6 +36,7 @@ public sealed partial class StaminaSystem : EntitySystem
[Dependency] private readonly SharedColorFlashEffectSystem _color = default!;
[Dependency] private readonly SharedStunSystem _stunSystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly InventorySystem _inventory = default!; // DeltaV

/// <summary>
/// How much of a buffer is there between the stun duration and when stuns can be re-applied.
Expand Down Expand Up @@ -202,7 +205,32 @@ private void OnCollide(EntityUid uid, StaminaDamageOnCollideComponent component,
if (ev.Cancelled)
return;

TakeStaminaDamage(target, component.Damage, source: uid, sound: component.Sound);
// Begin DeltaV code
var damage = component.Damage;

// Check for armor on the target that might reduce stamina damage
if (_inventory.TryGetSlots(target, out var slots))
{
var coefficient = 1.0f;

// Check each equipped item for armor
foreach (var slot in slots)
{
if (!_inventory.TryGetSlotEntity(target, slot.Name, out var equipped))
continue;

// If equipped item has armor component, multiply the coefficient
if (TryComp<ArmorComponent>(equipped, out var armor))
{
coefficient *= armor.StaminaDamageCoefficient;
}
}

damage *= coefficient;
}

TakeStaminaDamage(target, damage, source: uid, sound: component.Sound);
// End DeltaV code
}

private void SetStaminaAlert(EntityUid uid, StaminaComponent? component = null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
Slash: 0.80
Piercing: 0.50
Heat: 0.80
staminaDamageCoefficient: 0.6 # Decent at stopping disablers
- type: ClothingSpeedModifier
walkModifier: 0.90
sprintModifier: 0.90
Expand Down Expand Up @@ -44,6 +45,7 @@
Slash: 0.60
Piercing: 0.90
Heat: 0.90
staminaDamageCoefficient: 0.9
- type: ExplosionResistance # Better than nothing against a blast or shockwave.
damageCoefficient: 0.90
- type: AllowSuitStorage
Expand All @@ -68,6 +70,7 @@
Slash: 0.40
Piercing: 0.70
Heat: 0.70
staminaDamageCoefficient: 0.5
- type: ClothingSpeedModifier
walkModifier: 0.75
sprintModifier: 0.75
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
Radiation: 0.75
Caustic: 0.75
Heat: 0.75
staminaDamageCoefficient: 0.3 # It's a hardsuit, duh
- type: ClothingSpeedModifier
walkModifier: 0.75
sprintModifier: 0.75
Expand Down Expand Up @@ -68,6 +69,7 @@
Radiation: 0.80
Caustic: 0.80
Heat: 0.80
staminaDamageCoefficient: 0.3 # still a hardsuit
- type: ClothingSpeedModifier
walkModifier: 0.85
sprintModifier: 0.85
Expand Down Expand Up @@ -113,6 +115,7 @@
Radiation: 0.70
Caustic: 0.70
Heat: 0.70
staminaDamageCoefficient: 0.2
- type: ClothingSpeedModifier
walkModifier: 0.65
sprintModifier: 0.65
Expand Down Expand Up @@ -158,6 +161,7 @@
Radiation: 0.75
Caustic: 0.75
Heat: 0.75
staminaDamageCoefficient: 0.2
- type: ClothingSpeedModifier
walkModifier: 0.80
sprintModifier: 0.80
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
Slash: 0.70
Piercing: 0.70 #Can save you, but bullets will still hurt. Will take about 10 shots from a Viper before critting, as opposed to 7 while unarmored and 16~ with a bulletproof vest.
Heat: 0.80
staminaDamageCoefficient: 0.75 # DeltaV - Decent at stopping disablers
- type: ExplosionResistance
damageCoefficient: 0.90

Expand Down Expand Up @@ -122,6 +123,7 @@
Piercing: 0.35
Heat: 0.35
Caustic: 0.5
staminaDamageCoefficient: 0.35 # DeltaV
- type: ExplosionResistance
damageCoefficient: 0.35
- type: ClothingSpeedModifier
Expand Down Expand Up @@ -209,6 +211,7 @@
Heat: 0.5
Radiation: 0
Caustic: 0.75
staminaDamageCoefficient: 0.1 # DeltaV
- type: GroupExamine
- type: ProtectedFromStepTriggers
slots: WITHOUT_POCKET
Expand Down Expand Up @@ -275,6 +278,7 @@
Piercing: 0.6
Heat: 0.5
Caustic: 0.9
staminaDamageCoefficient: 0.7 # DeltaV - Some protection against disablers, but you're better off with a vest
- type: ClothingSpeedModifier
walkModifier: 1.0
sprintModifier: 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Slash: 0.9
Piercing: 0.9
Caustic: 0.9
staminaDamageCoefficient: 0.9 # DeltaV
- type: ClothingSpeedModifier
walkModifier: 0.80
sprintModifier: 0.80
Expand Down Expand Up @@ -211,6 +212,7 @@
Slash: 0.6
Piercing: 0.6
Caustic: 0.7
staminaDamageCoefficient: 0.3 # DeltaV
- type: ClothingSpeedModifier
walkModifier: 0.75
sprintModifier: 0.75
Expand Down Expand Up @@ -238,6 +240,7 @@
Blunt: 0.8
Slash: 0.8
Piercing: 0.7
staminaDamageCoefficient: 0.3 # DeltaV
- type: ClothingSpeedModifier
walkModifier: 0.65
sprintModifier: 0.65
Expand Down Expand Up @@ -268,6 +271,7 @@
Slash: 0.6
Piercing: 0.6
Caustic: 0.7
staminaDamageCoefficient: 0.3 # DeltaV
- type: ClothingSpeedModifier
walkModifier: 0.7
sprintModifier: 0.7
Expand Down Expand Up @@ -300,6 +304,7 @@
Heat: 0.5
Radiation: 0.5
Caustic: 0.6
staminaDamageCoefficient: 0.3 # DeltaV
- type: ClothingSpeedModifier
walkModifier: 0.8
sprintModifier: 0.8
Expand Down Expand Up @@ -435,6 +440,7 @@
Piercing: 0.5
Radiation: 0.5
Caustic: 0.6
staminaDamageCoefficient: 0.3 # DeltaV
- type: ClothingSpeedModifier
walkModifier: 0.8
sprintModifier: 0.8
Expand Down Expand Up @@ -501,6 +507,7 @@
Heat: 0.5
Radiation: 0.5
Caustic: 0.5
staminaDamageCoefficient: 0.2 # DeltaV
- type: ClothingSpeedModifier
walkModifier: 0.9
sprintModifier: 0.9
Expand Down Expand Up @@ -568,6 +575,7 @@
Heat: 0.2
Radiation: 0.01
Caustic: 0.5
staminaDamageCoefficient: 0.3 # DeltaV
- type: Item
size: Huge
- type: ClothingSpeedModifier
Expand Down Expand Up @@ -602,6 +610,7 @@
Heat: 0.5
Radiation: 0.25
Caustic: 0.4
staminaDamageCoefficient: 0.2 # DeltaV
- type: ClothingSpeedModifier
walkModifier: 1.0
sprintModifier: 1.0
Expand Down Expand Up @@ -634,6 +643,7 @@
Heat: 0.2
Radiation: 0.2
Caustic: 0.2
staminaDamageCoefficient: 0.1 # DeltaV
- type: ClothingSpeedModifier
walkModifier: 0.9
sprintModifier: 0.65
Expand Down
Loading