mirror of
https://github.com/ganelson/inform.git
synced 2024-07-08 01:54:21 +03:00
46 lines
2.4 KiB
Plaintext
46 lines
2.4 KiB
Plaintext
Example: * Lanista 1
|
|
Location: Randomness
|
|
RecipeLocation: Combat and Death
|
|
Index: Lanista 1. Simple Randomised Combat
|
|
Description: Very simple randomised combat in which characters hit one another for a randomised amount of damage.
|
|
For: Z-Machine
|
|
|
|
{*}"Lanista, Part One"
|
|
|
|
The Arena is a room. "Sand, blood, iron. These festivals are normally held on hot days, but the sun has gone behind a cloud and fat drops of rain now and then spatter the arena floor." The gladiator is a man in the Arena. "A bare-chested Scythian gladiator faces you, wielding a trident."
|
|
|
|
We start by recording, for each person, a maximum number of points of damage the person can sustain when starting from health, and the current number of points remaining. In the tradition of role-playing games, these are referred to as hit points.
|
|
|
|
{**}A person has a number called maximum hit points. A person has a number called current hit points.
|
|
|
|
The maximum hit points of the player is 35. The maximum hit points of the gladiator is 25.
|
|
|
|
The current hit points of the player is 35. The current hit points of the gladiator is 25.
|
|
|
|
Now our rule for the actual attack. We want first to calculate how much damage the player's attack does, inflict that damage, and remove the enemy if they're dead; then, if still alive, the enemy counter-attacks, also for a randomised amount of damage, and if this kills the player, the game ends in defeat.
|
|
|
|
{**}Instead of attacking someone:
|
|
let the damage be a random number between 2 and 10;
|
|
say "You attack [the noun], causing [damage] points of damage!";
|
|
decrease the current hit points of the noun by the damage;
|
|
if the current hit points of the noun is less than 0:
|
|
say "[line break][The noun] expires, and is immediately carried away by the Arena slaves!";
|
|
now the noun is nowhere;
|
|
end the story finally;
|
|
stop the action;
|
|
let the enemy damage be a random number between 2 and 10;
|
|
say "[line break][The noun] attacks you, causing [enemy damage] points of damage!";
|
|
decrease the current hit points of the player by the enemy damage;
|
|
if the current hit points of the player is less than 0:
|
|
say "[line break]You expire!";
|
|
end the story.
|
|
|
|
This last bit is a refinement to help the player keep track of how the contest is going:
|
|
|
|
{**}When play begins:
|
|
now the left hand status line is "You: [current hit points of player]";
|
|
now the right hand status line is "Gladiator: [current hit points of gladiator]".
|
|
|
|
Test me with "hit gladiator / g / g / g".
|
|
|