diff --git a/Content.Server/Traits/TraitSystem.Functions.cs b/Content.Server/Traits/TraitSystem.Functions.cs index 8e53ff69a55..29ab1512ae6 100644 --- a/Content.Server/Traits/TraitSystem.Functions.cs +++ b/Content.Server/Traits/TraitSystem.Functions.cs @@ -1,3 +1,4 @@ +using Content.Shared.FixedPoint; using Content.Shared.Traits; using JetBrains.Annotations; using Robust.Shared.Prototypes; @@ -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; @@ -547,3 +549,39 @@ public override void OnPlayerSpawn(EntityUid uid, staminaComponent.Cooldown += CooldownModifier; } } + +/// +/// Used for traits that modify SlowOnDamageComponent. +/// +[UsedImplicitly] +public sealed partial class TraitModifySlowOnDamage : TraitFunction +{ + // + // A flat modifier to add to all damage threshold keys. + // + [DataField, AlwaysPushInheritance] + public float DamageThresholdsModifier; + + // + // A multiplier applied to all speed modifier values. + // The higher the multiplier, the stronger the slowdown. + // + [DataField, AlwaysPushInheritance] + public float SpeedModifierMultiplier = 1f; + + public override void OnPlayerSpawn(EntityUid uid, + IComponentFactory factory, + IEntityManager entityManager, + ISerializationManager serializationManager) + { + if (!entityManager.TryGetComponent(uid, out var slowOnDamage)) + return; + + var newSpeedModifierThresholds = new Dictionary(); + + foreach (var (damageThreshold, speedModifier) in slowOnDamage.SpeedModifierThresholds) + newSpeedModifierThresholds[damageThreshold + DamageThresholdsModifier] = 1 - (1 - speedModifier) * SpeedModifierMultiplier; + + slowOnDamage.SpeedModifierThresholds = newSpeedModifierThresholds; + } +} diff --git a/Content.Shared/Damage/Systems/SlowOnDamageSystem.cs b/Content.Shared/Damage/Systems/SlowOnDamageSystem.cs index 3e50ee35572..78650ec5cfb 100644 --- a/Content.Shared/Damage/Systems/SlowOnDamageSystem.cs +++ b/Content.Shared/Damage/Systems/SlowOnDamageSystem.cs @@ -61,17 +61,13 @@ private void OnDamageChanged(EntityUid uid, SlowOnDamageComponent component, Dam private void OnModifySpeed(Entity ent, ref InventoryRelayedEvent 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 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); } diff --git a/Resources/Locale/en-US/damage/stamina.ftl b/Resources/Locale/en-US/damage/stamina.ftl index 09f9164497a..777101f93e4 100644 --- a/Resources/Locale/en-US/damage/stamina.ftl +++ b/Resources/Locale/en-US/damage/stamina.ftl @@ -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}! diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index 25188ca851b..d3b5f1eef3a 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -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. diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/boots.yml b/Resources/Prototypes/Entities/Clothing/Shoes/boots.yml index 069555c836a..01576a1f932 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/boots.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/boots.yml @@ -21,7 +21,7 @@ - type: Clothing sprite: Clothing/Shoes/Boots/jackboots.rsi - type: ClothingSlowOnDamageModifier - modifier: 0.5 + modifier: 0.8 - type: entity parent: ClothingShoesMilitaryBase @@ -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 @@ -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 diff --git a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml index 3ec17e2bbe4..e9ea1239285 100644 --- a/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml +++ b/Resources/Prototypes/Entities/Clothing/Shoes/specific.yml @@ -137,7 +137,7 @@ - type: Clothing sprite: Clothing/Shoes/Specific/swat.rsi - type: ClothingSlowOnDamageModifier - modifier: 0.5 + modifier: 0.7 - type: entity parent: ClothingShoesBaseButcherable diff --git a/Resources/Prototypes/Entities/Mobs/Player/ipc.yml b/Resources/Prototypes/Entities/Mobs/Player/ipc.yml index 54c157cc3e0..816f6a6a3c7 100644 --- a/Resources/Prototypes/Entities/Mobs/Player/ipc.yml +++ b/Resources/Prototypes/Entities/Mobs/Player/ipc.yml @@ -58,7 +58,7 @@ - !type:GibBehavior { } - type: SlowOnDamage speedModifierThresholds: - 60: 0.7 + 60: 0.75 90: 0.5 120: 0.3 - type: SiliconDownOnDead @@ -142,4 +142,4 @@ - type: HumanoidAppearance species: IPC - type: Inventory - templateId: ipc \ No newline at end of file + templateId: ipc diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index f740b89f424..a9d96ecde54 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -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: diff --git a/Resources/Prototypes/Traits/physical.yml b/Resources/Prototypes/Traits/physical.yml index f2f071a309d..3f3d460f999 100644 --- a/Resources/Prototypes/Traits/physical.yml +++ b/Resources/Prototypes/Traits/physical.yml @@ -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