Revenant 2: Electric Boogaloo (#11510)
* revenant 2: electric boogaloo * revevent * oversights * Update RevenantSystem.Abilities.cs * names * no shoote stouhg walls
This commit is contained in:
15
Content.Shared/Revenant/Components/CorporealComponent.cs
Normal file
15
Content.Shared/Revenant/Components/CorporealComponent.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Content.Shared.Revenant.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Makes the target solid, visible, and applies a slowdown.
|
||||
/// Meant to be used in conjunction with statusEffectSystem
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public sealed class CorporealComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The debuff applied when the component is present.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float MovementSpeedDebuff = 0.66f;
|
||||
}
|
||||
200
Content.Shared/Revenant/Components/RevenantComponent.cs
Normal file
200
Content.Shared/Revenant/Components/RevenantComponent.cs
Normal file
@@ -0,0 +1,200 @@
|
||||
using System.Threading;
|
||||
using Content.Shared.Disease;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Store;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Revenant.Components;
|
||||
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class RevenantComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The total amount of Essence the revenant has. Functions
|
||||
/// as health and is regenerated.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public FixedPoint2 Essence = 75;
|
||||
|
||||
[DataField("stolenEssenceCurrencyPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<CurrencyPrototype>))]
|
||||
public string StolenEssenceCurrencyPrototype = "StolenEssence";
|
||||
|
||||
/// <summary>
|
||||
/// The entity's current max amount of essence. Can be increased
|
||||
/// through harvesting player souls.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("maxEssence")]
|
||||
public FixedPoint2 EssenceRegenCap = 75;
|
||||
|
||||
/// <summary>
|
||||
/// The coefficient of damage taken to actual health lost.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("damageToEssenceCoefficient")]
|
||||
public float DamageToEssenceCoefficient = 0.75f;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of essence passively generated per second.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("essencePerSecond")]
|
||||
public FixedPoint2 EssencePerSecond = 0.5f;
|
||||
|
||||
[ViewVariables]
|
||||
public float Accumulator = 0;
|
||||
|
||||
// Here's the gist of the harvest ability:
|
||||
// Step 1: The revenant clicks on an entity to "search" for it's soul, which creates a doafter.
|
||||
// Step 2: After the doafter is completed, the soul is "found" and can be harvested.
|
||||
// Step 3: Clicking the entity again begins to harvest the soul, which causes the revenant to become vulnerable
|
||||
// Step 4: The second doafter for the harvest completes, killing the target and granting the revenant essence.
|
||||
#region Harvest Ability
|
||||
/// <summary>
|
||||
/// The duration of the soul search
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("soulSearchDuration")]
|
||||
public float SoulSearchDuration = 2.5f;
|
||||
|
||||
/// <summary>
|
||||
/// The status effects applied after the ability
|
||||
/// the first float corresponds to amount of time the entity is stunned.
|
||||
/// the second corresponds to the amount of time the entity is made solid.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("harvestDebuffs")]
|
||||
public Vector2 HarvestDebuffs = (5, 5);
|
||||
|
||||
/// <summary>
|
||||
/// The amount that is given to the revenant each time it's max essence is upgraded.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("maxEssenceUpgradeAmount")]
|
||||
public float MaxEssenceUpgradeAmount = 10;
|
||||
|
||||
public CancellationTokenSource? SoulSearchCancelToken;
|
||||
public CancellationTokenSource? HarvestCancelToken;
|
||||
#endregion
|
||||
|
||||
//In the nearby radius, causes various objects to be thrown, messed with, and containers opened
|
||||
//Generally just causes a mess
|
||||
#region Defile Ability
|
||||
/// <summary>
|
||||
/// The amount of essence that is needed to use the ability.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("defileCost")]
|
||||
public FixedPoint2 DefileCost = -30;
|
||||
|
||||
/// <summary>
|
||||
/// The status effects applied after the ability
|
||||
/// the first float corresponds to amount of time the entity is stunned.
|
||||
/// the second corresponds to the amount of time the entity is made solid.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("defileDebuffs")]
|
||||
public Vector2 DefileDebuffs = (1, 4);
|
||||
|
||||
/// <summary>
|
||||
/// The radius around the user that this ability affects
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("defileRadius")]
|
||||
public float DefileRadius = 3.5f;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of tiles that are uprooted by the ability
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("defileTilePryAmount")]
|
||||
public int DefileTilePryAmount = 15;
|
||||
|
||||
/// <summary>
|
||||
/// The chance that an individual entity will have any of the effects
|
||||
/// happen to it.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("defileEffectChance")]
|
||||
public float DefileEffectChance = 0.5f;
|
||||
#endregion
|
||||
|
||||
#region Overload Lights Ability
|
||||
/// <summary>
|
||||
/// The amount of essence that is needed to use the ability.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("overloadCost")]
|
||||
public FixedPoint2 OverloadCost = -40;
|
||||
|
||||
/// <summary>
|
||||
/// The status effects applied after the ability
|
||||
/// the first float corresponds to amount of time the entity is stunned.
|
||||
/// the second corresponds to the amount of time the entity is made solid.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("overloadDebuffs")]
|
||||
public Vector2 OverloadDebuffs = (3, 8);
|
||||
|
||||
/// <summary>
|
||||
/// The radius around the user that this ability affects
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("overloadRadius")]
|
||||
public float OverloadRadius = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// How close to the light the entity has to be in order to be zapped.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("overloadZapRadius")]
|
||||
public float OverloadZapRadius = 2f;
|
||||
#endregion
|
||||
|
||||
#region Blight Ability
|
||||
/// <summary>
|
||||
/// The amount of essence that is needed to use the ability.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("blightCost")]
|
||||
public float BlightCost = -50;
|
||||
|
||||
/// <summary>
|
||||
/// The status effects applied after the ability
|
||||
/// the first float corresponds to amount of time the entity is stunned.
|
||||
/// the second corresponds to the amount of time the entity is made solid.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("blightDebuffs")]
|
||||
public Vector2 BlightDebuffs = (2, 5);
|
||||
|
||||
/// <summary>
|
||||
/// The radius around the user that this ability affects
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("blightRadius")]
|
||||
public float BlightRadius = 3.5f;
|
||||
|
||||
/// <summary>
|
||||
/// The disease that is given to the victims of the ability.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("blightDiseasePrototypeId", customTypeSerializer: typeof(PrototypeIdSerializer<DiseasePrototype>))]
|
||||
public string BlightDiseasePrototypeId = "SpectralTiredness";
|
||||
#endregion
|
||||
|
||||
#region Malfunction Ability
|
||||
/// <summary>
|
||||
/// The amount of essence that is needed to use the ability.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("malfunctionCost")]
|
||||
public FixedPoint2 MalfunctionCost = -60;
|
||||
|
||||
/// <summary>
|
||||
/// The status effects applied after the ability
|
||||
/// the first float corresponds to amount of time the entity is stunned.
|
||||
/// the second corresponds to the amount of time the entity is made solid.
|
||||
/// </summary>
|
||||
[ViewVariables, DataField("malfunctionDebuffs")]
|
||||
public Vector2 MalfunctionDebuffs = (2, 8);
|
||||
|
||||
/// <summary>
|
||||
/// The radius around the user that this ability affects
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("malfunctionRadius")]
|
||||
public float MalfunctionRadius = 3.5f;
|
||||
#endregion
|
||||
|
||||
#region Visualizer
|
||||
[DataField("state")]
|
||||
public string State = "idle";
|
||||
[DataField("corporealState")]
|
||||
public string CorporealState = "active";
|
||||
[DataField("stunnedState")]
|
||||
public string StunnedState = "stunned";
|
||||
[DataField("harvestingState")]
|
||||
public string HarvestingState = "harvesting";
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
|
||||
namespace Content.Shared.Revenant.Components;
|
||||
|
||||
/// <summary>
|
||||
/// This is used for tracking lights that are overloaded
|
||||
/// and are about to zap a player.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
public sealed class RevenantOverloadedLightsComponent : Component
|
||||
{
|
||||
[ViewVariables]
|
||||
public EntityUid? Target;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float Accumulator = 0;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float ZapDelay = 3f;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float ZapRange = 4f;
|
||||
|
||||
[DataField("zapBeamEntityId",customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string ZapBeamEntityId = "LightningRevenant";
|
||||
|
||||
public float? OriginalEnergy;
|
||||
public bool OriginalEnabled = false;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using Content.Shared.Physics;
|
||||
using Robust.Shared.Physics;
|
||||
using System.Linq;
|
||||
using Content.Shared.Movement.Systems;
|
||||
using Content.Shared.Revenant.Components;
|
||||
|
||||
namespace Content.Shared.Revenant.EntitySystems;
|
||||
|
||||
/// <summary>
|
||||
/// Makes the revenant solid when the component is applied.
|
||||
/// Additionally applies a few visual effects.
|
||||
/// Used for status effect.
|
||||
/// </summary>
|
||||
public abstract class SharedCorporealSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly MovementSpeedModifierSystem _movement = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<CorporealComponent, ComponentStartup>(OnStartup);
|
||||
SubscribeLocalEvent<CorporealComponent, ComponentShutdown>(OnShutdown);
|
||||
SubscribeLocalEvent<CorporealComponent, RefreshMovementSpeedModifiersEvent>(OnRefresh);
|
||||
}
|
||||
|
||||
private void OnRefresh(EntityUid uid, CorporealComponent component, RefreshMovementSpeedModifiersEvent args)
|
||||
{
|
||||
args.ModifySpeed(component.MovementSpeedDebuff, component.MovementSpeedDebuff);
|
||||
}
|
||||
|
||||
public virtual void OnStartup(EntityUid uid, CorporealComponent component, ComponentStartup args)
|
||||
{
|
||||
_appearance.SetData(uid, RevenantVisuals.Corporeal, true);
|
||||
|
||||
if (TryComp<FixturesComponent>(uid, out var fixtures) && fixtures.FixtureCount >= 1)
|
||||
{
|
||||
var fixture = fixtures.Fixtures.Values.First();
|
||||
|
||||
fixture.CollisionMask = (int) (CollisionGroup.SmallMobMask | CollisionGroup.GhostImpassable);
|
||||
fixture.CollisionLayer = (int) CollisionGroup.SmallMobLayer;
|
||||
}
|
||||
_movement.RefreshMovementSpeedModifiers(uid);
|
||||
}
|
||||
|
||||
public virtual void OnShutdown(EntityUid uid, CorporealComponent component, ComponentShutdown args)
|
||||
{
|
||||
_appearance.SetData(uid, RevenantVisuals.Corporeal, false);
|
||||
|
||||
if (TryComp<FixturesComponent>(uid, out var fixtures) && fixtures.FixtureCount >= 1)
|
||||
{
|
||||
var fixture = fixtures.Fixtures.Values.First();
|
||||
|
||||
fixture.CollisionMask = (int) CollisionGroup.GhostImpassable;
|
||||
fixture.CollisionLayer = 0;
|
||||
}
|
||||
component.MovementSpeedDebuff = 1; //just so we can avoid annoying code elsewhere
|
||||
_movement.RefreshMovementSpeedModifiers(uid);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Content.Shared.Revenant.Components;
|
||||
|
||||
namespace Content.Shared.Revenant.EntitySystems;
|
||||
|
||||
/// <summary>
|
||||
/// This handles...
|
||||
/// </summary>
|
||||
public abstract class SharedRevenantOverloadedLightsSystem : EntitySystem
|
||||
{
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
|
||||
foreach (var comp in EntityQuery<RevenantOverloadedLightsComponent>())
|
||||
{
|
||||
comp.Accumulator += frameTime;
|
||||
|
||||
|
||||
if (comp.Accumulator < comp.ZapDelay)
|
||||
continue;
|
||||
|
||||
OnZap(comp);
|
||||
RemComp(comp.Owner, comp);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void OnZap(RevenantOverloadedLightsComponent component);
|
||||
}
|
||||
@@ -3,6 +3,29 @@ using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Revenant;
|
||||
|
||||
public sealed class SoulSearchDoAfterComplete : EntityEventArgs
|
||||
{
|
||||
public readonly EntityUid Target;
|
||||
|
||||
public SoulSearchDoAfterComplete(EntityUid target)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SoulSearchDoAfterCancelled : EntityEventArgs { }
|
||||
|
||||
public sealed class HarvestDoAfterComplete : EntityEventArgs
|
||||
{
|
||||
public readonly EntityUid Target;
|
||||
|
||||
public HarvestDoAfterComplete(EntityUid target)
|
||||
{
|
||||
Target = target;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class HarvestDoAfterCancelled : EntityEventArgs { }
|
||||
public sealed class RevenantShopActionEvent : InstantActionEvent { }
|
||||
public sealed class RevenantDefileActionEvent : InstantActionEvent { }
|
||||
public sealed class RevenantOverloadLightsActionEvent : InstantActionEvent { }
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
namespace Content.Shared.Revenant;
|
||||
|
||||
[NetworkedComponent]
|
||||
public abstract class SharedRevenantComponent : Component
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user