Kerkerkruip programming tutorials

Tutorial 6: The Tome of Sudden Death

Let’s have some fun. Tomes will be very rare, so we don’t need to worry about actually making things balanced, you know?

[code]A tome is a kind of thing.
The indefinite article of a tome is usually “the”.

The description of a tome is usually “Who knows what will happen if you decide to read this legendary work of magic?”[/code]
We’re not even telling the player what the item does, in decidedly non-Kerkerkruip fashion. That’s just an extra signal that tomes are meant for fun. And what could be more fun than reading something called the “Tome of Sudden Death” without knowing what it does? :wink: It’s not as bad as it sounds.

[code]The Tome of Sudden Death is a tome.
Tome of Sudden Death is paper.
Tome of Sudden Death is magical.

The sudden-death-boolean is a truth state that varies. Sudden-death-boolean is false.

Every turn when sudden-death-boolean is true:
repeat with guy running through alive persons:
now health of guy is 1.

Instead of reading the tome of sudden death:
say “Life is fragile. A single blow could kill a man.”;
remove tome of sudden death from play;
now sudden-death-boolean is true;
rule succeeds.[/code]
It is like the sudden death mode of a shooter: everyone gets one health, so every hit is fatal. That should certainly make for a unique game experience.

Tutorial 7: The Tome of the Brightest Flame

Our next tome is going to be an item that makes the player more or less invulnerable… but will kill her after 30 turns.

[code]Section - Tome of the Brightest Flame

The Tome of the Brightest Flame is a tome.
Tome of the Brightest Flame is paper.
Tome of the Brightest Flame is magical.

Brightest-flame-counter is a number that varies. Brightest-flame-counter is 0.

Instead of reading the tome of the brightest flame:
say “You have chosen fame over a long life. Achieve it while you may!”;
now hit protection of the player is 50;
now brightest-flame-counter is 31.[/code]
The only new thing here is the “hit protection” variable. It is defined in the section on the scroll of protection (in Kerkerkruip Items). Whenever you are hit by an attack, if your hit protection is greater than 0, you’ll take no damage at all and the hit protection decreases by 1. The scroll of protection grants an average hit protection of 1.4… and obviously, 50 is ridiculous.

But there are other sources of damage, like the fragmentation grenade and the squeezing tentacle. To counteract those, we’ll use a physical damage reduction rule. These rules should add a certain number to the global variable called ‘pdr’, with each point added to pdr counting as one point of negated damage.

A physical damage reduction rule (this is the brightest flame damage reduction rule): if the test subject is the player and brightest-flame-counter is not 0: increase the pdr by 100.
Now for the code that will kill (and warn) the player:

Every turn when brightest-flame-counter is not 0: if main actor is the player: decrease brightest-flame-counter by 1; if brightest-flame-counter is 30 or brightest-flame-counter is 20 or brightest-flame-counter is 10 or brightest-flame-counter is 5 or brightest-flame-counter is 1: say "You will [bold type]die[roman type] in [brightest-flame-counter] turn[unless brightest-flame-counter is 1]s[end if]!"; if brightest-flame-counter is 0: end the story saying "Your moment of fame has come and gone.".
That’s it! No, wait… we would like to have a special victory message here, because the player is still fated to die if she manages to kill Malygris. For such special occassions, we have the victory message rules:

Victory message rule (this is the brightest flame message rule): if brightest-flame-counter is not 0: end the story saying "You have destroyed your foe, and will be able to enjoy your victory for another [brightest-flame-counter] turns!"; rule succeeds.
That’s it. Reading this tome will send the player on a race to find and kill Malygris within 30 turns – which, being almost totally immune to any form of damage, shouldn’t be too hard.