Simplify code, improve test coverage.
This commit is contained in:
parent
9e1143e780
commit
6333544efb
5 changed files with 67 additions and 58 deletions
|
@ -21,9 +21,8 @@ static int attack(FILE *input, long verb, token_t obj)
|
||||||
* enemies, or no enemies but 2 others. */
|
* enemies, or no enemies but 2 others. */
|
||||||
{
|
{
|
||||||
int spk = ACTSPK[verb];
|
int spk = ACTSPK[verb];
|
||||||
int d = ATDWRF(game.loc);
|
if (obj == 0 || obj == INTRANSITIVE) {
|
||||||
if (obj == 0) {
|
if (ATDWRF(game.loc) > 0)
|
||||||
if (d > 0)
|
|
||||||
obj = DWARF;
|
obj = DWARF;
|
||||||
if (HERE(SNAKE))obj = obj * NOBJECTS + SNAKE;
|
if (HERE(SNAKE))obj = obj * NOBJECTS + SNAKE;
|
||||||
if (AT(DRAGON) && game.prop[DRAGON] == 0)obj = obj * NOBJECTS + DRAGON;
|
if (AT(DRAGON) && game.prop[DRAGON] == 0)obj = obj * NOBJECTS + DRAGON;
|
||||||
|
@ -65,7 +64,7 @@ static int attack(FILE *input, long verb, token_t obj)
|
||||||
if (obj == DRAGON)spk = ALREADY_DEAD;
|
if (obj == DRAGON)spk = ALREADY_DEAD;
|
||||||
if (obj == TROLL)spk = ROCKY_TROLL;
|
if (obj == TROLL)spk = ROCKY_TROLL;
|
||||||
if (obj == OGRE)spk = OGRE_DODGE;
|
if (obj == OGRE)spk = OGRE_DODGE;
|
||||||
if (obj == OGRE && d > 0) {
|
if (obj == OGRE && ATDWRF(game.loc) > 0) {
|
||||||
RSPEAK(spk);
|
RSPEAK(spk);
|
||||||
RSPEAK(KNIFE_THROWN);
|
RSPEAK(KNIFE_THROWN);
|
||||||
DESTROY(OGRE);
|
DESTROY(OGRE);
|
||||||
|
|
|
@ -31,17 +31,30 @@ Seed set to 1801426495
|
||||||
|
|
||||||
You're in front of building.
|
You're in front of building.
|
||||||
|
|
||||||
|
> stream
|
||||||
|
|
||||||
|
You are in a valley in the forest beside a stream tumbling along a
|
||||||
|
rocky bed.
|
||||||
|
|
||||||
|
> take water
|
||||||
|
|
||||||
|
You have nothing in which to carry it.
|
||||||
|
|
||||||
> cave
|
> cave
|
||||||
|
|
||||||
I don't know where the cave is, but hereabouts no stream can run on
|
I don't know where the cave is, but hereabouts no stream can run on
|
||||||
the surface for long. I would try the stream.
|
the surface for long. I would try the stream.
|
||||||
|
|
||||||
You're in front of building.
|
You're in valley.
|
||||||
|
|
||||||
> enter stream
|
> enter stream
|
||||||
|
|
||||||
Your feet are now wet.
|
Your feet are now wet.
|
||||||
|
|
||||||
|
> try three words
|
||||||
|
|
||||||
|
Please stick to 1- and 2-word commands.
|
||||||
|
|
||||||
> listen
|
> listen
|
||||||
|
|
||||||
The stream is gurgling placidly.
|
The stream is gurgling placidly.
|
||||||
|
@ -54,7 +67,7 @@ Carry what?
|
||||||
|
|
||||||
I am unsure how you are facing. Use compass points or nearby objects.
|
I am unsure how you are facing. Use compass points or nearby objects.
|
||||||
|
|
||||||
You're in front of building.
|
You're in valley.
|
||||||
|
|
||||||
> eat
|
> eat
|
||||||
|
|
||||||
|
@ -85,15 +98,10 @@ OK
|
||||||
|
|
||||||
> in
|
> in
|
||||||
|
|
||||||
You are inside a building, a well house for a large spring.
|
I don't know in from out here. Use compass points or name something
|
||||||
|
in the general direction you want to go.
|
||||||
|
|
||||||
There are some keys on the ground here.
|
You're in valley.
|
||||||
|
|
||||||
There is a shiny brass lamp nearby.
|
|
||||||
|
|
||||||
There is food here.
|
|
||||||
|
|
||||||
There is a bottle of water here.
|
|
||||||
|
|
||||||
> listen
|
> listen
|
||||||
|
|
||||||
|
@ -101,15 +109,16 @@ The stream is gurgling placidly.
|
||||||
|
|
||||||
> keys
|
> keys
|
||||||
|
|
||||||
What do you want to do with the keys?
|
I see no keys here.
|
||||||
|
|
||||||
> find keys
|
> find keys
|
||||||
|
|
||||||
I believe what you want is right here with you.
|
I can only tell you what you see as you move about and manipulate
|
||||||
|
things. I cannot tell you where remote things are.
|
||||||
|
|
||||||
> unlock keys
|
> unlock keys
|
||||||
|
|
||||||
You can't unlock the keys.
|
I see no keys here.
|
||||||
|
|
||||||
> find foo
|
> find foo
|
||||||
|
|
||||||
|
@ -129,11 +138,12 @@ Blasting requires dynamite.
|
||||||
|
|
||||||
> take bottle
|
> take bottle
|
||||||
|
|
||||||
OK
|
I see no bottl here.
|
||||||
|
|
||||||
> drink water
|
> drink water
|
||||||
|
|
||||||
The bottle of water is now empty.
|
You have taken a drink from the stream. The water tastes strongly of
|
||||||
|
minerals, but is not unpleasant. It is extremely cold.
|
||||||
|
|
||||||
> throw axe
|
> throw axe
|
||||||
|
|
||||||
|
@ -169,47 +179,47 @@ I see no urn here.
|
||||||
|
|
||||||
> eat keys
|
> eat keys
|
||||||
|
|
||||||
Don't be ridiculous!
|
I see no keys here.
|
||||||
|
|
||||||
> discard keys
|
> discard keys
|
||||||
|
|
||||||
You aren't carrying it!
|
I see no keys here.
|
||||||
|
|
||||||
> drink keys
|
> drink keys
|
||||||
|
|
||||||
Don't be ridiculous!
|
I see no keys here.
|
||||||
|
|
||||||
> off keys
|
> off keys
|
||||||
|
|
||||||
I'm afraid I don't understand.
|
I see no keys here.
|
||||||
|
|
||||||
> break keys
|
> break keys
|
||||||
|
|
||||||
It is beyond your power to do that.
|
I see no keys here.
|
||||||
|
|
||||||
> wake keys
|
> wake keys
|
||||||
|
|
||||||
Don't be ridiculous!
|
I see no keys here.
|
||||||
|
|
||||||
> take keys
|
> take keys
|
||||||
|
|
||||||
OK
|
I see no keys here.
|
||||||
|
|
||||||
> feed keys
|
> feed keys
|
||||||
|
|
||||||
I'm game. Would you care to explain how?
|
I see no keys here.
|
||||||
|
|
||||||
> fly keys
|
> fly keys
|
||||||
|
|
||||||
I'm game. Would you care to explain how?
|
I see no keys here.
|
||||||
|
|
||||||
> throw keys
|
> throw keys
|
||||||
|
|
||||||
OK
|
I see no keys here.
|
||||||
|
|
||||||
> eat food
|
> eat food
|
||||||
|
|
||||||
Thank you, it was delicious!
|
I see no food here.
|
||||||
|
|
||||||
> drink blood
|
> drink blood
|
||||||
|
|
||||||
|
@ -217,11 +227,11 @@ I see no blood here.
|
||||||
|
|
||||||
> drink keys
|
> drink keys
|
||||||
|
|
||||||
Don't be ridiculous!
|
I see no keys here.
|
||||||
|
|
||||||
> light keys
|
> light keys
|
||||||
|
|
||||||
I'm afraid I don't understand.
|
I see no keys here.
|
||||||
|
|
||||||
> brief
|
> brief
|
||||||
|
|
||||||
|
@ -234,43 +244,37 @@ Sorry, I don't know the word "FROB".
|
||||||
|
|
||||||
> read grate
|
> read grate
|
||||||
|
|
||||||
I'm afraid I don't understand.
|
You're in valley.
|
||||||
|
|
||||||
> grate
|
> grate
|
||||||
|
|
||||||
What do you want to do with the grate?
|
You're in valley.
|
||||||
|
|
||||||
> building
|
> building
|
||||||
|
|
||||||
I don't know how to apply that word here.
|
You're in front of building.
|
||||||
|
|
||||||
You're inside building.
|
|
||||||
|
|
||||||
There are some keys on the ground here.
|
|
||||||
|
|
||||||
There is a shiny brass lamp nearby.
|
|
||||||
|
|
||||||
> on
|
> on
|
||||||
|
|
||||||
Your lamp is now on.
|
On what?
|
||||||
|
|
||||||
> xyzzy
|
> xyzzy
|
||||||
|
|
||||||
>>Foof!<<
|
Nothing happens.
|
||||||
|
|
||||||
It is now pitch dark. If you proceed you will likely fall into a pit.
|
You're in front of building.
|
||||||
|
|
||||||
> take rod
|
> take rod
|
||||||
|
|
||||||
OK
|
I see no rod here.
|
||||||
|
|
||||||
> wave rod
|
> wave rod
|
||||||
|
|
||||||
Nothing happens.
|
I see no rod here.
|
||||||
|
|
||||||
> listen
|
> listen
|
||||||
|
|
||||||
All is silent.
|
The stream is gurgling placidly.
|
||||||
|
|
||||||
> quit
|
> quit
|
||||||
|
|
||||||
|
@ -286,7 +290,9 @@ Read what?
|
||||||
|
|
||||||
> look
|
> look
|
||||||
|
|
||||||
It is now pitch dark. If you proceed you will likely fall into a pit.
|
You are standing at the end of a road before a small brick building.
|
||||||
|
Around you is a forest. A small stream flows out of the building and
|
||||||
|
down a gully.
|
||||||
|
|
||||||
> news
|
> news
|
||||||
|
|
||||||
|
@ -302,13 +308,9 @@ game. Saved games are now stored in much smaller files than before.
|
||||||
|
|
||||||
> go back
|
> go back
|
||||||
|
|
||||||
>>Foof!<<
|
Sorry, but I no longer seem to remember how it was you got here.
|
||||||
|
|
||||||
You're inside building.
|
You're in front of building.
|
||||||
|
|
||||||
There are some keys on the ground here.
|
|
||||||
|
|
||||||
There is a lamp shining nearby.
|
|
||||||
|
|
||||||
> fuck
|
> fuck
|
||||||
|
|
||||||
|
@ -328,11 +330,11 @@ Okay, "BOO".
|
||||||
|
|
||||||
> score
|
> score
|
||||||
|
|
||||||
You have garnered 27 out of a possible 430 points, using 64 turns.
|
You have garnered 27 out of a possible 430 points, using 66 turns.
|
||||||
|
|
||||||
> quit keys
|
> quit keys
|
||||||
|
|
||||||
Huh?
|
I see no keys here.
|
||||||
|
|
||||||
> quit
|
> quit
|
||||||
|
|
||||||
|
@ -342,7 +344,7 @@ Do you really want to quit now?
|
||||||
|
|
||||||
OK
|
OK
|
||||||
|
|
||||||
You scored 27 out of a possible 430, using 66 turns.
|
You scored 27 out of a possible 430, using 68 turns.
|
||||||
|
|
||||||
You are obviously a rank amateur. Better luck next time.
|
You are obviously a rank amateur. Better luck next time.
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,11 @@
|
||||||
foo
|
foo
|
||||||
y
|
y
|
||||||
seed 1801426495
|
seed 1801426495
|
||||||
|
stream
|
||||||
|
take water
|
||||||
cave
|
cave
|
||||||
enter stream
|
enter stream
|
||||||
|
try three words
|
||||||
listen
|
listen
|
||||||
carry
|
carry
|
||||||
forward
|
forward
|
||||||
|
|
|
@ -140,12 +140,16 @@ I think I just lost my appetite.
|
||||||
It's not hungry (it's merely pinin' for the fjords). Besides, you
|
It's not hungry (it's merely pinin' for the fjords). Besides, you
|
||||||
have no bird seed.
|
have no bird seed.
|
||||||
|
|
||||||
|
> take bird
|
||||||
|
|
||||||
|
OK
|
||||||
|
|
||||||
> attack bird
|
> attack bird
|
||||||
|
|
||||||
The little bird is now dead. Its body disappears.
|
The little bird is now dead. Its body disappears.
|
||||||
|
|
||||||
|
|
||||||
You scored 32 out of a possible 430, using 25 turns.
|
You scored 32 out of a possible 430, using 26 turns.
|
||||||
|
|
||||||
You are obviously a rank amateur. Better luck next time.
|
You are obviously a rank amateur. Better luck next time.
|
||||||
|
|
||||||
|
|
|
@ -25,4 +25,5 @@ w
|
||||||
listen bird
|
listen bird
|
||||||
eat bird
|
eat bird
|
||||||
feed bird
|
feed bird
|
||||||
|
take bird
|
||||||
attack bird
|
attack bird
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue