Lanista 1
Simple Randomized Combat
Example 130
★"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 he's dead; then, if he doesn't die, the enemy counter-attacks, also for a randomized 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".
Test me with "hit gladiator / g / g / g".
Arena
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.
A bare-chested Scythian gladiator faces you, wielding a trident.
>(Testing.)
>[1] hit gladiator
You attack the gladiator, causing 2 points of damage!
The gladiator attacks you, causing 8 points of damage!
>[2] g
You attack the gladiator, causing 2 points of damage!
The gladiator attacks you, causing 9 points of damage!
>[3] g
You attack the gladiator, causing 4 points of damage!
The gladiator attacks you, causing 8 points of damage!
>[4] g
You attack the gladiator, causing 3 points of damage!
The gladiator attacks you, causing 7 points of damage!
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.
A bare-chested Scythian gladiator faces you, wielding a trident.
>(Testing.)
>[1] hit gladiator
You attack the gladiator, causing 2 points of damage!
The gladiator attacks you, causing 8 points of damage!
>[2] g
You attack the gladiator, causing 2 points of damage!
The gladiator attacks you, causing 9 points of damage!
>[3] g
You attack the gladiator, causing 4 points of damage!
The gladiator attacks you, causing 8 points of damage!
>[4] g
You attack the gladiator, causing 3 points of damage!
The gladiator attacks you, causing 7 points of damage!