Undid unspeaking of wave, fixed test again.

Changed property math to helper function.
This commit is contained in:
NHOrus 2017-07-03 00:47:17 +03:00
parent eeda78a210
commit 993194bd4d
3 changed files with 39 additions and 21 deletions

View file

@ -1086,45 +1086,51 @@ static int wake(token_t verb, token_t obj)
} }
} }
static token_t birdspeak(void)
{
switch (game.prop[BIRD]) {
case BIRD_UNCAGED:
case BIRD_FOREST_UNCAGED:
return FREE_FLY;
case BIRD_CAGED:
return CAGE_FLY;
}
}
static int wave(token_t verb, token_t obj) static int wave(token_t verb, token_t obj)
/* Wave. No effect unless waving rod at fissure or at bird. */ /* Wave. No effect unless waving rod at fissure or at bird. */
{ {
if ((!TOTING(obj)) && (obj != ROD || !TOTING(ROD2))) { int spk = actions[verb].message;
rspeak(ARENT_CARRYING); if ((!TOTING(obj)) && (obj != ROD || !TOTING(ROD2)))
return GO_CLEAROBJ; spk = ARENT_CARRYING;
}
if (obj != ROD || if (obj != ROD ||
!TOTING(obj) || !TOTING(obj) ||
(!HERE(BIRD) && (game.closng || !AT(FISSURE)))) { (!HERE(BIRD) && (game.closng || !AT(FISSURE)))) {
rspeak(actions[verb].message); rspeak(spk);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
if (game.prop[BIRD] == BIRD_UNCAGED && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
if (HERE(BIRD))
spk = birdspeak();
if (spk == FREE_FLY && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {
drop(JADE, game.loc); drop(JADE, game.loc);
game.prop[JADE] = 0; game.prop[JADE] = 0;
--game.tally; --game.tally;
rspeak(NECKLACE_FLY); spk = NECKLACE_FLY;
rspeak(spk);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} else { } else {
if (game.closed) { if (game.closed) {
rspeak(actions[verb].message); rspeak(spk);
return GO_DWARFWAKE; return GO_DWARFWAKE;
} }
if (game.closng || !AT(FISSURE)) { if (game.closng || !AT(FISSURE)) {
rspeak(actions[verb].message); rspeak(spk);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
if (HERE(BIRD)) { if (HERE(BIRD))
switch (game.prop[BIRD]) { rspeak(spk);
case BIRD_UNCAGED:
case BIRD_FOREST_UNCAGED:
rspeak(FREE_FLY);
break;
case BIRD_CAGED:
rspeak(CAGE_FLY);
break;
}
}
/* FIXME: Arithemetic on property values */ /* FIXME: Arithemetic on property values */
game.prop[FISSURE] = 1 - game.prop[FISSURE]; game.prop[FISSURE] = 1 - game.prop[FISSURE];
pspeak(FISSURE, look, 2 - game.prop[FISSURE], true); pspeak(FISSURE, look, 2 - game.prop[FISSURE], true);
@ -1132,6 +1138,8 @@ static int wave(token_t verb, token_t obj)
} }
} }
int action(struct command_t *command) int action(struct command_t *command)
/* Analyse a verb. Remember what it was, go back for object if second word /* Analyse a verb. Remember what it was, go back for object if second word
* unless verb is "say", which snarfs arbitrary second word. * unless verb is "say", which snarfs arbitrary second word.

View file

@ -179,12 +179,20 @@ OK
OK OK
> get rod
OK
> wave rod
The bird flies agitatedly about the cage.
> attack bird > attack bird
The little bird is now dead. Its body disappears. The little bird is now dead. Its body disappears.
You scored 30 out of a possible 430, using 30 turns. You scored 30 out of a possible 430, using 32 turns.
You are obviously a rank amateur. Better luck next time. You are obviously a rank amateur. Better luck next time.

View file

@ -33,4 +33,6 @@ y
y y
drop rod drop rod
take bird take bird
get rod
wave rod
attack bird attack bird