From 5d5f6b2e75e58e1e9ddd0ef9d1168e7a4311c5be Mon Sep 17 00:00:00 2001 From: Angelo Fallaria Date: Sat, 3 Aug 2024 05:56:24 +0800 Subject: [PATCH] feat(traits): add new traits Vigor and Lethargy --- .../StaminaCritModifierComponent.cs | 16 ++++++++ .../Systems/TraitStatModifierSystem.cs | 12 +++++- Resources/Locale/en-US/traits/traits.ftl | 10 +++++ Resources/Prototypes/Traits/physical.yml | 38 ++++++++++++++++++- 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 Content.Shared/Traits/Assorted/Components/StaminaCritModifierComponent.cs diff --git a/Content.Shared/Traits/Assorted/Components/StaminaCritModifierComponent.cs b/Content.Shared/Traits/Assorted/Components/StaminaCritModifierComponent.cs new file mode 100644 index 00000000000..28c8ab9b089 --- /dev/null +++ b/Content.Shared/Traits/Assorted/Components/StaminaCritModifierComponent.cs @@ -0,0 +1,16 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Traits.Assorted.Components; + +/// +/// This is used for any trait that modifies stamina CritThreshold +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class StaminaCritModifierComponent : Component +{ + /// + /// The amount that an entity's stamina critical threshold will be incremented by. + /// + [DataField] + public int CritThresholdModifier { get; private set; } = 0; +} diff --git a/Content.Shared/Traits/Assorted/Systems/TraitStatModifierSystem.cs b/Content.Shared/Traits/Assorted/Systems/TraitStatModifierSystem.cs index fa7cc7fce07..85ecf151dd9 100644 --- a/Content.Shared/Traits/Assorted/Systems/TraitStatModifierSystem.cs +++ b/Content.Shared/Traits/Assorted/Systems/TraitStatModifierSystem.cs @@ -3,6 +3,7 @@ using Content.Shared.Mobs.Systems; using Content.Shared.Traits.Assorted.Components; using Content.Shared.Weapons.Melee.Events; +using Content.Shared.Damage.Components; namespace Content.Shared.Traits.Assorted.Systems; @@ -15,6 +16,7 @@ public override void Initialize() base.Initialize(); SubscribeLocalEvent(OnCritStartup); SubscribeLocalEvent(OnDeadStartup); + SubscribeLocalEvent(OnStaminaCritStartup); SubscribeLocalEvent(OnAdrenalineGetDamage); SubscribeLocalEvent(OnPainToleranceGetDamage); } @@ -39,6 +41,14 @@ private void OnDeadStartup(EntityUid uid, DeadModifierComponent component, Compo _threshold.SetMobStateThreshold(uid, deadThreshold + component.DeadThresholdModifier, Mobs.MobState.Dead); } + private void OnStaminaCritStartup(EntityUid uid, StaminaCritModifierComponent component, ComponentStartup args) + { + if (!TryComp(uid, out var stamina)) + return; + + stamina.CritThreshold += component.CritThresholdModifier; + } + private void OnAdrenalineGetDamage(EntityUid uid, AdrenalineComponent component, ref GetMeleeDamageEvent args) { var modifier = _contests.HealthContest(uid, component.BypassClamp, component.RangeModifier); @@ -50,4 +60,4 @@ private void OnPainToleranceGetDamage(EntityUid uid, PainToleranceComponent comp var modifier = _contests.StaminaContest(uid, component.BypassClamp, component.RangeModifier); args.Damage *= component.Inverse ? 1 / modifier : modifier; } -} \ No newline at end of file +} diff --git a/Resources/Locale/en-US/traits/traits.ftl b/Resources/Locale/en-US/traits/traits.ftl index 25635c0187a..20cb39c87eb 100644 --- a/Resources/Locale/en-US/traits/traits.ftl +++ b/Resources/Locale/en-US/traits/traits.ftl @@ -103,3 +103,13 @@ trait-description-MartialArtist = You have received formal training in unarmed combat, whether with Fists, Feet, or Claws. Your unarmed melee attacks have a small range increase, and deal 50% more damage. This does not apply to any form of armed melee, only the weapons you were naturally born with. + +trait-name-Vigor = Vigor +trait-description-Vigor = + Whether by pure determination, fitness, or bionic augmentations, your endurance is enhanced. + Your stamina is increased by 15 points. + +trait-name-Lethargy = Lethargy +trait-description-Lethargy = + You become tired faster than others, making you more vulnerable to exhaustion and fatigue. + Your stamina is decreased by 20 points. diff --git a/Resources/Prototypes/Traits/physical.yml b/Resources/Prototypes/Traits/physical.yml index d39bd67020f..14341f3fa10 100644 --- a/Resources/Prototypes/Traits/physical.yml +++ b/Resources/Prototypes/Traits/physical.yml @@ -70,6 +70,42 @@ - type: CritModifier critThresholdModifier: -10 +- type: trait + id: Vigor + category: Physical + points: -2 + requirements: + - !type:CharacterJobRequirement + inverted: true + jobs: + - Borg + - MedicalBorg + - !type:CharacterTraitRequirement + inverted: true + traits: + - Lethargy + components: + - type: StaminaCritModifier + critThresholdModifier: 15 + +- type: trait + id: Lethargy + category: Physical + points: 1 + requirements: + - !type:CharacterJobRequirement + inverted: true + jobs: + - Borg + - MedicalBorg + - !type:CharacterTraitRequirement + inverted: true + traits: + - Vigor + components: + - type: StaminaCritModifier + critThresholdModifier: -20 + - type: trait id: HighAdrenaline category: Physical @@ -161,4 +197,4 @@ coefficients: Blunt: 1.5 Slash: 1.5 - Piercing: 1.5 \ No newline at end of file + Piercing: 1.5