1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-05 16:44:21 +03:00
inform7/resources/Documentation/Examples/Foosball.txt
2019-03-16 13:12:11 +00:00

113 lines
5.5 KiB
Plaintext

**** Every turn
(Every turn an opponent plays; Text Foosball)
A game of foosball which relies heavily on every-turn rules.
Suppose we want a game of foosball in which our opponent acts every turn, but does different things depending on where the ball currently lies. We can put together a sequence of every-turn rules to account for this, as follows:
{*}"Text Foosball"
Use scoring.
The Lounge is a room. "The Lounge is appointed with everything necessary to rest and relaxation: a vending machine, a potted palm, a stack of Entertainment Weekly issues from 1993, and -- your pride and joy -- a foosball game."
The foosball game is scenery in the Lounge. Understand "table" or "football" or "foozball" or "fussball" or "soccer" as the foosball game. The game is a supporter. On the game is a small white ball. The ball can be still, approaching, receding, or unreachable. The description of the ball is "Currently [small white ball condition]."
After printing the name of the small white ball, say " ([small white ball condition])".
When play begins:
now left hand status line is "You: [score]";
now right hand status line is "Joey: [Joey's score]".
Some tiny men on sticks are part of the game. Understand "handles" as the tiny men. The description is "Okay, a couple of the tiny men have had their feet broken off, and the table surface itself is a bit warped, and the ball resembles a quail egg in respect of shape and color. This makes for a game of unusual randomness, but skill is overrated."
Instead of attacking or pulling or pushing the game when the ball is unreachable:
say "You give the table a good shove, and the ball moves ever-so-slightly.";
now the ball is still.
Instead of taking the white ball:
say "You'd forfeit the game if you did that."
Instead of turning the tiny men when the ball is unreachable:
say "The ball has somehow gotten to a mystical point on the table where it cannot be reached, no matter what. Close inspection reveals that this point has been marked in chalk with a tiny X. Not that that does any good."
Instead of turning the tiny men when the ball is approaching:
if a random chance of 2 in 3 succeeds:
if a random chance of 1 in 2 succeeds, now the ball is receding;
otherwise now the ball is still;
say "[if the ball is still]Thunk. [otherwise]Thwack! [end if]You keep the ball from reaching its goal! Now it is [small white ball condition].";
otherwise:
let Joey score.
To let Joey score:
now the ball is still;
now Joey's score is Joey's score + 1;
say "The ball rolls neatly into your goal, despite your efforts. ";
if Joey's score < score, say "You put the ball back in the center with a snap. No reason to worry yet; you're still ahead. Joey looks determined, though.";
otherwise say "After allowing a moment or two for Joey's gloating to pass, you replace it at the center."
Instead of turning the tiny men when a random chance of 1 in 13 succeeds:
if the ball is unreachable, continue the action;
now the ball is unreachable;
say "You hit the ball off-center and it rolls sluggishly into a little dip in the surface of the foosball table. ";
if Joey's score > 7, say "'You did that on purpose!' Joey exclaims indignantly.";
otherwise say "You and Joey exchange glances. This is never good."
Instead of turning the tiny men:
say "You madly rotate the tiny men on sticks! ";
if a random chance of 1 in 2 succeeds:
say "Hoorah! You hit the ball!";
now the ball is receding;
otherwise:
say "Somehow you fail to bring your monopodal player into contact with the ball."
Joey is a man in the Lounge. "Joey is hunkered over the foosball handles on his side of the table." Joey can be active or inactive.
Joey's score is a number that varies.
Every turn: now Joey is active.
Every turn when the ball is approaching and Joey is active:
let total be Joey's score + score;
if total > 9, make no decision;
now Joey is inactive;
let Joey score;
rule succeeds.
Every turn when the ball is unreachable and Joey is active:
let total be Joey's score + score;
if total > 9, make no decision;
now Joey is inactive;
say "Joey glares angrily at the stuck ball."
Every turn when the ball is receding and Joey is active:
let total be Joey's score + score;
if total > 9, make no decision;
if the ball is unreachable, make no decision;
now Joey is inactive;
if a random chance of 1 in 2 succeeds:
if a random chance of 1 in 2 succeeds, now the ball is still;
otherwise now the ball is approaching;
say "Joey connects with your shot. Now the ball is [small white ball condition]!";
otherwise:
now the ball is still;
say "Joey tries to block, but misses! Back it goes in the center, where it is [small white ball condition].";
increment the score.
Every turn when the ball is still and Joey is active:
let total be Joey's score + score;
if total > 9, make no decision;
if the ball is unreachable, make no decision;
now Joey is inactive;
if a random chance of 1 in 2 succeeds:
now the ball is approaching;
say "Joey hits the ball solidly down towards your goal. Now it is [small white ball condition].";
otherwise:
say "Joey fails to hit the ball in your direction. It remains [small white ball condition]."
Every turn:
let total be Joey's score + score;
if total > 9:
if Joey's score > score, end the story saying "Rats! Joey wins!";
if Joey's score < score, end the story finally saying "Victory is yours!";
if Joey's score is score, end the story saying "A perfect tie."