Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Species] Invert Poison Damage for SlimePeople #36

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Content.Server/Chemistry/ReagentEffects/HealthChange.cs
DEATHB4DEFEAT marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
using Content.Shared.Localizations;
using Content.Shared.SimpleStation14.Damage.Events;
using Content.Shared.SimpleStation14.Damage.Systems;
using JetBrains.Annotations;
using Robust.Shared.Prototypes;

Expand Down Expand Up @@ -112,10 +114,17 @@ protected override string ReagentEffectGuidebookText(IPrototypeManager prototype

public override void Effect(ReagentEffectArgs args)
{
// Parkstation-ReagentDamageModifiers Start
var damage = Damage;

damage = args.EntityManager.System<ReagentDamageModifierSystem>().ModifyDamage(args.SolutionEntity, damage);

var scale = ScaleByQuantity ? args.Quantity * 2 : FixedPoint2.New(1); // Parkstation-fixReagentSuperPotency
scale *= args.Scale;
damage *= scale;

args.EntityManager.System<DamageableSystem>().TryChangeDamage(args.SolutionEntity, Damage * scale, IgnoreResistances);
args.EntityManager.System<DamageableSystem>().TryChangeDamage(args.SolutionEntity, damage, IgnoreResistances);
// Parkstation-ReagentDamageModifiers End
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Content.Shared.Damage.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Shared.SimpleStation14.Damage.Components;

[RegisterComponent]
public sealed class ReagentDamageModifierComponent : Component
{
/// <summary>
/// Modifier set prototype to use for reagent damages
/// </summary>
[DataField("modifierSet", customTypeSerializer: typeof(PrototypeIdSerializer<DamageModifierSetPrototype>), required: true)]
public string ModifierSet = "";
}
16 changes: 16 additions & 0 deletions Content.Shared/SimpleStation14/Damage/Events/DamageEvents.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Content.Shared.Damage;

namespace Content.Shared.SimpleStation14.Damage.Events;

[ByRefEvent]
public sealed class ReagentDamageModifyEvent : EntityEventArgs
{
public readonly DamageSpecifier OriginalDamage;
public DamageSpecifier Damage;

public ReagentDamageModifyEvent(DamageSpecifier damage)
{
OriginalDamage = damage;
Damage = damage;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.FixedPoint;
using Content.Shared.SimpleStation14.Damage.Events;
using Content.Shared.SimpleStation14.Damage.Components;
using Robust.Shared.Prototypes;

namespace Content.Shared.SimpleStation14.Damage.Systems;

public sealed class ReagentDamageModifierSystem : EntitySystem
{
[Dependency] private readonly IPrototypeManager _prototype = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ReagentDamageModifierComponent, ReagentDamageModifyEvent>(OnReagentDamage);
}


/// <summary>
/// Applies a modifier set from the component to the reagent damage
/// </summary>
private void OnReagentDamage(EntityUid uid, ReagentDamageModifierComponent component, ref ReagentDamageModifyEvent args)
{
if (_prototype.TryIndex<DamageModifierSetPrototype>(component.ModifierSet, out var modifier))
{
args.Damage = DamageSpecifier.ApplyModifierSet(args.Damage, modifier);
}
}


/// <summary>
/// Sends an event requesting reagent damage modifications since the HealthChange reagent effect can't send events
/// </summary>
/// <param name="uid">Entity to raise the event on</param>
/// <param name="originalDamage">Damage to be taken for modification</param>
/// <returns>Modified damage set</returns>
public DamageSpecifier ModifyDamage(EntityUid uid, DamageSpecifier originalDamage)
{
var ev = new ReagentDamageModifyEvent(originalDamage);
RaiseLocalEvent(uid, ref ev);
return ev.Damage;
}
}
17 changes: 12 additions & 5 deletions Resources/Prototypes/Damage/modifier_sets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,19 @@
- type: damageModifierSet
id: Slime
coefficients:
Blunt: 0.6
Slash: 1.2
Piercing: 1.2
Cold: 1.5
Poison: 0.8
Blunt: 2 # Lots of blunt, if they do more than 5 damage
Slash: 1.5
Piercing: 0.5
Cold: 1.6
Heat: 0.4
Poison: -1
Cellular: 0.2
Asphyxiation: 0.9
Bloodloss: 1.1
Shock: 0.4
Radiation: 0.5
flatReductions:
Blunt: 5
DEATHB4DEFEAT marked this conversation as resolved.
Show resolved Hide resolved

- type: damageModifierSet
id: Infernal
Expand Down
2 changes: 2 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Species/slime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
naturalImmunities:
- Ultragigacancer
- BleedersBite
- type: ReagentDamageModifier
modifierSet: SlimeReagents

- type: entity
save: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@
Shock: 1.25
Radiation: 1.3

- type: damageModifierSet
id: SlimeReagents
coefficients:
Poison: -1
minimumDamageToDamage: -999
Comment on lines +34 to +38
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a negative flat reduction. The effects of this would be to increase healing before reversing it, making it more deadly, and to lower damage before reversing it, making it less healing. I think this is good for balance.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, you're right, but also it seems to be your problem now :P

Either way, I actually meant a standard flat reduction- but it should also increase the power of healing.

Loading