Skip to content

Commit

Permalink
feat(traits): add new traits Vigor and Lethargy
Browse files Browse the repository at this point in the history
  • Loading branch information
angelofallars committed Aug 2, 2024
1 parent 2fbece4 commit 5d5f6b2
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Robust.Shared.GameStates;

namespace Content.Shared.Traits.Assorted.Components;

/// <summary>
/// This is used for any trait that modifies stamina CritThreshold
/// </summary>
[RegisterComponent, NetworkedComponent]
public sealed partial class StaminaCritModifierComponent : Component
{
/// <summary>
/// The amount that an entity's stamina critical threshold will be incremented by.
/// </summary>
[DataField]
public int CritThresholdModifier { get; private set; } = 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -15,6 +16,7 @@ public override void Initialize()
base.Initialize();
SubscribeLocalEvent<CritModifierComponent, ComponentStartup>(OnCritStartup);
SubscribeLocalEvent<DeadModifierComponent, ComponentStartup>(OnDeadStartup);
SubscribeLocalEvent<StaminaCritModifierComponent, ComponentStartup>(OnStaminaCritStartup);
SubscribeLocalEvent<AdrenalineComponent, GetMeleeDamageEvent>(OnAdrenalineGetDamage);
SubscribeLocalEvent<PainToleranceComponent, GetMeleeDamageEvent>(OnPainToleranceGetDamage);
}
Expand All @@ -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<StaminaComponent>(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);
Expand All @@ -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;
}
}
}
10 changes: 10 additions & 0 deletions Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
38 changes: 37 additions & 1 deletion Resources/Prototypes/Traits/physical.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -161,4 +197,4 @@
coefficients:
Blunt: 1.5
Slash: 1.5
Piercing: 1.5
Piercing: 1.5

0 comments on commit 5d5f6b2

Please sign in to comment.