From ee31a1f2933ba5e1290a453350e8ce2d927907d8 Mon Sep 17 00:00:00 2001 From: keronshb <54602815+keronshb@users.noreply.github.com> Date: Sat, 22 Feb 2025 10:56:54 -0500 Subject: [PATCH] Wizard: Repulse Spell (#35377) --- .../Events/RepulseAttractActionEvent.cs | 8 +++++++ .../RepulseAttract/RepulseAttractSystem.cs | 12 +++++++++++ .../Locale/en-US/store/spellbook-catalog.ftl | 7 ++++-- .../Prototypes/Catalog/spellbook_catalog.yml | 18 +++++++++++++++- Resources/Prototypes/Magic/repulse_spell.yml | 20 ++++++++++++++++++ .../Objects/Magic/magicactions.rsi/meta.json | 3 +++ .../Magic/magicactions.rsi/repulse.png | Bin 0 -> 245 bytes 7 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 Content.Shared/RepulseAttract/Events/RepulseAttractActionEvent.cs create mode 100644 Resources/Prototypes/Magic/repulse_spell.yml create mode 100644 Resources/Textures/Objects/Magic/magicactions.rsi/repulse.png diff --git a/Content.Shared/RepulseAttract/Events/RepulseAttractActionEvent.cs b/Content.Shared/RepulseAttract/Events/RepulseAttractActionEvent.cs new file mode 100644 index 0000000000..ac164d4327 --- /dev/null +++ b/Content.Shared/RepulseAttract/Events/RepulseAttractActionEvent.cs @@ -0,0 +1,8 @@ +using Content.Shared.Actions; + +namespace Content.Shared.RepulseAttract.Events; + +// Action event to repulse/attract +// TODO: Give speech support later for wizard +// TODO: When actions are refactored, give action targeting data (to change between single target, all around, etc) +public sealed partial class RepulseAttractActionEvent : InstantActionEvent; diff --git a/Content.Shared/RepulseAttract/RepulseAttractSystem.cs b/Content.Shared/RepulseAttract/RepulseAttractSystem.cs index 9363d7bbec..f95a38d2eb 100644 --- a/Content.Shared/RepulseAttract/RepulseAttractSystem.cs +++ b/Content.Shared/RepulseAttract/RepulseAttractSystem.cs @@ -7,6 +7,7 @@ using Content.Shared.Wieldable; using Robust.Shared.Map; using Robust.Shared.Physics.Components; using System.Numerics; +using Content.Shared.RepulseAttract.Events; using Content.Shared.Weapons.Melee; namespace Content.Shared.RepulseAttract; @@ -28,7 +29,9 @@ public sealed class RepulseAttractSystem : EntitySystem _physicsQuery = GetEntityQuery(); SubscribeLocalEvent(OnMeleeAttempt, before: [typeof(UseDelayOnMeleeHitSystem)], after: [typeof(SharedWieldableSystem)]); + SubscribeLocalEvent(OnRepulseAttractAction); } + private void OnMeleeAttempt(Entity ent, ref MeleeHitEvent args) { if (_delay.IsDelayed(ent.Owner)) @@ -37,6 +40,15 @@ public sealed class RepulseAttractSystem : EntitySystem TryRepulseAttract(ent, args.User); } + private void OnRepulseAttractAction(Entity ent, ref RepulseAttractActionEvent args) + { + if (args.Handled) + return; + + var position = _xForm.GetMapCoordinates(args.Performer); + args.Handled = TryRepulseAttract(position, args.Performer, ent.Comp.Speed, ent.Comp.Range, ent.Comp.Whitelist, ent.Comp.CollisionMask); + } + public bool TryRepulseAttract(Entity ent, EntityUid user) { var position = _xForm.GetMapCoordinates(ent.Owner); diff --git a/Resources/Locale/en-US/store/spellbook-catalog.ftl b/Resources/Locale/en-US/store/spellbook-catalog.ftl index 73d8118fc5..982f0491ed 100644 --- a/Resources/Locale/en-US/store/spellbook-catalog.ftl +++ b/Resources/Locale/en-US/store/spellbook-catalog.ftl @@ -9,9 +9,12 @@ spellbook-voidapplause-name = Void Applause spellbook-voidapplause-desc = Swap places with the target, doesn't it make you want to do the boogie? spellbook-force-wall-name = Force Wall -spellbook-force-wall-desc = Make three walls of pure force that you can pass through, but other's can't. +spellbook-force-wall-desc = Make three walls of pure force that you can pass through, but others can't. -spellbook-polymoprh-spider-name = Spider Polymoprh +spellbook-repulse-name = Repulse +spellbook-repulse-desc = Tell people to GITTAH`WEIGH and push 'em away from you. + +spellbook-polymorph-spider-name = Spider Polymorph spellbook-polymorph-spider-desc = Transforms you into a spider, man! spellbook-polymorph-rod-name = Rod Polymorph diff --git a/Resources/Prototypes/Catalog/spellbook_catalog.yml b/Resources/Prototypes/Catalog/spellbook_catalog.yml index 768475a03b..3fcddc4c7c 100644 --- a/Resources/Prototypes/Catalog/spellbook_catalog.yml +++ b/Resources/Prototypes/Catalog/spellbook_catalog.yml @@ -75,11 +75,27 @@ WizCoin: 3 categories: - SpellbookDefensive + conditions: + - !type:ListingLimitedStockCondition + stock: 1 + +- type: listing + id: SpellbookRepulse + name: spellbook-repulse-name + description: spellbook-repulse-desc + productAction: ActionRepulse + cost: + WizCoin: 2 + categories: + - SpellbookDefensive + conditions: + - !type:ListingLimitedStockCondition + stock: 1 # Utility - type: listing id: SpellbookPolymorphSpider - name: spellbook-polymoprh-spider-name + name: spellbook-polymorph-spider-name description: spellbook-polymorph-spider-desc productAction: ActionPolymorphWizardSpider cost: diff --git a/Resources/Prototypes/Magic/repulse_spell.yml b/Resources/Prototypes/Magic/repulse_spell.yml new file mode 100644 index 0000000000..77f919e6ff --- /dev/null +++ b/Resources/Prototypes/Magic/repulse_spell.yml @@ -0,0 +1,20 @@ +- type: entity + id: ActionRepulse + name: Repulse + description: Pushes entities away from the user. + components: + - type: RepulseAttract + speed: 10 + range: 5 + whitelist: + components: + - MobMover + - Item + - type: InstantAction + useDelay: 40 + raiseOnAction: true + itemIconStyle: BigAction + icon: + sprite: Objects/Magic/magicactions.rsi + state: repulse + event: !type:RepulseAttractActionEvent diff --git a/Resources/Textures/Objects/Magic/magicactions.rsi/meta.json b/Resources/Textures/Objects/Magic/magicactions.rsi/meta.json index a1112f0c6d..3868dbefa1 100644 --- a/Resources/Textures/Objects/Magic/magicactions.rsi/meta.json +++ b/Resources/Textures/Objects/Magic/magicactions.rsi/meta.json @@ -33,6 +33,9 @@ }, { "name": "item_recall" + }, + { + "name": "repulse" } ] } diff --git a/Resources/Textures/Objects/Magic/magicactions.rsi/repulse.png b/Resources/Textures/Objects/Magic/magicactions.rsi/repulse.png new file mode 100644 index 0000000000000000000000000000000000000000..6e51a48c106e7e4a894b57df3df11dbddb28fdf6 GIT binary patch literal 245 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdz&H|6fVg?4jBOuH;Rhv&5D7f6y z#WAE}&f95$d<_a5ZN;y>VwW_RP2@}c+^9Q~gE4saKmBhE-yG|EYG1EmUBK3HUGQ*a zdmckv5aW_p54V&(te0(A_3XHzYdG>@k*~?$6{QZ0TrM9?!;b z@W;*)!>R6_QW262KHH==if|q7wEDoerH*SWyMf1B)~ynnKX&YY$Rr`gFgyQTYs$N& pCMT06O&Ke^cpn7rlCJfM>qJYD@<);T3K0RSA}S2+Lx literal 0 HcmV?d00001