kts.Regeneration – give the current actor the Regeneration effect
kts.Regeneration(duration, message, speed)
Here, duration
is an integer; message
is a string; and speed
is either the string "fast"
or the string "slow"
.
If the current actor (as given by cxt.actor
) is a knight, then that knight gains the Regeneration magical effect, in either its "fast" or "slow" form (according to the speed
parameter). The effect lasts 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 a different incompatible magic effect (such as Strength or Quickness) then the other effect is cancelled in favour of Regeneration.
If the knight already has Regeneration, then the existing Regeneration effect is cancelled and replaced with the new one (with the duration timer being restarted from the present moment).
If the current actor is not a knight then nothing happens.
None.
Regeneration causes the knight to slowly regain lost hitpoints over time. There are two versions of the effect, "fast" and "slow" (and the player is able to distinguish these by a subtle difference in the Potion Bottle colour). If "fast" regeneration is in effect, the player will regain fast_regen_amount
hitpoints every fast_regen_time
milliseconds (these values are set in the kts.MISC_CONFIG table). If "slow" regeneration is in effect, then the corresponding slow_regen_amount
and slow_regen_time
values are used instead.
The duration (first argument to kts.Regeneration
) 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 a random Regeneration (either fast or slow) for a random number of seconds between 1 and 60:
local speed = "fast" if kts.RandomChance(0.5) then speed = "slow" end kts.Regeneration(kts.RandomRange(1, 60) * 1000, "Regeneration", speed)
The actual game code uses a slightly more complicated method for determining the duration of potion effects; details can be found in magic.lua.