-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'loadout-items' of https://github.com/DangerRevolution/E…
…instein-Engines into loadout-items
- Loading branch information
Showing
19 changed files
with
470 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
Content.Shared/Traits/Assorted/Components/AdrenalineComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.Traits.Assorted.Components; | ||
|
||
/// <summary> | ||
/// This is used for any trait that modifies the Melee System implementation of Health Contest | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class AdrenalineComponent : Component | ||
{ | ||
/// <summary> | ||
/// When true, multiplies by the inverse of the resulting Contest. | ||
/// </summary> | ||
[DataField] | ||
public bool Inverse { get; private set; } = false; | ||
|
||
/// <summary> | ||
/// Used as the RangeModifier input for a Health Contest. | ||
/// </summary> | ||
[DataField] | ||
public float RangeModifier { get; private set; } = 1; | ||
|
||
/// <summary> | ||
/// Used as the BypassClamp input for a Health Contest. | ||
/// </summary> | ||
[DataField] | ||
public bool BypassClamp { get; private set; } = false; | ||
} |
16 changes: 16 additions & 0 deletions
16
Content.Shared/Traits/Assorted/Components/CritModifierComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 CritThreshold | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class CritModifierComponent : Component | ||
{ | ||
/// <summary> | ||
/// The amount that an entity's critical threshold will be incremented by. | ||
/// </summary> | ||
[DataField] | ||
public int CritThresholdModifier { get; private set; } = 0; | ||
} |
16 changes: 16 additions & 0 deletions
16
Content.Shared/Traits/Assorted/Components/DeadModifierComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 DeadThreshold | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class DeadModifierComponent : Component | ||
{ | ||
/// <summary> | ||
/// The amount that an entity's DeadThreshold will be incremented by. | ||
/// </summary> | ||
[DataField] | ||
public int DeadThresholdModifier { get; private set; } = 0; | ||
} |
28 changes: 28 additions & 0 deletions
28
Content.Shared/Traits/Assorted/Components/PainToleranceComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.Traits.Assorted.Components; | ||
|
||
/// <summary> | ||
/// This is used for any trait that modifies the Melee System implementation of Stamina Contest | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class PainToleranceComponent : Component | ||
{ | ||
/// <summary> | ||
/// When true, multiplies by the inverse of the resulting Contest. | ||
/// </summary> | ||
[DataField] | ||
public bool Inverse { get; private set; } = false; | ||
|
||
/// <summary> | ||
/// Used as the RangeModifier input for a Stamina Contest. | ||
/// </summary> | ||
[DataField] | ||
public float RangeModifier { get; private set; } = 1; | ||
|
||
/// <summary> | ||
/// Used as the BypassClamp input for a Stamina Contest. | ||
/// </summary> | ||
[DataField] | ||
public bool BypassClamp { get; private set; } = false; | ||
} |
16 changes: 16 additions & 0 deletions
16
Content.Shared/Traits/Assorted/Components/StaminaCritModifierComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
63 changes: 63 additions & 0 deletions
63
Content.Shared/Traits/Assorted/Systems/TraitStatModifierSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Content.Shared.Contests; | ||
using Content.Shared.Mobs.Components; | ||
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; | ||
|
||
public sealed partial class TraitStatModifierSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly ContestsSystem _contests = default!; | ||
[Dependency] private readonly MobThresholdSystem _threshold = default!; | ||
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); | ||
} | ||
|
||
private void OnCritStartup(EntityUid uid, CritModifierComponent component, ComponentStartup args) | ||
{ | ||
if (!TryComp<MobThresholdsComponent>(uid, out var threshold)) | ||
return; | ||
|
||
var critThreshold = _threshold.GetThresholdForState(uid, Mobs.MobState.Critical, threshold); | ||
if (critThreshold != 0) | ||
_threshold.SetMobStateThreshold(uid, critThreshold + component.CritThresholdModifier, Mobs.MobState.Critical); | ||
} | ||
|
||
private void OnDeadStartup(EntityUid uid, DeadModifierComponent component, ComponentStartup args) | ||
{ | ||
if (!TryComp<MobThresholdsComponent>(uid, out var threshold)) | ||
return; | ||
|
||
var deadThreshold = _threshold.GetThresholdForState(uid, Mobs.MobState.Dead, threshold); | ||
if (deadThreshold != 0) | ||
_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); | ||
args.Damage *= component.Inverse ? 1 / modifier : modifier; | ||
} | ||
|
||
private void OnPainToleranceGetDamage(EntityUid uid, PainToleranceComponent component, ref GetMeleeDamageEvent args) | ||
{ | ||
var modifier = _contests.StaminaContest(uid, component.BypassClamp, component.RangeModifier); | ||
args.Damage *= component.Inverse ? 1 / modifier : modifier; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.