Skip to content

Commit

Permalink
New Traits: Steadfast And Feeble (#1431)
Browse files Browse the repository at this point in the history
# Description

Adds two new traits, Steadfast and Feeble that modify how affected a
character is by injury slows.

Steadfast (-4 points)
- 25% slow at 60 damage -> 17% slow at 70 damage
- 45% slow at 80 damage -> 30% slow at 90 damage

Feeble (4 points)
- 25% slow at 60 damage -> 30% slow at 45 damage
- 45% slow at 80 damage -> 54% slow at 65 damage

Also *half-reverts* the reduction of injury slows from a Delta-V PR by
ODJ (DeltaV-Station/Delta-v#741) from 30%/50% to
20%/40%, now 25%/45% to incentivize taking Steadfast.

The injury slow resists for jackboot and combat boots has been nerfed
from 50% to 20% to account for Steadfast.

IPCs' injury slow at 60 damage has been decreased from 30% to 25% to be
more consistent with other species.

## Technical details

No trait with jackboots:
- 25% slow -> 20% slow
- 45% slow -> 36% slow

Steadfast with jackboots:
- 17% slow -> 13.6% slow
- 30% slow -> 24.5% slow

Feeble with jackboots:
- 30% slow -> 24% slow
- 54% slow -> 43.2% slow

Although Feeble with jackboots has lower slow values than the base
slows, the slow damage thresholds (-15) are still lower, making the
slows occur with less damage.

## Media

**Steadfast**


![image](https://github.com/user-attachments/assets/8b804040-7f0f-4a49-b0cf-1a83efd4c790)

**Feeble**


![image](https://github.com/user-attachments/assets/a1759f49-f68c-4cc4-991b-b6864e67e016)

**Jackboots**


![image](https://github.com/user-attachments/assets/67132fd0-5a97-43f1-a714-a9deae26f825)

# Changelog

<!--
You can add an author after the `:cl:` to change the name that appears
in the changelog (ex: `:cl: Death`)
Leaving it blank will default to your GitHub display name
This includes all available types for the changelog
-->

:cl: Skubman
- add: Added two new traits: Steadfast and Feeble that decrease or
increase the effect of slows from injuries.
- tweak: Injury slows for most species has been slightly increased, but
this can be mitigated with the Steadfast trait.
- tweak: The jackboots' injury slow resistance has been decreased from
50% to 20%.
- tweak: Combat boots now add resistance to injury slows like jackboots.

---------

Signed-off-by: Skubman <[email protected]>
Co-authored-by: VMSolidus <[email protected]>
  • Loading branch information
angelofallars and VMSolidus authored Jan 5, 2025
1 parent 5cb3d42 commit 68a11db
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 13 deletions.
38 changes: 38 additions & 0 deletions Content.Server/Traits/TraitSystem.Functions.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Shared.FixedPoint;
using Content.Shared.Traits;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;
Expand All @@ -11,6 +12,7 @@
using Content.Shared.Mood;
using Content.Shared.Traits.Assorted.Components;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.Mobs.Components;
Expand Down Expand Up @@ -547,3 +549,39 @@ public override void OnPlayerSpawn(EntityUid uid,
staminaComponent.Cooldown += CooldownModifier;
}
}

/// <summary>
/// Used for traits that modify SlowOnDamageComponent.
/// </summary>
[UsedImplicitly]
public sealed partial class TraitModifySlowOnDamage : TraitFunction
{
// <summary>
// A flat modifier to add to all damage threshold keys.
// </summary>
[DataField, AlwaysPushInheritance]
public float DamageThresholdsModifier;

// <summary>
// A multiplier applied to all speed modifier values.
// The higher the multiplier, the stronger the slowdown.
// </summary>
[DataField, AlwaysPushInheritance]
public float SpeedModifierMultiplier = 1f;

public override void OnPlayerSpawn(EntityUid uid,
IComponentFactory factory,
IEntityManager entityManager,
ISerializationManager serializationManager)
{
if (!entityManager.TryGetComponent<SlowOnDamageComponent>(uid, out var slowOnDamage))
return;

var newSpeedModifierThresholds = new Dictionary<FixedPoint2, float>();

foreach (var (damageThreshold, speedModifier) in slowOnDamage.SpeedModifierThresholds)
newSpeedModifierThresholds[damageThreshold + DamageThresholdsModifier] = 1 - (1 - speedModifier) * SpeedModifierMultiplier;

slowOnDamage.SpeedModifierThresholds = newSpeedModifierThresholds;
}
}
8 changes: 2 additions & 6 deletions Content.Shared/Damage/Systems/SlowOnDamageSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,13 @@ private void OnDamageChanged(EntityUid uid, SlowOnDamageComponent component, Dam

private void OnModifySpeed(Entity<ClothingSlowOnDamageModifierComponent> ent, ref InventoryRelayedEvent<ModifySlowOnDamageSpeedEvent> args)
{
var dif = 1 - args.Args.Speed;
if (dif <= 0)
return;

// reduces the slowness modifier by the given coefficient
args.Args.Speed += dif * ent.Comp.Modifier;
args.Args.Speed = 1 - (1 - args.Args.Speed) * ent.Comp.Modifier;
}

private void OnExamined(Entity<ClothingSlowOnDamageModifierComponent> ent, ref ExaminedEvent args)
{
var msg = Loc.GetString("slow-on-damage-modifier-examine", ("mod", (1 - ent.Comp.Modifier) * 100));
var msg = Loc.GetString("slow-on-damage-modifier-examine", ("mod", Math.Round((1 - ent.Comp.Modifier) * 100)));
args.PushMarkup(msg);
}

Expand Down
2 changes: 1 addition & 1 deletion Resources/Locale/en-US/damage/stamina.ftl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
melee-stamina = Not enough stamina
slow-on-damage-modifier-examine = Slowness from injuries is reduced by [color=yellow]{$mod}%[/color]
slow-on-damage-modifier-examine = Slowness from injuries is reduced by [color=yellow]{$mod}%[/color].
throw-no-stamina = You don't have enough stamina to throw the {$item}!
14 changes: 14 additions & 0 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,20 @@ trait-description-LowPainTolerance =
Your tolerance for pain is far below average, and its effects are more inhibiting.
Your melee/throwing damage is penalized by up to an additional 15% when taking stamina damage.
trait-name-Steadfast = Steadfast
trait-description-Steadfast =
When others would buckle from the weight of your injuries, you still march forward unrelentingly.
For most species [color=gray](excluding IPC/Shadowkin)[/color], this trait modifies:
- [color=yellow]25%[/color] movement slow at [color=red]60[/color] damage ➔ [color=yellow]17%[/color] movement slow at [color=red]70[/color] damage
- [color=yellow]45%[/color] movement slow at [color=red]80[/color] damage ➔ [color=yellow]30%[/color] movement slow at [color=red]90[/color] damage
trait-name-Feeble = Feeble
trait-description-Feeble =
Your body responds poorly to injuries, making damage affect your movement more severely.
For most species [color=gray](excluding IPC/Shadowkin)[/color], this trait modifies:
- [color=yellow]25%[/color] movement slow at [color=red]60[/color] damage ➔ [color=yellow]30%[/color] movement slow at [color=red]45[/color] damage
- [color=yellow]45%[/color] movement slow at [color=red]80[/color] damage ➔ [color=yellow]54%[/color] movement slow at [color=red]65[/color] damage
trait-name-MartialArtist = Martial Artist
trait-description-MartialArtist =
You have received formal training in unarmed combat, whether with Fists, Feet, or Claws.
Expand Down
6 changes: 5 additions & 1 deletion Resources/Prototypes/Entities/Clothing/Shoes/boots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
- type: Clothing
sprite: Clothing/Shoes/Boots/jackboots.rsi
- type: ClothingSlowOnDamageModifier
modifier: 0.5
modifier: 0.8

- type: entity
parent: ClothingShoesMilitaryBase
Expand Down Expand Up @@ -67,6 +67,8 @@
sprite: Clothing/Shoes/Boots/combatboots.rsi
- type: Clothing
sprite: Clothing/Shoes/Boots/combatboots.rsi
- type: ClothingSlowOnDamageModifier
modifier: 0.8

- type: entity
parent: ClothingShoesMilitaryBase
Expand All @@ -93,6 +95,8 @@
sprite: Clothing/Shoes/Boots/mercboots.rsi
- type: Clothing
sprite: Clothing/Shoes/Boots/mercboots.rsi
- type: ClothingSlowOnDamageModifier
modifier: 0.6

- type: entity
parent: ClothingShoesBaseButcherable
Expand Down
2 changes: 1 addition & 1 deletion Resources/Prototypes/Entities/Clothing/Shoes/specific.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
- type: Clothing
sprite: Clothing/Shoes/Specific/swat.rsi
- type: ClothingSlowOnDamageModifier
modifier: 0.5
modifier: 0.7

- type: entity
parent: ClothingShoesBaseButcherable
Expand Down
4 changes: 2 additions & 2 deletions Resources/Prototypes/Entities/Mobs/Player/ipc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
- !type:GibBehavior { }
- type: SlowOnDamage
speedModifierThresholds:
60: 0.7
60: 0.75
90: 0.5
120: 0.3
- type: SiliconDownOnDead
Expand Down Expand Up @@ -142,4 +142,4 @@
- type: HumanoidAppearance
species: IPC
- type: Inventory
templateId: ipc
templateId: ipc
4 changes: 2 additions & 2 deletions Resources/Prototypes/Entities/Mobs/Species/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
species: Human
- type: SlowOnDamage
speedModifierThresholds:
60: 0.8 # DV - Was 0.7
80: 0.6 # DV - Was 0.5
60: 0.75
80: 0.55
- type: Fixtures
fixtures: # TODO: This needs a second fixture just for mob collisions.
fix1:
Expand Down
46 changes: 46 additions & 0 deletions Resources/Prototypes/Traits/physical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,52 @@
- type: PainTolerance
rangeModifier: 0.6

- type: trait
id: Steadfast
category: Physical
points: -4
requirements:
- !type:CharacterJobRequirement
inverted: true
jobs:
- Borg
- MedicalBorg
- !type:CharacterSpeciesRequirement
inverted: true
species:
- Felinid
- !type:CharacterTraitRequirement
inverted: true
traits:
- Feeble
functions:
- !type:TraitModifySlowOnDamage
damageThresholdsModifier: 10
speedModifierMultiplier: 0.68

- type: trait
id: Feeble
category: Physical
points: 3
requirements:
- !type:CharacterJobRequirement
inverted: true
jobs:
- Borg
- MedicalBorg
- !type:CharacterSpeciesRequirement
inverted: true
species:
- Felinid
- !type:CharacterTraitRequirement
inverted: true
traits:
- Steadfast
functions:
- !type:TraitModifySlowOnDamage
damageThresholdsModifier: -15
speedModifierMultiplier: 1.2

- type: trait
id: MartialArtist
category: Physical
Expand Down

0 comments on commit 68a11db

Please sign in to comment.