- Introduce MR_BACKTOLAIR to avoid ai code failures.
- Clear message bar before askobject() - Make towel code include certain small liquids on the ground (splash of water, blood, etc)
This commit is contained in:
parent
a23bedde10
commit
d381e8444c
2
ai.c
2
ai.c
|
@ -1885,6 +1885,8 @@ int ai_movement(lifeform_t *lf) {
|
|||
}
|
||||
} else if (f->val[2] == MR_SOUND) {
|
||||
// always ok.
|
||||
} else if (f->val[2] == MR_BACKTOLAIR) {
|
||||
// always ok.
|
||||
} else {
|
||||
// weird ?
|
||||
raise (SIGINT);
|
||||
|
|
5
data.c
5
data.c
|
@ -7291,6 +7291,7 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_DTVULN, DT_FIRE, NA, NA, "0d1+100");
|
||||
addflag(lastot->flags, F_FILLPOT, OT_POT_WATER, 5, NA, NULL);
|
||||
addflag(lastot->flags, F_COSMETIC, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_DRYABLE, W_DAMP, NA, NA, NULL);
|
||||
|
||||
addot(OT_MUDPOOL, "pool of mud", "A large puddle of wet mud.", MT_WATER, 60, OC_MISC, SZ_MEDIUM);
|
||||
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
|
||||
|
@ -7336,6 +7337,7 @@ void initobjects(void) {
|
|||
//addflag(lastot->flags, F_WALKDAM, DT_WATER, NA, NA, "0d1+1");
|
||||
addflag(lastot->flags, F_WALKDAMBP, BP_FEET, DT_WATER, FALLTHRU, "0d1+1");
|
||||
addflag(lastot->flags, F_SLIPPERY, 5, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_DRYABLE, W_WET, NA, NA, NULL);
|
||||
|
||||
addot(OT_PUDDLEWATERL, "large puddle of water", "A large pool of water.", MT_WATER, 20, OC_MISC, SZ_MEDIUM);
|
||||
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
|
||||
|
@ -7357,6 +7359,7 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_NOOBDIETEXT, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_FILLPOT, OT_POT_WATER, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_WALKDAMBP, BP_FEET, DT_WATER, FALLTHRU, "0d1+2");
|
||||
addflag(lastot->flags, F_DRYABLE, W_SOAKED, NA, NA, NULL);
|
||||
|
||||
addot(OT_BLOODSTAIN, "blood stain", "A dried stain of blood.", MT_BLOOD, 0, OC_MISC, SZ_MINI);
|
||||
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
|
||||
|
@ -7391,6 +7394,7 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_NOFEEL, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_PURIFIESTO, OT_SPLASHWATER, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_FILLPOT, OT_POT_BLOOD, 5, NA, NULL);
|
||||
addflag(lastot->flags, F_DRYABLE, W_DAMP, NA, NA, NULL);
|
||||
|
||||
addot(OT_BLOODPOOL, "pool of blood", "A large pool of blood.", MT_BLOOD, 0, OC_MISC, SZ_SMALL);
|
||||
addflag(lastot->flags, F_STACKABLE, B_TRUE, NA, NA, NULL);
|
||||
|
@ -7411,6 +7415,7 @@ void initobjects(void) {
|
|||
addflag(lastot->flags, F_NOFEEL, B_TRUE, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_PURIFIESTO, OT_PUDDLEWATERL, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_FILLPOT, OT_POT_BLOOD, NA, NA, NULL);
|
||||
addflag(lastot->flags, F_DRYABLE, W_SOAKED, NA, NA, NULL);
|
||||
|
||||
addot(OT_WOODPLANK, "plank of wood", "A large plank of heavy wood.", MT_WOOD, 25, OC_MISC, SZ_MEDIUM);
|
||||
addflag(lastot->flags, F_STACKABLE, NA, NA, NA, NULL);
|
||||
|
|
16
defs.h
16
defs.h
|
@ -110,6 +110,17 @@
|
|||
#define B_MAYBE (-2)
|
||||
#define B_ONEOF (-3)
|
||||
|
||||
|
||||
// askobject args
|
||||
#define B_DONTINCLUDENOTHING (0)
|
||||
#define B_INCLUDENOTHING (-1)
|
||||
#define B_DONTSHOWLONG (0)
|
||||
#define B_SHOWLONG (-1)
|
||||
#define B_NOTFORPICKUP (0)
|
||||
#define B_FORPICKUP (-1)
|
||||
#define B_DONTSHOWPOINTS (0)
|
||||
#define B_SHOWPOINTS (-1)
|
||||
|
||||
#define B_EQUIPPEDONLY (-1)
|
||||
#define B_ANY (0)
|
||||
|
||||
|
@ -3319,6 +3330,8 @@ enum FLAG {
|
|||
// if hurt by dt_fire, object id v0 will apepar under
|
||||
// them.
|
||||
// f->Text is what you are covered with (for desc)
|
||||
F_DRYABLE, // object can be soaked up using a towel
|
||||
// v0 = enum WETNESS
|
||||
F_CANGETWET, // object will get F_WET if hit by water
|
||||
// v0 = enum WETNESS. v1 = how long
|
||||
F_WATERPROOF, // object doesn't get wet. note: overrides CANGETWET!
|
||||
|
@ -3912,7 +3925,7 @@ enum FLAG {
|
|||
F_IGNORECELL, // won't accept targetcells of v0=x v1=y
|
||||
// this is cleared at start of turn.
|
||||
F_TARGETCELL, // lf will go towards this place. val0=x,val1=y
|
||||
// optional: v2 = mr_lf or mr_ob. text=lf or ob id.
|
||||
// optional: v2 = mr_lf, mr_ob, etc. text=lf or ob id.
|
||||
F_TURNSINPEACE, // v0 is a counter for how many turns this ai
|
||||
// mosnter has gone without being in battle.
|
||||
F_PHANTASM, // this lf is a phantasm - can deal no damage, and
|
||||
|
@ -4474,6 +4487,7 @@ enum MOVEREASON {
|
|||
MR_LF,
|
||||
MR_OB,
|
||||
MR_SOUND,
|
||||
MR_BACKTOLAIR,
|
||||
};
|
||||
|
||||
|
||||
|
|
2
io.c
2
io.c
|
@ -3638,6 +3638,8 @@ object_t *doaskobject(obpile_t *op, char *prompt, char *noobtext, int *count, in
|
|||
showlong ? "" : ",?=list",
|
||||
fullnumstring);
|
||||
|
||||
wclear(msgwin);
|
||||
wrefresh(msgwin);
|
||||
mvwprintw(mainwin, 0, 0, "%s", fullprompt);
|
||||
|
||||
if (defob) {
|
||||
|
|
2
nexus.c
2
nexus.c
|
@ -1677,7 +1677,7 @@ void initcondv(condset_t *cs, ...) {
|
|||
condition = va_arg(args, enum CELLCONDITION);
|
||||
while (condition != CC_NONE) {
|
||||
value = va_arg(args, int);
|
||||
assert((value == B_TRUE) || (value == B_FALSE));
|
||||
assert((value == B_TRUE) || (value == B_FALSE) || (value == B_ONEOF));
|
||||
arg = va_arg(args, int);
|
||||
addcond(cs, condition, value, arg);
|
||||
condition = va_arg(args, enum CELLCONDITION);
|
||||
|
|
89
objects.c
89
objects.c
|
@ -7638,6 +7638,9 @@ int getobwetness(object_t *o) {
|
|||
flag_t *wetflag;
|
||||
int count = 0;
|
||||
wetflag = hasflag(o->flags, F_WET);
|
||||
if (!wetflag) {
|
||||
wetflag = hasflag(o->flags, F_DRYABLE);
|
||||
}
|
||||
if (wetflag) {
|
||||
// towel will get slightly wetter.
|
||||
switch (wetflag->val[0]) {
|
||||
|
@ -9288,10 +9291,13 @@ void makewet(object_t *o, int amt) {
|
|||
char obnamefull[BUFLEN];
|
||||
flag_t *f;
|
||||
|
||||
|
||||
if (hasflag(o->flags, F_WATERPROOF)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (amt == W_DRY) return;
|
||||
|
||||
loc = getoblocation(o);
|
||||
owner = o->pile->owner;
|
||||
if (owner) {
|
||||
|
@ -10081,8 +10087,10 @@ int obmeets(object_t *o, condset_t *cs) {
|
|||
int noneof = 0;
|
||||
if (!cs) return B_TRUE;
|
||||
for (i = 0; i < cs->nconds; i++ ){
|
||||
// add to list of "one of these must match" conditions
|
||||
if (cs->val[i] == B_ONEOF) {
|
||||
found = B_FALSE;
|
||||
// alreay in the list?
|
||||
for (n = 0; n < noneof; n++) {
|
||||
if (oneof[n].cond == cs->cond[i]) {
|
||||
found = B_TRUE;
|
||||
|
@ -10091,6 +10099,7 @@ int obmeets(object_t *o, condset_t *cs) {
|
|||
if (!found) {
|
||||
oneof[noneof].cond = cs->cond[i];
|
||||
oneof[noneof].got = 0;
|
||||
noneof++;
|
||||
}
|
||||
}
|
||||
if (obmeetscondition(o, cs->cond[i], cs->arg[i], cs->val[i])) {
|
||||
|
@ -12209,6 +12218,8 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
|
|||
int count = 0;
|
||||
enum WETNESS howwet = W_DRY;
|
||||
char ch = 'n';
|
||||
object_t *oo = NULL;
|
||||
char obname2[BUFLEN];
|
||||
|
||||
if (hasflag(o->flags, F_WET)) {
|
||||
if (isplayer(lf)) {
|
||||
|
@ -12220,25 +12231,46 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
|
|||
|
||||
// what will we dry?
|
||||
if (isplayer(lf)) {
|
||||
if (hasobwithflag(lf->cell->obpile, F_WET)) {
|
||||
char buf[BUFLEN];
|
||||
snprintf(buf, BUFLEN, "There are wet objects here. Use your %s to dry one?", noprefix(obname));
|
||||
int nwet, ndryable;
|
||||
char buf[BUFLEN];
|
||||
nwet = countobswithflag(lf->cell->obpile, F_WET);
|
||||
ndryable = countobswithflag(lf->cell->obpile, F_DRYABLE);
|
||||
if (nwet + ndryable == 1) {
|
||||
// only one possibility
|
||||
if (nwet) {
|
||||
oo = hasobwithflag(lf->cell->obpile, F_WET);
|
||||
} else {
|
||||
oo = hasobwithflag(lf->cell->obpile, F_DRYABLE);
|
||||
}
|
||||
assert(oo);
|
||||
getobname(oo, obname2, oo->amt);
|
||||
snprintf(buf, BUFLEN, "There %s %s. Use your %s on %s?", OB1(oo, "is", "are"),
|
||||
obname2, noprefix(obname), OB1(oo,"it","them"));
|
||||
|
||||
ch = askchar(buf, "yn","n", B_TRUE, B_FALSE);
|
||||
} else if (nwet || ndryable) {
|
||||
snprintf(buf, BUFLEN, "There are wet objects here. Use your %s on them?", noprefix(obname));
|
||||
|
||||
ch = askchar(buf, "yn","n", B_TRUE, B_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (ch == 'y') {
|
||||
object_t *oo;
|
||||
if (!oo) {
|
||||
condset_t cs;
|
||||
initcondv(&cs, CC_HASFLAG, B_ONEOF, F_WET,
|
||||
CC_HASFLAG, B_ONEOF, F_DRYABLE,
|
||||
CC_NONE);
|
||||
|
||||
oo = doaskobject(lf->cell->obpile, "Dry off which object", "There are no wet objects here.", NULL,
|
||||
B_SHOWLONG, B_NOTFORPICKUP, B_DONTSHOWPOINTS, '\0', NULL, SA_NONE,
|
||||
&cs, B_INCLUDENOTHING);
|
||||
if (oo) {
|
||||
getobname(oo, obname2, oo->amt);
|
||||
}
|
||||
}
|
||||
|
||||
condset_t cs;
|
||||
initcondv(&cs, CC_HASFLAG, B_TRUE, F_WET,
|
||||
CC_NONE);
|
||||
oo = askobject(lf->cell->obpile, "Dry off which object", "There are no wet objects here.", NULL, '\0', &cs, B_TRUE);
|
||||
if (oo) {
|
||||
char obname2[BUFLEN];
|
||||
getobname(oo, obname2, oo->amt);
|
||||
|
||||
count = getobwetness(oo);
|
||||
if (!count) {
|
||||
if (isplayer(lf)) msg("%s doesn't need drying!", obname2);
|
||||
|
@ -12246,16 +12278,31 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
|
|||
}
|
||||
|
||||
// announce
|
||||
if (isplayer(lf)) {
|
||||
msg("You dry off %s with %s.", obname2, obname);
|
||||
} else if (cansee(player, lf)) {
|
||||
char lfname[BUFLEN];
|
||||
getlfname(lf, lfname);
|
||||
msg("%s dries off %s with %s.", lfname, obname2, obname);
|
||||
if (hasflag(oo->flags, F_DRYABLE)) {
|
||||
if (isplayer(lf)) {
|
||||
msg("You mop up %s with %s.", obname2, obname);
|
||||
} else if (cansee(player, lf)) {
|
||||
char lfname[BUFLEN];
|
||||
getlfname(lf, lfname);
|
||||
msg("%s mop up %s with %s.", lfname, obname2, obname);
|
||||
}
|
||||
} else {
|
||||
if (isplayer(lf)) {
|
||||
msg("You dry off %s with %s.", obname2, obname);
|
||||
} else if (cansee(player, lf)) {
|
||||
char lfname[BUFLEN];
|
||||
getlfname(lf, lfname);
|
||||
msg("%s dries off %s with %s.", lfname, obname2, obname);
|
||||
}
|
||||
}
|
||||
|
||||
// make it dry
|
||||
killflagsofid(oo->flags, F_WET);
|
||||
if (hasflag(oo->flags, F_DRYABLE)) {
|
||||
// mop it up completely
|
||||
killob(oo); oo = NULL;
|
||||
} else {
|
||||
// make it dry
|
||||
killflagsofid(oo->flags, F_WET);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (isplayer(lf)) msg("Cancelled.");
|
||||
|
@ -12292,7 +12339,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
|
|||
}
|
||||
}
|
||||
|
||||
// make the towel wet
|
||||
// make the towel wet (but it absorbs some of the moisture)
|
||||
count /= TM_WETTIME;
|
||||
|
||||
if (count >= (TM_WETTIME * TM_WETTIME)) {
|
||||
|
@ -12302,7 +12349,7 @@ int operate(lifeform_t *lf, object_t *o, cell_t *where) {
|
|||
} else if (count > 0) {
|
||||
howwet = W_DAMP;
|
||||
} else {
|
||||
howwet = W_DRY;
|
||||
howwet = W_DRY; // ie. do nothing
|
||||
}
|
||||
|
||||
makewet(o, howwet);
|
||||
|
|
Loading…
Reference in New Issue