Spellblade update (#346)
* - tweak: Don't close eui too quickly. * - add: Spellblade update. * - fix: Cult teleport spell.
This commit is contained in:
@@ -105,7 +105,7 @@ public sealed class WizardSpellsSystem : EntitySystem
|
||||
if (!TryComp(msg.Performer, out ActorComponent? actor))
|
||||
return;
|
||||
|
||||
var eui = new TeleportSpellEui(msg.Performer);
|
||||
var eui = new WizardTeleportSpellEui(msg.Performer);
|
||||
_euiManager.OpenEui(eui, actor.PlayerSession);
|
||||
eui.StateDirty();
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Content.Server._White.Wizard.SpellBlade;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class FireAspectComponent : Component
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Content.Shared.Atmos;
|
||||
|
||||
namespace Content.Server._White.Wizard.SpellBlade;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class FrostAspectComponent : Component
|
||||
{
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public float TemperatureOnHit = 100;
|
||||
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public float MinTemperature = Atmospherics.TCMB;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
namespace Content.Server._White.Wizard.SpellBlade;
|
||||
|
||||
[RegisterComponent]
|
||||
public sealed partial class LightningAspectComponent : Component
|
||||
{
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public float Range = 2f;
|
||||
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public int BoltCount = 3;
|
||||
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public string LightningPrototype = "WeakWizardLightning";
|
||||
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public int ArcDepth = 2;
|
||||
|
||||
[DataField, ViewVariables(VVAccess.ReadWrite)]
|
||||
public TimeSpan ShockRate = TimeSpan.FromSeconds(10);
|
||||
|
||||
public TimeSpan NextShock;
|
||||
}
|
||||
79
Content.Server/_White/Wizard/SpellBlade/SpellBladeSystem.cs
Normal file
79
Content.Server/_White/Wizard/SpellBlade/SpellBladeSystem.cs
Normal file
@@ -0,0 +1,79 @@
|
||||
using Content.Server.Atmos.Components;
|
||||
using Content.Server.Lightning;
|
||||
using Content.Server.Temperature.Components;
|
||||
using Content.Server.Temperature.Systems;
|
||||
using Content.Shared._White.Wizard.SpellBlade;
|
||||
using Content.Shared.Weapons.Melee.Events;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Server._White.Wizard.SpellBlade;
|
||||
|
||||
public sealed class SpellBladeSystem : SharedSpellBladeSystem
|
||||
{
|
||||
[Dependency] private readonly TemperatureSystem _temperature = default!;
|
||||
[Dependency] private readonly LightningSystem _lightning = default!;
|
||||
[Dependency] private readonly IGameTiming _timing = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<FrostAspectComponent, MeleeHitEvent>(OnFrostMeleeHit);
|
||||
SubscribeLocalEvent<LightningAspectComponent, MeleeHitEvent>(OnLightningMeleeHit);
|
||||
}
|
||||
|
||||
private void OnLightningMeleeHit(Entity<LightningAspectComponent> ent, ref MeleeHitEvent args)
|
||||
{
|
||||
if (args.Direction != null || args.HitEntities.Count != 1)
|
||||
return;
|
||||
|
||||
if (ent.Comp.NextShock > _timing.CurTime)
|
||||
return;
|
||||
|
||||
ent.Comp.NextShock = _timing.CurTime + ent.Comp.ShockRate;
|
||||
|
||||
_lightning.ShootRandomLightnings(args.HitEntities[0], ent.Comp.Range, ent.Comp.BoltCount,
|
||||
ent.Comp.LightningPrototype, ent.Comp.ArcDepth, false, args.User);
|
||||
}
|
||||
|
||||
private void OnFrostMeleeHit(Entity<FrostAspectComponent> ent, ref MeleeHitEvent args)
|
||||
{
|
||||
var temp = ent.Comp.TemperatureOnHit;
|
||||
if (args.Direction != null) // Heavy attack
|
||||
temp *= 0.5f;
|
||||
|
||||
foreach (var entity in args.HitEntities)
|
||||
{
|
||||
if (!TryComp<TemperatureComponent>(entity, out var temperature))
|
||||
continue;
|
||||
|
||||
var curTemp = temperature.CurrentTemperature;
|
||||
var newTemp = curTemp - temp;
|
||||
|
||||
newTemp = curTemp < ent.Comp.MinTemperature
|
||||
? MathF.Min(curTemp, newTemp)
|
||||
: Math.Max(newTemp, ent.Comp.MinTemperature);
|
||||
|
||||
_temperature.ForceChangeTemperature(entity, newTemp, temperature);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void ApplyFireAspect(EntityUid uid)
|
||||
{
|
||||
var ignite = EnsureComp<IgniteOnMeleeHitComponent>(uid);
|
||||
ignite.FireStacks = 2f;
|
||||
EnsureComp<FireAspectComponent>(uid);
|
||||
}
|
||||
|
||||
protected override void ApplyFrostAspect(EntityUid uid)
|
||||
{
|
||||
var ignite = EnsureComp<IgniteOnMeleeHitComponent>(uid);
|
||||
ignite.FireStacks = -5f;
|
||||
EnsureComp<FrostAspectComponent>(uid);
|
||||
}
|
||||
|
||||
protected override void ApplyLightningAspect(EntityUid uid)
|
||||
{
|
||||
EnsureComp<LightningAspectComponent>(uid);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
using System.Linq;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared._White.Wizard.Teleport;
|
||||
using Content.Shared.Eui;
|
||||
using Robust.Shared.Timing;
|
||||
using TeleportSpellEuiState = Content.Shared._White.Wizard.Teleport.TeleportSpellEuiState;
|
||||
|
||||
namespace Content.Server._White.Wizard.Teleport;
|
||||
|
||||
public sealed class TeleportSpellEui : BaseEui
|
||||
public sealed class WizardTeleportSpellEui : BaseEui
|
||||
{
|
||||
[Dependency] private readonly EntityManager _entityManager = default!;
|
||||
private readonly SharedTransformSystem _transformSystem;
|
||||
@@ -19,7 +17,7 @@ public sealed class TeleportSpellEui : BaseEui
|
||||
|
||||
private bool _used;
|
||||
|
||||
public TeleportSpellEui(EntityUid performer)
|
||||
public WizardTeleportSpellEui(EntityUid performer)
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
@@ -29,13 +27,13 @@ public sealed class TeleportSpellEui : BaseEui
|
||||
|
||||
_performer = performer;
|
||||
|
||||
Timer.Spawn(TimeSpan.FromSeconds(10), Close);
|
||||
Timer.Spawn(TimeSpan.FromSeconds(60), Close);
|
||||
}
|
||||
|
||||
public override EuiStateBase GetNewState()
|
||||
{
|
||||
var locationQuery = _entityManager.EntityQueryEnumerator<TeleportLocationComponent, TransformComponent>();
|
||||
var state = new TeleportSpellEuiState();
|
||||
var state = new WizardTeleportSpellEuiState();
|
||||
|
||||
while (locationQuery.MoveNext(out var locationUid, out var locationComponent, out var transformComponent))
|
||||
{
|
||||
Reference in New Issue
Block a user