Iron's Spells 'n Spellbooks

Iron's Spells 'n Spellbooks

18M Downloads

Channelled spells can target dead entities

MarioSMB opened this issue ยท 6 comments

commented

Observed behaviour

If the target of a channelled spell dies before channelling completes, the spell still casts anyway, consuming mana and putting the ability on cooldown.

Expected behaviour

Channelled target spells should cancel when the target dies to prevent wasting a spell cast.

Steps to reproduce

N/A

Server Type

Dedicated Server

Crashlog

No response

Iron's Spells N Spellbooks version

1.20.1-2.1.2

Forge version

47.2.17

Other mods

No response

commented

We will prevent dying entities from being able to be targeted, but cancelling a cast on a targeted entity's death is a complex operation that is not worth the fixing the edge case it presents, so I have no plans to implement it. Will mark issue as pending release for the former fix though.

commented

That's a shame, as it is a wasted cast especially when surrounded by enemies.
Are there no checks in place to tell when a channel should be cancelled, that a check for a dead target could be included in?

commented

The way to detect that would roughly be this:
Every time an entity dies, iterate over every server player, check if they are casting, check if their cast has a target, check if the target was the entity that was killed, and cancel the cast.

This is a very heavy operation that would patch a 10-tick window where something might've died.

commented

Indeed, that would be an expensive way to do it.
Looking at the code, some of the individual spells do some sanity checks during their tick logic, but there doesn't appear to be something like that for players (that I can see anyway), which is surprising - what does it do if the target completely disappears while casting?

commented

dying entities can no longer be targeted in 3.1.0

commented

Additionally to this it seems like dying enemies can be targeted.