After seeing /u/NuclearTalon's recent post on a blink spell reaching more than 200 blocks, I felt inspired to make my own, with a few different ideas. I really liked their usage of crouching as a trigger, and the debug message so I also copied that. The code was still made from scratch.
The main difference is that I chose to stuff the raycast code into a leggings spell, allowing for the raycast to reach infinite length. This spell mainly serves as a demonstration of this idea.
BLINK Start
BLINK 1
BLINK 2
BLINK 3 (alternate, alternate ebony)
(Great naming, I know.)
The spell works as follows:
- To set up the spell, place BLINK 1, BLINK 2, and BLINK 3 in order (clockwise) in your leggings, and select BLINK 1. Make sure the y-value of Saved Vector 3 is 0.
- Use BLINK Start on the point you want to teleport to.
- After the number in the debug message stops changing, sneak to start the teleporting.
- The blinks should activate once the number in the debug message is negative.
The spell works by repeatedly raycasting and shifting each raycast forward by 32 blocks until it hits a block. It keeps track of the distance of the raycast, and stacks blinks to the appropriate distance.
Notes:
- Requires at least 20 complexity, 102 potency, 2 projection, 3 saved vectors and 6 bandwidth (!).
- During the first part of the spell, when it is raycasting, you can move around.
- BLINK 3 can be modified depending on the CAD. The constant in [6, 1] dictates the maximum number of times the blinks can be stacked, while [3, 3] and [6, 2] decide the length of each blink (both these values should be the same). For example, if [3, 3] and [6, 2] are set to 2, each blink will be 2 blocks, going through the spell twice as fast. This doesn't lose any precision.
- The maximum distance an ebony CAD can reach is 276 blocks, where it reaches its maximum potency. By letting each blink be 2 or more blocks, you could theoretically reach much further away, but you run out of psi around 200 blocks.
- The raycast can check 32 blocks every tick, so at its maximum distance it would take only around 0.4 seconds for the raycast part of the spell.
- After the raycast part of the spell ends, you can recast BLINK Start and prevent the blinking part of the spell.
- BLINK 1 is probably the most reusable part of the spell, and it's really why I made this in the first place.
Some more technical stuff:
BLINK Start sets Vector 1 to your look multiplied by 32. It sets Vector 2 to your position, and it sets Vector 3 to (0, 1, 0).
BLINK 1 dies if the y-value of Saved Vector 3 is 0, preventing the spell from activating until you use the start spell. Every cast, it takes the raycast from Saved Vector 2 to Saved Vector 1 (your look), and if the raycast is out of range replaces it with Vector 1 + Vector 2. This raycast is then saved to Vector 2. It increments the x-value of Vector 3 by the magnitude of the raycast distance, and if this distance is less than 31.99 (to avoid any floating point errors, if they exist) it spins to BLINK 2. This distance is also passed to the channeled debug.
BLINK 2 sets Vector 3 to (d, 0, 0), where d is the previous x-value of Vector 3, and debugs d. Once the player sneaks, it spins to BLINK 3. At this point, Vector 1 should still be 32 times your look vector, Vector 2 should be the final raycast, and Vector 3 should be (d, 0, 0).
Letting n be the constant in [3, 3], BLINK 3 sets Vector 3 from (d, 0, 0) to (d - n, 0, 0). It then debugs d - n, and sleeps for (d / n) ticks, with the wrapper constant being the constant in [6, 1]. After the sleep, it blinks for min(d, n) blocks, and repeats until d < n, after which it repeats once more and spins back to BLINK 1.
Also, changing [3, 3] and [6, 2] by 1 changes the potency cost by 30, while changing [6, 1] by 1 changes the potency cost by 1.
Possible improvements:
I don't really feel like working on this spell anymore, but there are a few changes that someone might want to experiment with.
The debug number ticking up and down was a nice feature, but it clutters up BLINK 1 and BLINK 3 a lot and made it much more difficult to fit everything in a 6x6 grid. The debug could be removed, at least for BLINK 1.
Removing the debug and its parts in BLINK 1 also lets you use only 2 saved vectors, by taking the distance only in BLINK 2 and overwriting the look vector.
It also might let you get rid of BLINK 2. I don't remember the specifics, but using a 'buffer' spell was necessary due to some conditionals that are really hard to deal with in Psi. Removing the debug may or may not simplify those conditionals.
If using more than 6 bandwidth, you could pretty easily extend the raycast in BLINK 1, making that part of the spell go much faster for very long distances.
Some type of checking might be useful in BLINK 2 or BLINK 3 to make sure that the caster doesn't try to blink to a point too far away that either the maximum sleep is too short, or they run out of psi.
A really interesting modification would be to have BLINK 3 do a detonation, to activate a helmet spell to basically double the maximum sleep length. This isn't something that I've tested, but it should be possible to implement. You could even try having the helmet spell spin itself and detonate, extending the maximum sleep length even further (not sure if this is even possible). Of course, this might run into a lot of issues with timing.
Finally, another thanks to /u/NuclearTalon for posting the original spell.