kts.Necromancy

Name

kts.Necromancy – instantly raise nearby corpses as zombies

Synopsis

result = kts.Necromancy(max_zombies, max_range)

Description

If this is the first time that kts.Necromancy has been called this game, then all nearby tiles (within the given max_range of cxt.pos) are searched to see if they are able to be reanimated as zombies (or other monsters), according to the current zombie activity settings for the dungeon (see kts.SetZombieActivity). If any such tiles are found, then up to max_zombies of them (selected at random) are instantly reanimated as the corresponding monster type (meaning that the tile is removed and a new monster of the appropriate type is created in its place).

If this is the second or subsequent time that kts.Necromancy has been called this game, then nothing happens.

Return Value

This returns true if the necromancy effect actually took place, or false if it did not (e.g. because kts.Necromancy had already been called earlier this game).

Notes

"Distance" (for the purpose of max_range) is measured as the maximum of the horizontal or vertical distance from cxt.pos. For example, if cxt.pos is {x=5, y=5} and max_range is 2, then all tiles in the 5x5 square pattern from {x=3, y=3} to {x=7, y=7} (inclusive) will be considered for the necromancy effect.

Examples

The following call (assuming that it is the first kts.Necromancy call of the game) would consider all tiles within a distance of 5 from position cxt.pos (i.e. within the 11 x 11 square pattern centred on cxt.pos) and turn up to 10 of them into zombies according to the current zombie activity settings:

kts.Necromancy(10, 5)

As an example, if the current "zombie table" (2nd argument to kts.SetZombieActivity) is defined as follows:

{
    {tile1, tile2},
    {tile2, tile3},
    {tile3, m_zombie}
}

(where tile1, tile2 and tile3 are tiles depicting corpses in various states of decay, and m_zombie is the MonsterType corresponding to a zombie), then the Necromancy effect would look at that table, and conclude that any instance of tile1, tile2 or tile3 would be eligible for raising as a zombie (i.e. the m_zombie monster type). Up to 10 such tiles (from within the appropriate area of effect) would be randomly selected and instantly turned into zombies.

Note that the actual decay sequence (e.g. tile1 -> tile2 -> tile3 -> m_zombie in this example) is irrelevant; the Necromancy effect is only looking at the "end point" of the sequence (i.e. the monster type). So, for example, if a tile1 is selected for necromancy, then it just gets directly turned into a monster of type m_zombie, without having to go through the tile2 and tile3 stages first.

In the standard Knights Lua files, calling kts.Necromancy is one half of the effect of picking up the Necronomicon book; see items.lua. (The other half of the effect is to set kts.FullZombieActivity while the book is being carried.)

The Liche Tomb map layouts also typically have a large number of corpses either in the tomb itself, or just outside, meaning that any knight disturbing the Necronomicon from its resting place will likely find themselves surrounded by zombies very quickly!

See Also

The cxt table

kts.MonsterType

kts.FullZombieActivity

kts.NormalZombieActivity

kts.SetZombieActivity

kts.Tile