Новая способность вампира - Кровяная чешуя. (#1660)
This commit is contained in:
parent
c29c2d0d5c
commit
2226c557f7
8 changed files with 114 additions and 15 deletions
|
|
@ -56,6 +56,7 @@ public sealed partial class VampireSystem
|
|||
SubscribeLocalEvent<VampireComponent, VampireUnholyStrengthEvent>(OnVampireUnholyStrength);
|
||||
SubscribeLocalEvent<VampireComponent, VampireSupernaturalStrengthEvent>(OnVampireSupernaturalStrength);
|
||||
SubscribeLocalEvent<VampireComponent, VampireCloakOfDarknessEvent>(OnVampireCloakOfDarkness);
|
||||
SubscribeLocalEvent<VampireComponent, VampireBloodScaleEvent>(OnVampireBloodScale);
|
||||
SubscribeLocalEvent<VampireComponent, VampireThermalVisionEvent>(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<VampireComponent>(entity, component);
|
||||
|
||||
if (!IsAbilityUsable(vampire, def))
|
||||
return;
|
||||
|
||||
ToggleBloodScale(entity, vampire);
|
||||
var scale = EnsureComp<VampireBloodScaleComponent>(vampire);
|
||||
scale.Upkeep = 4f;
|
||||
|
||||
ev.Handled = true;
|
||||
}
|
||||
|
||||
private void ToggleBloodScale(EntityUid uid, VampireComponent comp)
|
||||
{
|
||||
var scale = EnsureComp<VampireBloodScaleComponent>(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;
|
||||
|
|
|
|||
|
|
@ -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<VampireComponent, VampireBloodScaleComponent>();
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -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<ProtoId<EntityPrototype>> BaseVampireActions = new()
|
||||
{
|
||||
"ActionVampireToggleFangs",
|
||||
"ActionVampireHypnotise"
|
||||
"ActionVampireHypnotise",
|
||||
"ActionVampireBloodScale"
|
||||
};
|
||||
|
||||
[ValidatePrototypeId<VampirePowerProtype>]
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 { }
|
||||
|
|
|
|||
|
|
@ -230,4 +230,21 @@
|
|||
event:
|
||||
!type:VampireThermalVisionEvent
|
||||
definitionName: ThermalVision
|
||||
useDelay: 5
|
||||
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
|
||||
|
|
@ -92,4 +92,10 @@
|
|||
usableWhileStunned: true
|
||||
usableWhileCuffed: true
|
||||
usableWhileMuffled: true
|
||||
activationCost: 0
|
||||
activationCost: 0
|
||||
|
||||
- type: vampirePower
|
||||
id: BloodScale
|
||||
usableWhileStunned: false
|
||||
usableWhileCuffed: false
|
||||
activationCost: 10
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
|
|
@ -63,6 +63,9 @@
|
|||
},
|
||||
{
|
||||
"name": "thermalvision"
|
||||
},
|
||||
{
|
||||
"name": "bloodscale"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue