Skip to content

Commit

Permalink
feat: summoning spells
Browse files Browse the repository at this point in the history
Signed-off-by: Remuchi <[email protected]>
  • Loading branch information
Remuchi committed Nov 13, 2024
1 parent 9044f00 commit 0f9c91d
Show file tree
Hide file tree
Showing 33 changed files with 353 additions and 149 deletions.
7 changes: 5 additions & 2 deletions Content.Server/Ensnaring/EnsnareableSystem.Ensnaring.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Content.Shared.IdentityManagement;
using Content.Shared.StepTrigger.Systems;
using Content.Shared.Throwing;
using Content.Shared.Whitelist;

namespace Content.Server.Ensnaring;

Expand All @@ -20,6 +21,7 @@ public sealed partial class EnsnareableSystem
[Dependency] private readonly AlertsSystem _alerts = default!;
[Dependency] private readonly BodySystem _body = default!;
[Dependency] private readonly StaminaSystem _stamina = default!;
[Dependency] private readonly EntityWhitelistSystem _entityWhitelist = default!;

public void InitializeEnsnaring()
{
Expand Down Expand Up @@ -70,8 +72,9 @@ private void OnThrowHit(EntityUid uid, EnsnaringComponent component, ThrowDoHitE
/// <param name="component">The ensnaring component</param>
public void TryEnsnare(EntityUid target, EntityUid ensnare, EnsnaringComponent component)
{
//Don't do anything if they don't have the ensnareable component.
if (!TryComp<EnsnareableComponent>(target, out var ensnareable))
//Don't do anything if they don't have the ensnareable component or should be ignored.
if (!TryComp<EnsnareableComponent>(target, out var ensnareable) ||
component.IgnoredTargets is not null && _entityWhitelist.IsValid(component.IgnoredTargets, target))
return;

var legs = _body.GetBodyChildrenOfType(target, BodyPartType.Leg).Count();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ public override void Initialize()
private void CheckCollision(Entity<BloodBoilProjectileComponent> ent, ref PreventCollideEvent args)
{
if (args.OtherEntity != ent.Comp.Target)
{
args.Cancelled = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Content.Server.WhiteDream.BloodCult.BloodRites;

[RegisterComponent]
public sealed partial class BloodRitesAuraComponent : Component
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Content.Server.WhiteDream.BloodCult.BloodRites;

public sealed class BloodRitesSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.RadialSelector;

namespace Content.Server.WhiteDream.BloodCult.Constructs.Shell;

Expand All @@ -9,4 +10,39 @@ public sealed partial class ConstructShellComponent : Component
public ItemSlot ShardSlot = new();

public readonly string ShardSlotId = "Shard";


[DataField]
public List<RadialSelectorEntry> Constructs = new()
{
new RadialSelectorEntry
{
Prototype = "ConstructJuggernaut"
},
new RadialSelectorEntry
{
Prototype = "ConstructArtificer"
},
new RadialSelectorEntry
{
Prototype = "ConstructWraith"
}
};

[DataField]
public List<RadialSelectorEntry> PurifiedConstructs = new()
{
new RadialSelectorEntry
{
Prototype = "ConstructJuggernautHoly"
},
new RadialSelectorEntry
{
Prototype = "ConstructArtificerHoly"
},
new RadialSelectorEntry
{
Prototype = "ConstructWraithHoly"
}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,41 @@ public override void Initialize()
private void OnGetVerbs(Entity<ConstructShellComponent> shell, ref GetVerbsEvent<ExamineVerb> args)
{
var shellUid = shell.Owner;
if (args.User != shellUid || _slots.GetItemOrNull(shell, shell.Comp.ShardSlotId) is not { } shard ||
args.User != shard || !TryComp(shard, out SoulShardComponent? soulShard) ||
_ui.IsUiOpen(shellUid, RadialSelectorUiKey.Key))
if (_ui.IsUiOpen(shellUid, RadialSelectorUiKey.Key))
return;

args.Verbs.Add(new ExamineVerb
// Holy shitcode.
Action action;
if (args.User == shellUid)
{
DoContactInteraction = true,
Text = Loc.GetString("soul-shard-selector-form"),
Icon = new SpriteSpecifier.Texture(
new ResPath("/Textures/WhiteDream/BloodCult/Entities/Items/construct_shell.rsi")),
Act = () =>
action = () =>
{
_ui.SetUiState(shellUid, RadialSelectorUiKey.Key, new RadialSelectorState(shell.Comp.Constructs, true));
_ui.TryToggleUi(shellUid, RadialSelectorUiKey.Key, shell);
};
}
else if (_slots.GetItemOrNull(shell, shell.Comp.ShardSlotId) is { } shard && args.User == shard &&
TryComp(shard, out SoulShardComponent? soulShard))
{
action = () =>
{
_ui.SetUiState(shellUid,
RadialSelectorUiKey.Key,
new RadialSelectorState(soulShard.IsBlessed ? soulShard.PurifiedConstructs : soulShard.Constructs,
new RadialSelectorState(soulShard.IsBlessed ? shell.Comp.PurifiedConstructs : shell.Comp.Constructs,
true));
_ui.TryToggleUi(shellUid, RadialSelectorUiKey.Key, shard);
}
};
}
else
return;

args.Verbs.Add(new ExamineVerb
{
DoContactInteraction = true,
Text = Loc.GetString("soul-shard-selector-form"),
Icon = new SpriteSpecifier.Texture(
new ResPath("/Textures/WhiteDream/BloodCult/Entities/Items/construct_shell.rsi")),
Act = action
});
}

Expand All @@ -77,7 +93,7 @@ private void OnInteractUsing(Entity<ConstructShellComponent> shell, ref Containe
_slots.SetLock(shell, shell.Comp.ShardSlotId, true);
_ui.SetUiState(shellUid,
RadialSelectorUiKey.Key,
new RadialSelectorState(soulShard.IsBlessed ? soulShard.PurifiedConstructs : soulShard.Constructs, true));
new RadialSelectorState(soulShard.IsBlessed ? shell.Comp.PurifiedConstructs : shell.Comp.Constructs, true));

_ui.TryToggleUi(shellUid, RadialSelectorUiKey.Key, args.EntityUid);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Content.Shared.RadialSelector;
using Robust.Shared.Prototypes;
using Robust.Shared.Prototypes;

namespace Content.Server.WhiteDream.BloodCult.Constructs.SoulShard;

Expand All @@ -18,39 +17,5 @@ public sealed partial class SoulShardComponent : Component
[DataField]
public EntProtoId PurifiedShadeProto = "ShadeHoly";

[DataField]
public List<RadialSelectorEntry> Constructs = new()
{
new RadialSelectorEntry
{
Prototype = "ConstructJuggernaut"
},
new RadialSelectorEntry
{
Prototype = "ConstructArtificer"
},
new RadialSelectorEntry
{
Prototype = "ConstructWraith"
}
};

[DataField]
public List<RadialSelectorEntry> PurifiedConstructs = new()
{
new RadialSelectorEntry
{
Prototype = "ConstructJuggernautHoly"
},
new RadialSelectorEntry
{
Prototype = "ConstructArtificerHoly"
},
new RadialSelectorEntry
{
Prototype = "ConstructWraithHoly"
}
};

public EntityUid? ShadeUid;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ public override void Initialize()
private void OnInteract(Entity<BloodCultBarrierComponent> ent, ref InteractUsingEvent args)
{
if (!HasComp<RuneDrawerComponent>(args.Used) || !HasComp<BloodCultistComponent>(args.User))
{
return;
}

_popup.PopupEntity("cult-barrier-destroyed", args.User, args.User);
Del(args.Target);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed partial class BloodCultEmpoweredComponent : Component
/// Increases the amount of spells cultists can create at once.
/// </summary>
[DataField]
public int ExtraSpells = 2;
public int ExtraSpells = 3;

/// <summary>
/// The default duration of the empowering.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ public sealed partial class ShuttleCurseComponent : Component
[DataField]
public List<string> CurseMessages = new()
{
"A fuel technician just slit his own throat and begged for death.",
"A scan of the shuttle's fuel tank has revealed tainting by a mixture of humanoid innards and teeth.",
"A security incident involving a frenzied shuttle worker attacking coworkers with a laser cutter has just been reported as resolved by on-site security.",
"A shuttle engineer began screaming 'DEATH IS NOT THE END' and ripped out wires until an arc flash seared off her flesh.",
"A shuttle engineer was spotted inside the cockpit, feverishly arranging her innards on the floor in the shape of a rune before expiring.",
"A shuttle inspector started laughing madly over the radio and then threw herself into an engine turbine.",
"The corpse of an unidentified shuttle worker was found mutilated beyond recognition in the shuttle's main hold, with at least five unique sources of blood on the scene.",
"The shuttle dispatcher was found dead with bloody symbols carved into their flesh.",
"The shuttle's custodian was found washing the windows with their own blood.",
"The shuttle's navigation programming was replaced by a file containing just two words: IT COMES.",
"The shuttle's transponder is emitting the encoded message 'FEAR THE OLD BLOOD' in lieu of its assigned identification signal."
"shuttle-curse-message-1",
"shuttle-curse-message-2",
"shuttle-curse-message-3",
"shuttle-curse-message-4",
"shuttle-curse-message-5",
"shuttle-curse-message-6",
"shuttle-curse-message-7",
"shuttle-curse-message-8",
"shuttle-curse-message-9",
"shuttle-curse-message-10",
"shuttle-curse-message-11",
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ private void OnActivate(Entity<ShuttleCurseComponent> orb, ref ActivateInWorldEv

_roundEnd.DelayShuttle(orb.Comp.DelayTime);

var cursedMessage = string.Concat(_random.Pick(orb.Comp.CurseMessages), " ",
var cursedMessage = string.Concat(Loc.GetString(_random.Pick(orb.Comp.CurseMessages)),
" ",
Loc.GetString("shuttle-curse-success-global", ("time", orb.Comp.DelayTime.TotalMinutes)));

_chat.DispatchGlobalAnnouncement(cursedMessage, Loc.GetString("shuttle-curse-system-failure"),
_chat.DispatchGlobalAnnouncement(cursedMessage,
Loc.GetString("shuttle-curse-system-failure"),
colorOverride: Color.Gold);

_popup.PopupEntity(Loc.GetString("shuttle-curse-success"), args.User, args.User);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ public override void Initialize()
private void OnObjectiveAssigned(Entity<KillTargetCultComponent> ent, ref ObjectiveAssignedEvent args)
{
var cultistRule = EntityManager.EntityQuery<BloodCultRuleComponent>().FirstOrDefault();
if (cultistRule?.OfferingTarget == null)
{
return;
}

ent.Comp.Target = cultistRule.OfferingTarget.Value;
if (cultistRule?.OfferingTarget is { } target)
ent.Comp.Target = target;
}

private void OnAfterAssign(Entity<KillTargetCultComponent> ent, ref ObjectiveAfterAssignEvent args)
Expand All @@ -40,13 +36,9 @@ private void OnGetProgress(Entity<KillTargetCultComponent> ent, ref ObjectiveGet
{
var target = ent.Comp.Target;

if (!HasComp<MobStateComponent>(target) || _mobState.IsDead(target))
{
args.Progress = 1f;
return;
}

args.Progress = 0f;
args.Progress = !HasComp<MobStateComponent>(target) || _mobState.IsDead(target)
? args.Progress = 1f
: args.Progress = 0f;
}

private string GetTitle(EntityUid target, string title)
Expand Down
22 changes: 9 additions & 13 deletions Content.Server/WhiteDream/BloodCult/Pylon/PylonSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,16 @@ private void ToggleActive(Entity<PylonComponent> pylon)

private void CorruptTilesInRange(Entity<PylonComponent> pylon)
{
var pylonTransform = Transform(pylon);
if (pylonTransform.GridUid is not { } gridUid ||
!TryComp(pylonTransform.GridUid, out MapGridComponent? mapGrid))
{
var pylonTrans = Transform(pylon);
if (pylonTrans.GridUid is not { } gridUid || !TryComp(pylonTrans.GridUid, out MapGridComponent? mapGrid))
return;
}

var radius = pylon.Comp.CorruptionRadius;
var tilesRefs = _map.GetLocalTilesIntersecting(gridUid, mapGrid, new Box2(
pylonTransform.Coordinates.Position + new Vector2(-radius, -radius),
pylonTransform.Coordinates.Position + new Vector2(radius, radius))
).ToList();
var tilesRefs = _map.GetLocalTilesIntersecting(gridUid,
mapGrid,
new Box2(pylonTrans.Coordinates.Position + new Vector2(-radius, -radius),
pylonTrans.Coordinates.Position + new Vector2(radius, radius)))
.ToList();

_random.Shuffle(tilesRefs);

Expand All @@ -131,10 +129,8 @@ private void HealInRange(Entity<PylonComponent> pylon)

foreach (var target in targets)
{
if (!HasComp<BloodCultistComponent>(target) || _mobState.IsDead(target))
continue;

_damageable.TryChangeDamage(target, pylon.Comp.Healing, true);
if (HasComp<BloodCultistComponent>(target) && !_mobState.IsDead(target))
_damageable.TryChangeDamage(target, pylon.Comp.Healing, true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,15 @@ private void OnApocalypseRuneInvoked(Entity<CultRuneApocalypseComponent> ent, re

private void OnDoAfter(Entity<CultRuneApocalypseComponent> ent, ref ApocalypseRuneDoAfter args)
{
if (args.Cancelled ||
EntityManager.EntityQuery<BloodCultRuleComponent>().FirstOrDefault() is not { } cultRule)
{
if (args.Cancelled || EntityManager.EntityQuery<BloodCultRuleComponent>().FirstOrDefault() is not { } cultRule)
return;
}

ent.Comp.Used = true;
_appearance.SetData(ent, ApocalypseRuneVisuals.Used, true);

_emp.EmpPulse(_transform.GetMapCoordinates(ent), ent.Comp.EmpRange, ent.Comp.EmpEnergyConsumption,
_emp.EmpPulse(_transform.GetMapCoordinates(ent),
ent.Comp.EmpRange,
ent.Comp.EmpEnergyConsumption,
ent.Comp.EmpDuration);

foreach (var guaranteedEvent in ent.Comp.GuaranteedEvents)
Expand All @@ -68,9 +67,7 @@ private void OnDoAfter(Entity<CultRuneApocalypseComponent> ent, ref ApocalypseRu
var requiredCultistsThreshold = MathF.Floor(_playerManager.PlayerCount * ent.Comp.CultistsThreshold);
var totalCultists = cultRule.Cultists.Count + cultRule.Constructs.Count;
if (totalCultists >= requiredCultistsThreshold)
{
return;
}

var (randomEvent, repeatTimes) = _random.Pick(ent.Comp.PossibleEvents);
for (var i = 0; i < repeatTimes; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ public override void Initialize()

private void OnBloodBoilRuneInvoked(Entity<CultRuneBloodBoilComponent> ent, ref TryInvokeCultRuneEvent args)
{
var targets = _cultRune.GetTargetsNearRune(ent, ent.Comp.TargetsLookupRange, entity =>
HasComp<BloodCultistComponent>(entity) ||
!HasComp<BloodstreamComponent>(entity) ||
!_examine.InRangeUnOccluded(ent, entity, ent.Comp.TargetsLookupRange)).ToList();
var targets = _cultRune.GetTargetsNearRune(ent,
ent.Comp.TargetsLookupRange,
entity =>
HasComp<BloodCultistComponent>(entity) ||
!HasComp<BloodstreamComponent>(entity) ||
!_examine.InRangeUnOccluded(ent, entity, ent.Comp.TargetsLookupRange))
.ToList();

if (targets.Count == 0)
{
Expand Down
Loading

0 comments on commit 0f9c91d

Please sign in to comment.