diff --git a/Content.Server/Vampire/VampireSystem.Abilities.cs b/Content.Server/Vampire/VampireSystem.Abilities.cs index 564ac06acf..3ad627747d 100644 --- a/Content.Server/Vampire/VampireSystem.Abilities.cs +++ b/Content.Server/Vampire/VampireSystem.Abilities.cs @@ -56,6 +56,7 @@ public sealed partial class VampireSystem SubscribeLocalEvent(OnVampireUnholyStrength); SubscribeLocalEvent(OnVampireSupernaturalStrength); SubscribeLocalEvent(OnVampireCloakOfDarkness); + SubscribeLocalEvent(OnVampireBloodScale); SubscribeLocalEvent(OnVampireThermalVision); //Hypnotise @@ -214,7 +215,43 @@ public sealed partial class VampireSystem ev.Handled = true; } - private void OnVampireThermalVision(EntityUid entity, VampireComponent component, VampireThermalVisionEvent ev) + private void OnVampireBloodScale(EntityUid entity, VampireComponent component, VampireBloodScaleEvent ev) + { + if (!TryGetPowerDefinition(ev.DefinitionName, out var def)) + return; + + var vampire = new Entity(entity, component); + + if (!IsAbilityUsable(vampire, def)) + return; + + ToggleBloodScale(entity, vampire); + var scale = EnsureComp(vampire); + scale.Upkeep = 4f; + + ev.Handled = true; + } + + private void ToggleBloodScale(EntityUid uid, VampireComponent comp) + { + var scale = EnsureComp(uid); + if (!comp.BloodScaleActive) + { + _speed.ChangeBaseSpeed(uid, 4.5f, 6f, 20f); + _popup.PopupEntity(Loc.GetString("blood-scale-start"), uid, uid); + comp.BloodScaleActive = true; + scale.IsActive = true; + } + else + { + _speed.ChangeBaseSpeed(uid, 2.5f, 4.5f, 20f); + _popup.PopupEntity(Loc.GetString("blood-scale-end"), uid, uid); + comp.BloodScaleActive = false; + scale.IsActive = false; + } + } + + private void OnVampireThermalVision(EntityUid entity, VampireComponent component, VampireThermalVisionEvent ev) { if (!TryGetPowerDefinition(ev.DefinitionName, out var def)) return; diff --git a/Content.Server/Vampire/VampireSystem.cs b/Content.Server/Vampire/VampireSystem.cs index 39b7e2945b..ec2b1069ec 100644 --- a/Content.Server/Vampire/VampireSystem.cs +++ b/Content.Server/Vampire/VampireSystem.cs @@ -3,28 +3,20 @@ using Content.Server.Atmos.Rotting; using Content.Server.Beam; using Content.Server.Body.Systems; using Content.Server.Chat.Systems; -using Content.Server.Interaction; using Content.Server.Nutrition.EntitySystems; using Content.Server.Polymorph.Systems; using Content.Server.Storage.EntitySystems; using Content.Server.Mind; using Content.Shared.Actions; using Content.Shared.Body.Systems; -using Content.Shared.Buckle; -using Content.Shared.Bed.Sleep; using Content.Shared.Chemistry.EntitySystems; -using Content.Shared.Construction.Components; using Content.Shared.Damage; using Content.Shared.Damage.Prototypes; using Content.Shared.DoAfter; using Content.Shared.Examine; using Content.Shared.FixedPoint; -using Content.Shared.Hands.EntitySystems; -using Content.Shared.Humanoid; using Content.Shared.Interaction; -using Content.Shared.Interaction.Events; using Content.Shared.Maps; -using Content.Shared.Mobs; using Content.Shared.Mobs.Systems; using Content.Shared.Popups; using Content.Shared.Prayer; @@ -32,14 +24,14 @@ using Content.Shared.StatusEffect; using Content.Shared.Stunnable; using Content.Shared.Vampire; using Content.Shared.Vampire.Components; +using Content.Shared.Movement.Components; using Robust.Server.GameObjects; -using Robust.Shared.Player; -using Robust.Shared.GameStates; using Robust.Shared.Audio.Systems; using Robust.Shared.Containers; using Robust.Shared.Map; +using Robust.Shared.Player; using Robust.Shared.Prototypes; -using System.Linq; +using Content.Shared.Movement.Systems; namespace Content.Server.Vampire; @@ -77,6 +69,7 @@ public sealed partial class VampireSystem : EntitySystem [Dependency] private readonly MetabolizerSystem _metabolism = default!; [Dependency] private readonly UserInterfaceSystem _uiSystem = default!; [Dependency] private readonly SharedVampireSystem _vampire = default!; + [Dependency] private readonly MovementSpeedModifierSystem _speed = default!; public override void Initialize() { @@ -166,6 +159,29 @@ public sealed partial class VampireSystem : EntitySystem } strength.NextTick -= frameTime; } + + var scaleQuery = EntityQueryEnumerator(); + while (scaleQuery.MoveNext(out var uid, out var vampire, out var scale)) + { + if (vampire == null || scale == null) + continue; + if (scale.IsActive) + { + if (scale.NextTick <= 0) + { + scale.NextTick = 1; + if (!SubtractBloodEssence((uid, vampire), scale.Upkeep)) + { + ToggleBloodScale(uid, vampire); + scale.IsActive = false; + } + } + else + { + scale.NextTick -= frameTime; + } + } + } } private void OnComponentStartup(EntityUid uid, VampireComponent component, ComponentStartup args) diff --git a/Content.Shared/Vampire/VampireComponent.cs b/Content.Shared/Vampire/VampireComponent.cs index 6328d83f2e..95ac9cce5f 100644 --- a/Content.Shared/Vampire/VampireComponent.cs +++ b/Content.Shared/Vampire/VampireComponent.cs @@ -67,11 +67,15 @@ public sealed partial class VampireComponent : Component [ViewVariables(VVAccess.ReadWrite)] public EntityUid? MutationsAction; + + [ViewVariables(VVAccess.ReadWrite)] + public bool BloodScaleActive { get; set; } public readonly List> BaseVampireActions = new() { "ActionVampireToggleFangs", - "ActionVampireHypnotise" + "ActionVampireHypnotise", + "ActionVampireBloodScale" }; [ValidatePrototypeId] @@ -247,6 +251,21 @@ public sealed partial class VampireStrengthComponent : Component [ViewVariables(VVAccess.ReadWrite)] public float Upkeep = 0; } +[RegisterComponent] +public sealed partial class VampireBloodScaleComponent : Component +{ + [ViewVariables(VVAccess.ReadWrite)] + public float NextTick = 0; + + [ViewVariables(VVAccess.ReadWrite)] + public bool BloodScaleActive { get; set; } + + [ViewVariables(VVAccess.ReadWrite)] + public float Upkeep = 0; + + [ViewVariables(VVAccess.ReadWrite)] + public bool IsActive { get; set; } +} [Serializable, NetSerializable] public enum VampireMutationsType : byte diff --git a/Content.Shared/Vampire/VampireEvents.cs b/Content.Shared/Vampire/VampireEvents.cs index c36c1d5012..427135f174 100644 --- a/Content.Shared/Vampire/VampireEvents.cs +++ b/Content.Shared/Vampire/VampireEvents.cs @@ -15,6 +15,7 @@ public sealed partial class VampireBloodStealEvent : VampireSelfPowerEvent { } public sealed partial class VampireUnholyStrengthEvent : VampireSelfPowerEvent { } public sealed partial class VampireSupernaturalStrengthEvent : VampireSelfPowerEvent { } public sealed partial class VampireCloakOfDarknessEvent : VampireSelfPowerEvent { } +public sealed partial class VampireBloodScaleEvent : VampireSelfPowerEvent { } public sealed partial class VampireThermalVisionEvent : VampireSelfPowerEvent { } public sealed partial class VampireGlareEvent : VampireTargetedPowerEvent { } diff --git a/Resources/Prototypes/Actions/vampire.yml b/Resources/Prototypes/Actions/vampire.yml index 8dc47c43ee..ab6f722e0b 100644 --- a/Resources/Prototypes/Actions/vampire.yml +++ b/Resources/Prototypes/Actions/vampire.yml @@ -230,4 +230,21 @@ event: !type:VampireThermalVisionEvent definitionName: ThermalVision - useDelay: 5 \ No newline at end of file + useDelay: 5 + +- type: entity + id: ActionVampireBloodScale + name: blood scale + description: "Strengthen your muscles by compressing blood in order to develop maximum speed. Activation Cost: 10 Essence. Upkeep: 4 Essence/Second Cooldown: 5 Seconds" + categories: [ HideSpawnMenu ] + components: + - type: InstantAction + checkCanInteract: false + priority: 2 + itemIconStyle: NoItem + icon: + sprite: Interface/Actions/actions_vampire.rsi + state: bloodscale + event: + !type:VampireBloodScaleEvent + definitionName: BloodScale \ No newline at end of file diff --git a/Resources/Prototypes/Vampire/vampire-powers.yml b/Resources/Prototypes/Vampire/vampire-powers.yml index 89bc95dcd3..5b14830b2d 100644 --- a/Resources/Prototypes/Vampire/vampire-powers.yml +++ b/Resources/Prototypes/Vampire/vampire-powers.yml @@ -92,4 +92,10 @@ usableWhileStunned: true usableWhileCuffed: true usableWhileMuffled: true - activationCost: 0 \ No newline at end of file + activationCost: 0 + +- type: vampirePower + id: BloodScale + usableWhileStunned: false + usableWhileCuffed: false + activationCost: 10 \ No newline at end of file diff --git a/Resources/Textures/Interface/Actions/actions_vampire.rsi/bloodscale.png b/Resources/Textures/Interface/Actions/actions_vampire.rsi/bloodscale.png new file mode 100644 index 0000000000..6301df5e48 Binary files /dev/null and b/Resources/Textures/Interface/Actions/actions_vampire.rsi/bloodscale.png differ diff --git a/Resources/Textures/Interface/Actions/actions_vampire.rsi/meta.json b/Resources/Textures/Interface/Actions/actions_vampire.rsi/meta.json index a9a4bb6bc3..bd23148a14 100644 --- a/Resources/Textures/Interface/Actions/actions_vampire.rsi/meta.json +++ b/Resources/Textures/Interface/Actions/actions_vampire.rsi/meta.json @@ -63,6 +63,9 @@ }, { "name": "thermalvision" + }, + { + "name": "bloodscale" } ] } \ No newline at end of file