2024-11-17 11:46:31 -05:00
|
|
|
using System.Numerics;
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
using Content.Shared.Body.Components;
|
|
|
|
|
using Content.Shared.Body.Systems;
|
|
|
|
|
using Content.Shared.Coordinates.Helpers;
|
|
|
|
|
using Content.Shared.Doors.Components;
|
|
|
|
|
using Content.Shared.Doors.Systems;
|
|
|
|
|
using Content.Shared.Hands.Components;
|
|
|
|
|
using Content.Shared.Hands.EntitySystems;
|
|
|
|
|
using Content.Shared.Interaction;
|
|
|
|
|
using Content.Shared.Inventory;
|
|
|
|
|
using Content.Shared.Lock;
|
|
|
|
|
using Content.Shared.Magic.Components;
|
|
|
|
|
using Content.Shared.Magic.Events;
|
|
|
|
|
using Content.Shared.Maps;
|
2024-11-17 11:46:31 -05:00
|
|
|
using Content.Shared.Mind;
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
using Content.Shared.Physics;
|
|
|
|
|
using Content.Shared.Popups;
|
|
|
|
|
using Content.Shared.Speech.Muting;
|
|
|
|
|
using Content.Shared.Storage;
|
2024-12-16 07:12:45 -05:00
|
|
|
using Content.Shared.Stunnable;
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
using Content.Shared.Tag;
|
|
|
|
|
using Content.Shared.Weapons.Ranged.Components;
|
|
|
|
|
using Content.Shared.Weapons.Ranged.Systems;
|
2024-11-17 11:46:31 -05:00
|
|
|
using Robust.Shared.Audio.Systems;
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
using Robust.Shared.Map;
|
|
|
|
|
using Robust.Shared.Map.Components;
|
|
|
|
|
using Robust.Shared.Network;
|
|
|
|
|
using Robust.Shared.Physics.Systems;
|
2025-02-12 23:46:02 -05:00
|
|
|
using Robust.Shared.Prototypes;
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
using Robust.Shared.Random;
|
|
|
|
|
using Robust.Shared.Serialization.Manager;
|
|
|
|
|
using Robust.Shared.Spawners;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Magic;
|
|
|
|
|
|
2025-02-02 14:23:41 -05:00
|
|
|
// TODO: Move BeforeCast & Prerequirements (like Wizard clothes) to action comp
|
|
|
|
|
// Alt idea - make it its own comp and split, like the Charge PR
|
|
|
|
|
// TODO: Move speech to actionComp or again, its own ECS
|
|
|
|
|
// TODO: Use the MagicComp just for pure backend things like spawning patterns?
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Handles learning and using spells (actions)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public abstract class SharedMagicSystem : EntitySystem
|
|
|
|
|
{
|
|
|
|
|
[Dependency] private readonly ISerializationManager _seriMan = default!;
|
|
|
|
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
|
|
|
|
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
|
|
|
|
|
[Dependency] private readonly IRobustRandom _random = default!;
|
|
|
|
|
[Dependency] private readonly SharedGunSystem _gunSystem = default!;
|
|
|
|
|
[Dependency] private readonly SharedPhysicsSystem _physics = default!;
|
|
|
|
|
[Dependency] private readonly SharedTransformSystem _transform = default!;
|
|
|
|
|
[Dependency] private readonly INetManager _net = default!;
|
|
|
|
|
[Dependency] private readonly SharedBodySystem _body = default!;
|
|
|
|
|
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
|
|
|
|
[Dependency] private readonly SharedDoorSystem _door = default!;
|
|
|
|
|
[Dependency] private readonly InventorySystem _inventory = default!;
|
|
|
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
|
|
|
[Dependency] private readonly SharedInteractionSystem _interaction = default!;
|
|
|
|
|
[Dependency] private readonly LockSystem _lock = default!;
|
|
|
|
|
[Dependency] private readonly SharedHandsSystem _hands = default!;
|
|
|
|
|
[Dependency] private readonly TagSystem _tag = default!;
|
2024-11-17 11:46:31 -05:00
|
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
|
|
|
|
[Dependency] private readonly SharedMindSystem _mind = default!;
|
2024-12-16 07:12:45 -05:00
|
|
|
[Dependency] private readonly SharedStunSystem _stun = default!;
|
2025-06-21 08:23:19 -07:00
|
|
|
[Dependency] private readonly TurfSystem _turf = default!;
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
|
2025-04-05 00:20:19 +00:00
|
|
|
private static readonly ProtoId<TagPrototype> InvalidForGlobalSpawnSpellTag = "InvalidForGlobalSpawnSpell";
|
|
|
|
|
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
SubscribeLocalEvent<MagicComponent, BeforeCastSpellEvent>(OnBeforeCastSpell);
|
|
|
|
|
|
|
|
|
|
SubscribeLocalEvent<InstantSpawnSpellEvent>(OnInstantSpawn);
|
|
|
|
|
SubscribeLocalEvent<TeleportSpellEvent>(OnTeleportSpell);
|
|
|
|
|
SubscribeLocalEvent<WorldSpawnSpellEvent>(OnWorldSpawn);
|
|
|
|
|
SubscribeLocalEvent<ProjectileSpellEvent>(OnProjectileSpell);
|
|
|
|
|
SubscribeLocalEvent<ChangeComponentsSpellEvent>(OnChangeComponentsSpell);
|
|
|
|
|
SubscribeLocalEvent<SmiteSpellEvent>(OnSmiteSpell);
|
|
|
|
|
SubscribeLocalEvent<KnockSpellEvent>(OnKnockSpell);
|
|
|
|
|
SubscribeLocalEvent<ChargeSpellEvent>(OnChargeSpell);
|
2024-11-17 11:46:31 -05:00
|
|
|
SubscribeLocalEvent<RandomGlobalSpawnSpellEvent>(OnRandomGlobalSpawnSpell);
|
2024-12-16 07:12:45 -05:00
|
|
|
SubscribeLocalEvent<MindSwapSpellEvent>(OnMindSwapSpell);
|
2025-01-30 19:10:35 -05:00
|
|
|
SubscribeLocalEvent<VoidApplauseSpellEvent>(OnVoidApplause);
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnBeforeCastSpell(Entity<MagicComponent> ent, ref BeforeCastSpellEvent args)
|
|
|
|
|
{
|
|
|
|
|
var comp = ent.Comp;
|
|
|
|
|
var hasReqs = true;
|
|
|
|
|
|
|
|
|
|
if (comp.RequiresClothes)
|
|
|
|
|
{
|
|
|
|
|
var enumerator = _inventory.GetSlotEnumerator(args.Performer, SlotFlags.OUTERCLOTHING | SlotFlags.HEAD);
|
|
|
|
|
while (enumerator.MoveNext(out var containerSlot))
|
|
|
|
|
{
|
|
|
|
|
if (containerSlot.ContainedEntity is { } item)
|
|
|
|
|
hasReqs = HasComp<WizardClothesComponent>(item);
|
|
|
|
|
else
|
|
|
|
|
hasReqs = false;
|
|
|
|
|
|
|
|
|
|
if (!hasReqs)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (comp.RequiresSpeech && HasComp<MutedComponent>(args.Performer))
|
|
|
|
|
hasReqs = false;
|
|
|
|
|
|
|
|
|
|
if (hasReqs)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
args.Cancelled = true;
|
|
|
|
|
_popup.PopupClient(Loc.GetString("spell-requirements-failed"), args.Performer, args.Performer);
|
|
|
|
|
|
|
|
|
|
// TODO: Pre-cast do after, either here or in SharedActionsSystem
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private bool PassesSpellPrerequisites(EntityUid spell, EntityUid performer)
|
|
|
|
|
{
|
|
|
|
|
var ev = new BeforeCastSpellEvent(performer);
|
|
|
|
|
RaiseLocalEvent(spell, ref ev);
|
|
|
|
|
return !ev.Cancelled;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Spells
|
|
|
|
|
#region Instant Spawn Spells
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Handles the instant action (i.e. on the caster) attempting to spawn an entity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void OnInstantSpawn(InstantSpawnSpellEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Handled || !PassesSpellPrerequisites(args.Action, args.Performer))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var transform = Transform(args.Performer);
|
|
|
|
|
|
|
|
|
|
foreach (var position in GetInstantSpawnPositions(transform, args.PosData))
|
|
|
|
|
{
|
|
|
|
|
SpawnSpellHelper(args.Prototype, position, args.Performer, preventCollide: args.PreventCollideWithCaster);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
args.Handled = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets spawn positions listed on <see cref="InstantSpawnSpellEvent"/>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <exception cref="ArgumentOutOfRangeException"></exception>
|
|
|
|
|
private List<EntityCoordinates> GetInstantSpawnPositions(TransformComponent casterXform, MagicInstantSpawnData data)
|
|
|
|
|
{
|
|
|
|
|
switch (data)
|
|
|
|
|
{
|
|
|
|
|
case TargetCasterPos:
|
|
|
|
|
return new List<EntityCoordinates>(1) {casterXform.Coordinates};
|
|
|
|
|
case TargetInFrontSingle:
|
|
|
|
|
{
|
|
|
|
|
var directionPos = casterXform.Coordinates.Offset(casterXform.LocalRotation.ToWorldVec().Normalized());
|
|
|
|
|
|
|
|
|
|
if (!TryComp<MapGridComponent>(casterXform.GridUid, out var mapGrid))
|
|
|
|
|
return new List<EntityCoordinates>();
|
2025-06-21 08:23:19 -07:00
|
|
|
if (!_turf.TryGetTileRef(directionPos, out var tileReference))
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
return new List<EntityCoordinates>();
|
|
|
|
|
|
|
|
|
|
var tileIndex = tileReference.Value.GridIndices;
|
|
|
|
|
return new List<EntityCoordinates>(1) { _mapSystem.GridTileToLocal(casterXform.GridUid.Value, mapGrid, tileIndex) };
|
|
|
|
|
}
|
|
|
|
|
case TargetInFront:
|
|
|
|
|
{
|
|
|
|
|
var directionPos = casterXform.Coordinates.Offset(casterXform.LocalRotation.ToWorldVec().Normalized());
|
|
|
|
|
|
|
|
|
|
if (!TryComp<MapGridComponent>(casterXform.GridUid, out var mapGrid))
|
|
|
|
|
return new List<EntityCoordinates>();
|
|
|
|
|
|
2025-06-21 08:23:19 -07:00
|
|
|
if (!_turf.TryGetTileRef(directionPos, out var tileReference))
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
return new List<EntityCoordinates>();
|
|
|
|
|
|
|
|
|
|
var tileIndex = tileReference.Value.GridIndices;
|
|
|
|
|
var coords = _mapSystem.GridTileToLocal(casterXform.GridUid.Value, mapGrid, tileIndex);
|
|
|
|
|
EntityCoordinates coordsPlus;
|
|
|
|
|
EntityCoordinates coordsMinus;
|
|
|
|
|
|
|
|
|
|
var dir = casterXform.LocalRotation.GetCardinalDir();
|
|
|
|
|
switch (dir)
|
|
|
|
|
{
|
|
|
|
|
case Direction.North:
|
|
|
|
|
case Direction.South:
|
|
|
|
|
{
|
|
|
|
|
coordsPlus = _mapSystem.GridTileToLocal(casterXform.GridUid.Value, mapGrid, tileIndex + (1, 0));
|
|
|
|
|
coordsMinus = _mapSystem.GridTileToLocal(casterXform.GridUid.Value, mapGrid, tileIndex + (-1, 0));
|
|
|
|
|
return new List<EntityCoordinates>(3)
|
|
|
|
|
{
|
|
|
|
|
coords,
|
|
|
|
|
coordsPlus,
|
|
|
|
|
coordsMinus,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
case Direction.East:
|
|
|
|
|
case Direction.West:
|
|
|
|
|
{
|
|
|
|
|
coordsPlus = _mapSystem.GridTileToLocal(casterXform.GridUid.Value, mapGrid, tileIndex + (0, 1));
|
|
|
|
|
coordsMinus = _mapSystem.GridTileToLocal(casterXform.GridUid.Value, mapGrid, tileIndex + (0, -1));
|
|
|
|
|
return new List<EntityCoordinates>(3)
|
|
|
|
|
{
|
|
|
|
|
coords,
|
|
|
|
|
coordsPlus,
|
|
|
|
|
coordsMinus,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new List<EntityCoordinates>();
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
throw new ArgumentOutOfRangeException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// End Instant Spawn Spells
|
|
|
|
|
#endregion
|
|
|
|
|
#region World Spawn Spells
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Spawns entities from a list within range of click.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// It will offset entities after the first entity based on the OffsetVector2.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <param name="args"> The Spawn Spell Event args.</param>
|
|
|
|
|
private void OnWorldSpawn(WorldSpawnSpellEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Handled || !PassesSpellPrerequisites(args.Action, args.Performer))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var targetMapCoords = args.Target;
|
|
|
|
|
|
|
|
|
|
WorldSpawnSpellHelper(args.Prototypes, targetMapCoords, args.Performer, args.Lifetime, args.Offset);
|
|
|
|
|
args.Handled = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Loops through a supplied list of entity prototypes and spawns them
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// If an offset of 0, 0 is supplied then the entities will all spawn on the same tile.
|
|
|
|
|
/// Any other offset will spawn entities starting from the source Map Coordinates and will increment the supplied
|
|
|
|
|
/// offset
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <param name="entityEntries"> The list of Entities to spawn in</param>
|
|
|
|
|
/// <param name="entityCoords"> Map Coordinates where the entities will spawn</param>
|
|
|
|
|
/// <param name="lifetime"> Check to see if the entities should self delete</param>
|
|
|
|
|
/// <param name="offsetVector2"> A Vector2 offset that the entities will spawn in</param>
|
|
|
|
|
private void WorldSpawnSpellHelper(List<EntitySpawnEntry> entityEntries, EntityCoordinates entityCoords, EntityUid performer, float? lifetime, Vector2 offsetVector2)
|
|
|
|
|
{
|
|
|
|
|
var getProtos = EntitySpawnCollection.GetSpawns(entityEntries, _random);
|
|
|
|
|
|
|
|
|
|
var offsetCoords = entityCoords;
|
|
|
|
|
foreach (var proto in getProtos)
|
|
|
|
|
{
|
|
|
|
|
SpawnSpellHelper(proto, offsetCoords, performer, lifetime);
|
|
|
|
|
offsetCoords = offsetCoords.Offset(offsetVector2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// End World Spawn Spells
|
|
|
|
|
#endregion
|
|
|
|
|
#region Projectile Spells
|
|
|
|
|
private void OnProjectileSpell(ProjectileSpellEvent ev)
|
|
|
|
|
{
|
|
|
|
|
if (ev.Handled || !PassesSpellPrerequisites(ev.Action, ev.Performer) || !_net.IsServer)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ev.Handled = true;
|
|
|
|
|
|
|
|
|
|
var xform = Transform(ev.Performer);
|
|
|
|
|
var fromCoords = xform.Coordinates;
|
|
|
|
|
var toCoords = ev.Target;
|
|
|
|
|
var userVelocity = _physics.GetMapLinearVelocity(ev.Performer);
|
|
|
|
|
|
|
|
|
|
// If applicable, this ensures the projectile is parented to grid on spawn, instead of the map.
|
2025-04-21 18:40:31 +00:00
|
|
|
var fromMap = _transform.ToMapCoordinates(fromCoords);
|
2025-05-14 19:24:44 -04:00
|
|
|
var ent = Spawn(ev.Prototype, fromMap);
|
2025-04-21 18:40:31 +00:00
|
|
|
var direction = _transform.ToMapCoordinates(toCoords).Position -
|
2025-05-14 19:24:44 -04:00
|
|
|
fromMap.Position;
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
_gunSystem.ShootProjectile(ent, direction, userVelocity, ev.Performer, ev.Performer);
|
|
|
|
|
}
|
|
|
|
|
// End Projectile Spells
|
|
|
|
|
#endregion
|
|
|
|
|
#region Change Component Spells
|
|
|
|
|
// staves.yml ActionRGB light
|
|
|
|
|
private void OnChangeComponentsSpell(ChangeComponentsSpellEvent ev)
|
|
|
|
|
{
|
|
|
|
|
if (ev.Handled || !PassesSpellPrerequisites(ev.Action, ev.Performer))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ev.Handled = true;
|
|
|
|
|
|
2025-02-12 23:46:02 -05:00
|
|
|
RemoveComponents(ev.Target, ev.ToRemove);
|
|
|
|
|
AddComponents(ev.Target, ev.ToAdd);
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
}
|
|
|
|
|
// End Change Component Spells
|
|
|
|
|
#endregion
|
|
|
|
|
#region Teleport Spells
|
|
|
|
|
// TODO: Rename to teleport clicked spell?
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Teleports the user to the clicked location
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="args"></param>
|
|
|
|
|
private void OnTeleportSpell(TeleportSpellEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Handled || !PassesSpellPrerequisites(args.Action, args.Performer))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var transform = Transform(args.Performer);
|
2025-01-30 19:10:35 -05:00
|
|
|
if (transform.MapID != _transform.GetMapId(args.Target) || !_interaction.InRangeUnobstructed(args.Performer, args.Target, range: 1000F, collisionMask: CollisionGroup.Opaque, popup: true))
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_transform.SetCoordinates(args.Performer, args.Target);
|
|
|
|
|
_transform.AttachToGridOrMap(args.Performer, transform);
|
|
|
|
|
args.Handled = true;
|
|
|
|
|
}
|
2025-01-30 19:10:35 -05:00
|
|
|
|
|
|
|
|
public virtual void OnVoidApplause(VoidApplauseSpellEvent ev)
|
|
|
|
|
{
|
|
|
|
|
if (ev.Handled || !PassesSpellPrerequisites(ev.Action, ev.Performer))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ev.Handled = true;
|
|
|
|
|
|
|
|
|
|
_transform.SwapPositions(ev.Performer, ev.Target);
|
|
|
|
|
}
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
// End Teleport Spells
|
|
|
|
|
#endregion
|
|
|
|
|
#region Spell Helpers
|
|
|
|
|
private void SpawnSpellHelper(string? proto, EntityCoordinates position, EntityUid performer, float? lifetime = null, bool preventCollide = false)
|
|
|
|
|
{
|
|
|
|
|
if (!_net.IsServer)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var ent = Spawn(proto, position.SnapToGrid(EntityManager, _mapManager));
|
|
|
|
|
|
|
|
|
|
if (lifetime != null)
|
|
|
|
|
{
|
|
|
|
|
var comp = EnsureComp<TimedDespawnComponent>(ent);
|
|
|
|
|
comp.Lifetime = lifetime.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (preventCollide)
|
|
|
|
|
{
|
|
|
|
|
var comp = EnsureComp<PreventCollideComponent>(ent);
|
|
|
|
|
comp.Uid = performer;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-02-12 23:46:02 -05:00
|
|
|
|
|
|
|
|
private void AddComponents(EntityUid target, ComponentRegistry comps)
|
|
|
|
|
{
|
|
|
|
|
foreach (var (name, data) in comps)
|
|
|
|
|
{
|
|
|
|
|
if (HasComp(target, data.Component.GetType()))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-05-20 15:08:55 +10:00
|
|
|
var component = (Component)Factory.GetComponent(name);
|
2025-02-12 23:46:02 -05:00
|
|
|
var temp = (object)component;
|
|
|
|
|
_seriMan.CopyTo(data.Component, ref temp);
|
2025-06-26 19:50:49 -04:00
|
|
|
AddComp(target, (Component)temp!);
|
2025-02-12 23:46:02 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void RemoveComponents(EntityUid target, HashSet<string> comps)
|
|
|
|
|
{
|
|
|
|
|
foreach (var toRemove in comps)
|
|
|
|
|
{
|
2025-05-20 15:08:55 +10:00
|
|
|
if (Factory.TryGetRegistration(toRemove, out var registration))
|
2025-02-12 23:46:02 -05:00
|
|
|
RemComp(target, registration.Type);
|
|
|
|
|
}
|
|
|
|
|
}
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
// End Spell Helpers
|
|
|
|
|
#endregion
|
2025-02-02 14:23:41 -05:00
|
|
|
#region Touch Spells
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
private void OnSmiteSpell(SmiteSpellEvent ev)
|
|
|
|
|
{
|
|
|
|
|
if (ev.Handled || !PassesSpellPrerequisites(ev.Action, ev.Performer))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ev.Handled = true;
|
|
|
|
|
|
|
|
|
|
var direction = _transform.GetMapCoordinates(ev.Target, Transform(ev.Target)).Position - _transform.GetMapCoordinates(ev.Performer, Transform(ev.Performer)).Position;
|
|
|
|
|
var impulseVector = direction * 10000;
|
|
|
|
|
|
|
|
|
|
_physics.ApplyLinearImpulse(ev.Target, impulseVector);
|
|
|
|
|
|
|
|
|
|
if (!TryComp<BodyComponent>(ev.Target, out var body))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_body.GibBody(ev.Target, true, body);
|
|
|
|
|
}
|
2025-02-02 14:23:41 -05:00
|
|
|
|
|
|
|
|
// End Touch Spells
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
#endregion
|
|
|
|
|
#region Knock Spells
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Opens all doors and locks within range
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="args"></param>
|
|
|
|
|
private void OnKnockSpell(KnockSpellEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (args.Handled || !PassesSpellPrerequisites(args.Action, args.Performer))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
args.Handled = true;
|
|
|
|
|
|
|
|
|
|
var transform = Transform(args.Performer);
|
|
|
|
|
|
|
|
|
|
// Look for doors and lockers, and don't open/unlock them if they're already opened/unlocked.
|
|
|
|
|
foreach (var target in _lookup.GetEntitiesInRange(_transform.GetMapCoordinates(args.Performer, transform), args.Range, flags: LookupFlags.Dynamic | LookupFlags.Static))
|
|
|
|
|
{
|
|
|
|
|
if (!_interaction.InRangeUnobstructed(args.Performer, target, range: 0, collisionMask: CollisionGroup.Opaque))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (TryComp<DoorBoltComponent>(target, out var doorBoltComp) && doorBoltComp.BoltsDown)
|
|
|
|
|
_door.SetBoltsDown((target, doorBoltComp), false, predicted: true);
|
|
|
|
|
|
|
|
|
|
if (TryComp<DoorComponent>(target, out var doorComp) && doorComp.State is not DoorState.Open)
|
|
|
|
|
_door.StartOpening(target);
|
|
|
|
|
|
|
|
|
|
if (TryComp<LockComponent>(target, out var lockComp) && lockComp.Locked)
|
|
|
|
|
_lock.Unlock(target, args.Performer, lockComp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// End Knock Spells
|
|
|
|
|
#endregion
|
|
|
|
|
#region Charge Spells
|
|
|
|
|
// TODO: Future support to charge other items
|
|
|
|
|
private void OnChargeSpell(ChargeSpellEvent ev)
|
|
|
|
|
{
|
|
|
|
|
if (ev.Handled || !PassesSpellPrerequisites(ev.Action, ev.Performer) || !TryComp<HandsComponent>(ev.Performer, out var handsComp))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
EntityUid? wand = null;
|
2025-06-25 09:13:03 -04:00
|
|
|
foreach (var item in _hands.EnumerateHeld((ev.Performer, handsComp)))
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
{
|
|
|
|
|
if (!_tag.HasTag(item, ev.WandTag))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
wand = item;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ev.Handled = true;
|
|
|
|
|
|
|
|
|
|
if (wand == null || !TryComp<BasicEntityAmmoProviderComponent>(wand, out var basicAmmoComp) || basicAmmoComp.Count == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
_gunSystem.UpdateBasicEntityAmmoCount(wand.Value, basicAmmoComp.Count.Value + ev.Charge, basicAmmoComp);
|
|
|
|
|
}
|
|
|
|
|
// End Charge Spells
|
2024-11-17 11:46:31 -05:00
|
|
|
#endregion
|
|
|
|
|
#region Global Spells
|
|
|
|
|
|
2025-02-23 12:24:36 -05:00
|
|
|
// TODO: Change this into a "StartRuleAction" when actions with multiple events are supported
|
|
|
|
|
protected virtual void OnRandomGlobalSpawnSpell(RandomGlobalSpawnSpellEvent ev)
|
2024-11-17 11:46:31 -05:00
|
|
|
{
|
|
|
|
|
if (!_net.IsServer || ev.Handled || !PassesSpellPrerequisites(ev.Action, ev.Performer) || ev.Spawns is not { } spawns)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ev.Handled = true;
|
|
|
|
|
|
|
|
|
|
var allHumans = _mind.GetAliveHumans();
|
|
|
|
|
|
|
|
|
|
foreach (var human in allHumans)
|
|
|
|
|
{
|
|
|
|
|
if (!human.Comp.OwnedEntity.HasValue)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
var ent = human.Comp.OwnedEntity.Value;
|
|
|
|
|
|
2025-04-05 00:20:19 +00:00
|
|
|
if (_tag.HasTag(ent, InvalidForGlobalSpawnSpellTag))
|
2025-02-23 12:24:36 -05:00
|
|
|
continue;
|
|
|
|
|
|
2024-11-17 11:46:31 -05:00
|
|
|
var mapCoords = _transform.GetMapCoordinates(ent);
|
|
|
|
|
foreach (var spawn in EntitySpawnCollection.GetSpawns(spawns, _random))
|
|
|
|
|
{
|
|
|
|
|
var spawned = Spawn(spawn, mapCoords);
|
|
|
|
|
_hands.PickupOrDrop(ent, spawned);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_audio.PlayGlobal(ev.Sound, ev.Performer);
|
|
|
|
|
}
|
|
|
|
|
|
2024-12-16 07:12:45 -05:00
|
|
|
#endregion
|
|
|
|
|
#region Mindswap Spells
|
|
|
|
|
|
|
|
|
|
private void OnMindSwapSpell(MindSwapSpellEvent ev)
|
|
|
|
|
{
|
|
|
|
|
if (ev.Handled || !PassesSpellPrerequisites(ev.Action, ev.Performer))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ev.Handled = true;
|
|
|
|
|
|
|
|
|
|
// Need performer mind, but target mind is unnecessary, such as taking over a NPC
|
|
|
|
|
// Need to get target mind before putting performer mind into their body if they have one
|
|
|
|
|
// Thus, assign bool before first transfer, then check afterwards
|
|
|
|
|
|
|
|
|
|
if (!_mind.TryGetMind(ev.Performer, out var perMind, out var perMindComp))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var tarHasMind = _mind.TryGetMind(ev.Target, out var tarMind, out var tarMindComp);
|
|
|
|
|
|
|
|
|
|
_mind.TransferTo(perMind, ev.Target);
|
|
|
|
|
|
|
|
|
|
if (tarHasMind)
|
|
|
|
|
{
|
|
|
|
|
_mind.TransferTo(tarMind, ev.Performer);
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-21 10:22:11 -07:00
|
|
|
_stun.TryUpdateParalyzeDuration(ev.Target, ev.TargetStunDuration);
|
|
|
|
|
_stun.TryUpdateParalyzeDuration(ev.Performer, ev.PerformerStunDuration);
|
2024-12-16 07:12:45 -05:00
|
|
|
}
|
|
|
|
|
|
Magic Refactor + Wizard Grimoire (#22568)
* Brings over changes from the original magic refactor PR
* Adds Master Spellbook, spellbook categories, WizCoin currency, and locale
* Wiz€oin™
* Adds currency whitelist to Spellbook preset, grants contained actions on action added.
* Adds grant contained action and remove provided action.
* adds a way for actions to be upgraded to the store
* Adds Fireball 3 and fixes action upgrade logic so that it checks if the action can level or if the action can upgrade separately
* Fixes upgrade logic in ActionUpgradeSystem to allow for level ups without an actual upgrade. Fixed action upgrade logic in store system as well
* Removes current action entity from the bought entities list and adds new or old action entity
* Removes Current Entity
* Removes old comments, fixes TransferAllActionsWithNewAttached
* Removes TODO
* Removes Product Action Upgrade Event
* reverts changes to immovablerodrule
* Removes stale event reference
* fixes mind action grant logic
* reverts shared gun system change to projectile anomaly system
* forgor to remove the using
* Reverts unintended changes to action container
* Adds refund button to the store
* Refreshes store back to origin.
* Refund with correct currency
* Init refund
* Check for terminating and update interface
* Disables refund button
* Removes preset allow refund
* dont refund if map changed
* adds refunds to stores
* Adds method to check for starting map
* comments, datafields, some requested changes
* turns event into ref event
* Adds datafields
* Switches to entity terminating event
* Changes store entity to be nullable and checks if store is terminating to remove reference.
* Tryadd instead of containskey
* Adds a refund disable method, disables refund on bought ent container changes if not an action
* Removes duplicate refundcomp
* Removes unintended merges
* Removed another unintended change from merge
* removes extra using statement
* readds using statement
* might as well just remove both usings since it won't leave the PR
* Fixes Action upgrades from stores
* Changes to non obsolete method uses
* Shares spawn code between instant and world
* Adds action entity to action event, adds beforecastspellevent, adds spell requirements to magic component
* puts prereq check in spell methods, sets up template code for before cast event
* checks for required wizard clothes
* Networks Magic Comp and Wizard Clothes Comp. Renames MagicSpawnData to MagicInstantSpawnData.
* Removes posdata from projectiles
* Speech > RequiresSpeech
* Fixes ActionOnInteract
* checks for muted
* popup for missing reqs
* Validate click loc for blink spell
* Checks if doors are in range and not obstructed before opening
* Check ents by map coords
* Adds speak event
* Comments spellbooks
* Removes comments
* Unobsoletes smite spell
* Invert if
* Requirements loc
* Fixes spell reqs
* Inverts an if
* Comment updates
* Starts doafter work
* Removes doafter references
* Balances fireball upgrades to be more reasonable
* Enables refund on master spellbooks
* Spells to do
* update spellbook doafter
* knock toggles bolts
* Touch Spell comments
* Comments for pending spells
* more comments
* adds spider polymorph to spellbook
* TODOs for spells
* reorganizes spellbook categories and adds wands
* fixes spacing and adds limited conditions
* commented owner only for future store PR
* reenables owner only for the grimoire
* fixes grimoire sprite
* Adds wizard rod polymorph
* summon ghosts event
* Moves rod form to offensive category
* Adds charge spell and loc for rod polymorph
* Oops forgor the actual chages
* Item Recall comment
* Fixes UI
* removes extra field for wizard rod
* Cleanup
* New Condition (INCOMPLETE)
* Fix linter
* Fix linter (for real)
* fixed some descriptions
* adds regions to magic
* Adds a non-refund wizard grimoire, fixes blink to deselect after teleporting, reduces force wall despawn time to 12 seconds
* removes limited upgrade condition
---------
Co-authored-by: AJCM <AJCM@tutanota.com>
2024-05-11 19:06:49 -04:00
|
|
|
#endregion
|
|
|
|
|
// End Spells
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|