Skip to content

Commit

Permalink
feat(traits): add new trait Hemophilia
Browse files Browse the repository at this point in the history
  • Loading branch information
angelofallars committed Aug 7, 2024
1 parent bd11307 commit b4b2fd3
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Content.Server/Body/Components/BloodstreamComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace Content.Server.Body.Components
{
[RegisterComponent, Access(typeof(BloodstreamSystem), typeof(ReactionMixerSystem), typeof(BloodDeficiencySystem))]
[RegisterComponent, Access(typeof(BloodstreamSystem), typeof(ReactionMixerSystem), typeof(BloodDeficiencySystem), typeof(HemophiliaSystem))]
public sealed partial class BloodstreamComponent : Component
{
public static string DefaultChemicalsSolutionName = "chemicals";
Expand Down
21 changes: 21 additions & 0 deletions Content.Server/Traits/HemophiliaComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Content.Shared.Damage;
namespace Content.Server.Traits.Assorted;

/// <summary>
/// This is used for the Hemophilia trait.
/// </summary>
[RegisterComponent]
public sealed partial class HemophiliaComponent : Component
{
// <summary>
// What the BleedReductionAmount should be multiplied by.
// </summary>
[DataField(required: true)]
public float BleedReductionModifier = 1f;

/// <summary>
/// The damage increase from this trait.
/// </summary>
[DataField(required: true)]
public DamageModifierSet DamageModifiers = default!;
}
28 changes: 28 additions & 0 deletions Content.Server/Traits/HemophiliaSystem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Content.Server.Body.Systems;
using Content.Server.Body.Components;
using Content.Shared.Damage;

namespace Content.Server.Traits.Assorted;

public sealed class HemophiliaSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<HemophiliaComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<HemophiliaComponent, DamageModifyEvent>(OnDamageModify);
}

private void OnStartup(EntityUid uid, HemophiliaComponent component, ComponentStartup args)
{
if (!TryComp<BloodstreamComponent>(uid, out var bloodstream))
return;

bloodstream.BleedReductionAmount *= component.BleedReductionModifier;
}

private void OnDamageModify(EntityUid uid, HemophiliaComponent component, DamageModifyEvent args)
{
args.Damage = DamageSpecifier.ApplyModifierSet(args.Damage, component.DamageModifiers);
}
}
7 changes: 6 additions & 1 deletion Resources/Locale/en-US/traits/traits.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ trait-description-BloodDeficiency =
Your body loses more blood than it can replenish.
You lose blood over time, and when left untreated you will eventually die from blood loss.
trait-name-Hemophilia = Hemophilia
trait-description-Hemophilia =
Your body's ability to form blood clots is impaired.
You bleed twice as long, and you have easy bruising, taking 10% more Blunt damage.
trait-name-Paracusia = Paracusia
trait-description-Paracusia = You hear sounds that aren't really there
Expand Down Expand Up @@ -106,4 +111,4 @@ trait-description-Spearmaster =
trait-name-WeaponsGeneralist = Weapons Generalist
trait-description-WeaponsGeneralist =
You are a jack of all trades with melee weapons, enabling you to be versatile with your weapon arsenal.
Your melee damage bonus for all Brute damage types (Blunt, Slash, Piercing) becomes 25%.
Your melee damage bonus for all Brute damage types (Blunt, Slash, Piercing) becomes 25%.
17 changes: 17 additions & 0 deletions Resources/Prototypes/Traits/disabilities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,20 @@
components:
- type: BloodDeficiency # 0.07 = start taking bloodloss damage at around ~21.4 minutes,
bloodLossAmount: 0.07 # then become crit ~10 minutes later

- type: trait
id: Hemophilia
category: Physical
points: 1
requirements:
- !type:CharacterJobRequirement
inverted: true
jobs:
- Borg
- MedicalBorg
components:
- type: Hemophilia
bleedReductionModifier: 0.5
damageModifiers:
coefficients:
Blunt: 1.1

0 comments on commit b4b2fd3

Please sign in to comment.