[Feature request] A trick to cast a spell
gdavid04 opened this issue ยท 0 comments
What i want basically is a trick to cast another spell, but it's more tricky than that.
First, no recursion is allowed, a spell casting another that directly or indirectly casted it silently fails.
A spell cast by this trick runs independently from the spell that casted it. It's like running two threads in parallel in real programming. The only thing guaranteed is that at least one trick gets executed from the spell cast by the trick before the original spell continues. If the spell won't execute any tricks (due to it being a projectile and don't hit anything or such) then the original spell continues as it would otherwise.
The trick's output is 0 if there were no problems so far with the other spell, 1 if it has errored and -1 if it would be a recursion and therefore won't cast.
The trick casts the spell in the CAD next to it, unless the trick's input is specified. If it is, the spell cast is the input-th next to the spell. -1 is previous, 1 is next, 0 is self which won't cast because it would be a recursion and so on.
Then there should be a fail trick too, a simple trick that errors if the input is 1 or -1, does nothing otherwise.
The next problem is that we would need more spell bullets available to utilize this effectively.
My idea is, instead of just adding bigger storage, making special CADs that won't interfere.
There would be a special upgrade slot when creating a CAD. An interference blocking upgrade could be added here to create a non-interfering CAD.
This CAD won't work with your armor and tools, but you can have more of them in your inventory without any problems. These would even function if you have a normal, interfering one too. Having multiple won't give you more psi to use.
These only allow casting the first 2 spells, the others are the hidden, underlying ones.
Spells cast from a non-interfering CAD only cast other spells from that CAD, if that CAD is no longer in the player's inventory, the spells cast with it just stop.
This addition would provide an indirect solution to the no conditional executing problem too as you could abuse the fact that recursion silently fails and the spell cast can be determined at cast-time.
But it still won't remove the throwing wrenches in people's plans, but actually the opposite. You would have to think more about a simple conditional execution and such while allowing for even better creations and providing even greater rewards at the end of the creation process.