kts.Invulnerability – give current actor the Invulnerability effect
kts.Invulnerability(duration, message)
If the current actor (as given by cxt.actor
) is a knight, then that knight gains the Invulnerability magical effect, for the next duration
milliseconds. The string message
will also flash on screen above the knight a number of times.
If the knight already has Invulnerability, then the existing Invulnerability timer is cancelled and replaced with the new one.
If the current actor is not a knight then nothing happens.
None.
Invulnerability makes the knight immune to direct damage (such as weapon hits) and also prevents them from being killed by poison. However, invulnerable knights can still be paralyzed, and they can still be killed by effects such as falling down a pit or being turned into a zombie.
The duration (first argument to kts.Invulnerability
) is usually set to some kind of random number, to provide some unpredictability for the players. The duration value is not made visible to the player.
To give a knight Invulnerability for a random number of seconds between 1 and 60:
kts.Invulnerability(kts.RandomRange(1, 60) * 1000, "Invulnerability")
The actual game code uses a slightly more complicated method for determining the duration of potion effects; details can be found in magic.lua.