tri_val_t finish_do_drink(obj_t *otmp, Boolean nothing, Boolean unkn) { Boolean go_on = false; if (!otmp) return NO_OP; // bug if that happens if (nothing) { unkn = true; message("You have a peculiar feeling for a moment, then it passes."); } if ((otmp->bitflags & O_IS_DESCKNOWN) && !BITTEST(oc_name_known, otmp->otype)) { if (!unkn) { BITSET(oc_name_known, otmp->otype);//objects[otmp->otyp].oc_name_known=1; more_experienced(0,10); } else if (!oc_has_uname(otmp->otype)) { // here's what I'll do instead of do_call/docall(otmp) : show_all_messages(); clone_for_call(otmp); // so we don't have to worry about useup! FrmPopupForm(EngraveForm); go_on = true; } } useup(otmp); if (go_on) return GO_ON; else return DONE; }
int doconsult(struct monst *oracl) { int umoney = money_cnt(invent); int u_pay, minor_cost = 50, major_cost = 500 + 50 * u.ulevel; int add_xpts; char qbuf[QBUFSZ]; multi = 0; if (!oracl) { pline("There is no one here to consult."); return 0; } else if (!oracl->mpeaceful) { pline("%s is in no mood for consultations.", Monnam(oracl)); return 0; } else if (!umoney) { pline("You have no money."); return 0; } sprintf(qbuf, "\"Wilt thou settle for a minor consultation?\" (%d %s)", minor_cost, currency(minor_cost)); switch (ynq(qbuf)) { default: case 'q': return 0; case 'y': if (umoney < minor_cost) { pline("You don't even have enough money for that!"); return 0; } u_pay = minor_cost; break; case 'n': if (umoney <= minor_cost || /* don't even ask */ (oracle_cnt == 1 || oracle_flg < 0)) return 0; sprintf(qbuf, "\"Then dost thou desire a major one?\" (%d %s)", major_cost, currency(major_cost)); if (yn(qbuf) != 'y') return 0; u_pay = (umoney < major_cost ? umoney : major_cost); break; } money2mon(oracl, u_pay); iflags.botl = 1; add_xpts = 0; /* first oracle of each type gives experience points */ if (u_pay == minor_cost) { outrumor(1, BY_ORACLE); if (!u.uevent.minor_oracle) add_xpts = u_pay / (u.uevent.major_oracle ? 25 : 10); /* 5 pts if very 1st, or 2 pts if major already done */ u.uevent.minor_oracle = TRUE; } else { boolean cheapskate = u_pay < major_cost; outoracle(cheapskate, TRUE); if (!cheapskate && !u.uevent.major_oracle) add_xpts = u_pay / (u.uevent.minor_oracle ? 25 : 10); /* ~100 pts if very 1st, ~40 pts if minor already done */ u.uevent.major_oracle = TRUE; historic_event(FALSE, "received advice from The Oracle."); exercise(A_WIS, !cheapskate); } if (add_xpts) { more_experienced(add_xpts, u_pay / 50); newexplevel(); } return 1; }
int doeat(void) { struct obj *otmp; int tmp; // Is there some food (probably a heavy corpse) here on the ground? if (!Levitation) for (otmp = _level->objects; otmp; otmp = otmp->nobj) { if (otmp->ox == _u.ux && otmp->oy == _u.uy && otmp->olet == FOOD_SYM) { pline("There %s %s here; eat %s? [ny] ", (otmp->quan == 1) ? "is" : "are", doname(otmp), (otmp->quan == 1) ? "it" : "one"); if (readchar() == 'y') { if (otmp->quan != 1) (void) splitobj(otmp, 1); freeobj(otmp); otmp = addinv(otmp); addtobill(otmp); goto gotit; } } } otmp = getobj("%", "eat"); if (!otmp) return 0; gotit: if (otmp->otyp == TIN) { if (uwep) { switch (uwep->otyp) { case CAN_OPENER: tmp = 1; break; case DAGGER: tmp = 3; break; case PICK_AXE: case AXE: tmp = 6; break; default: goto no_opener; } pline("Using your %s you try to open the tin.", aobjnam(uwep, NULL)); } else { no_opener: pline("It is not so easy to open this tin."); if (Glib) { pline("The tin slips out of your hands."); if (otmp->quan > 1) { struct obj *obj; obj = splitobj(otmp, 1); if (otmp == uwep) setuwep(obj); } dropx(otmp); return 1; } tmp = 10 + rn2(1 + 500 / ((int) (_u.ulevel + _u.ustr))); } tin.reqtime = tmp; tin.usedtime = 0; tin.tin = otmp; occupation = opentin; occtxt = "opening the tin"; return 1; } const struct objclass* ftmp = &c_Objects[otmp->otyp]; multi = -ftmp->oc_delay; if (otmp->otyp >= CORPSE && eatcorpse(otmp)) goto eatx; if (!rn2(7) && otmp->otyp != FORTUNE_COOKIE) { pline("Blecch! Rotten food!"); if (!rn2(4)) { pline("You feel rather light headed."); Confusion += d(2, 4); } else if (!rn2(4) && !Blind) { pline("Everything suddenly goes dark."); Blind = d(2, 10); seeoff(0); } else if (!rn2(3)) { if (Blind) pline("The world spins and you slap against the floor."); else pline("The world spins and goes dark."); nomul(-rnd(10)); nomovemsg = "You are conscious again."; } lesshungry(ftmp->nutrition / 4); } else { if (_u.uhunger >= 1500) { pline("You choke over your food."); pline("You die..."); killer = ftmp->oc_name; done("choked"); } switch (otmp->otyp) { case FOOD_RATION: if (_u.uhunger <= 200) pline("That food really hit the spot!"); else if (_u.uhunger <= 700) pline("That satiated your stomach!"); else { pline("You're having a hard time getting all that food down."); multi -= 2; } lesshungry(ftmp->nutrition); if (multi < 0) nomovemsg = "You finished your meal."; break; case TRIPE_RATION: pline("Yak - dog food!"); more_experienced(1, 0); _wflags.botl = 1; if (rn2(2)) { pline("You vomit."); morehungry(20); if (Sick) { Sick = 0; // David Neves pline("What a relief!"); } } else lesshungry(ftmp->nutrition); break; default: if (otmp->otyp >= CORPSE) pline("That %s tasted terrible!", ftmp->oc_name); else pline("That %s was delicious!", ftmp->oc_name); lesshungry(ftmp->nutrition); if (otmp->otyp == DEAD_LIZARD && (Confusion > 2)) Confusion = 2; else if (otmp->otyp == FORTUNE_COOKIE) { if (Blind) { pline("This cookie has a scrap of paper inside!"); pline("What a pity, that you cannot read it!"); } else print_rumor(); } else if (otmp->otyp == LUMP_OF_ROYAL_JELLY) { // This stuff seems to be VERY healthy! if (_u.ustrmax < 118) ++_u.ustrmax; if (_u.ustr < _u.ustrmax) ++_u.ustr; _u.uhp += rnd(20); if (_u.uhp > _u.uhpmax) { if (!rn2(17)) ++_u.uhpmax; _u.uhp = _u.uhpmax; } heal_legs(); } break; } } eatx: if (multi < 0 && !nomovemsg) { static char msgbuf[BUFSZ]; sprintf(msgbuf, "You finished eating the %s.", ftmp->oc_name); nomovemsg = msgbuf; } useup(otmp); return 1; }
/* return 1 if action took 1 (or more) moves, 0 if error or aborted */ int doengrave(struct obj *otmp) { boolean dengr = FALSE; /* TRUE if we wipe out the current engraving */ boolean doblind = FALSE;/* TRUE if engraving blinds the player */ boolean doknown = FALSE;/* TRUE if we identify the stylus */ boolean eow = FALSE; /* TRUE if we are overwriting oep */ boolean jello = FALSE; /* TRUE if we are engraving in slime */ boolean ptext = TRUE; /* TRUE if we must prompt for engrave text */ boolean teleengr =FALSE;/* TRUE if we move the old engraving */ boolean zapwand = FALSE;/* TRUE if we remove a wand charge */ xchar type = DUST; /* Type of engraving made */ char buf[BUFSZ]; /* Buffer for final/poly engraving text */ char ebuf[BUFSZ]; /* Buffer for initial engraving text */ char qbuf[QBUFSZ]; /* Buffer for query text */ char post_engr_text[BUFSZ]; /* Text displayed after engraving prompt */ const char *everb; /* Present tense of engraving type */ const char *eloc; /* Where the engraving is (ie dust/floor/...) */ char *sp; /* Place holder for space count of engr text */ int len; /* # of nonspace chars of new engraving text */ int maxelen; /* Max allowable length of engraving text */ struct engr *oep = engr_at(level, u.ux,u.uy); /* The current engraving */ char *writer; multi = 0; /* moves consumed */ nomovemsg = NULL; /* occupation end message */ buf[0] = (char)0; ebuf[0] = (char)0; post_engr_text[0] = (char)0; maxelen = BUFSZ - 1; if (is_demon(youmonst.data) || youmonst.data->mlet == S_VAMPIRE) type = ENGR_BLOOD; /* Can the adventurer engrave at all? */ if (u.uswallow) { if (is_animal(u.ustuck->data)) { pline("What would you write? \"Jonah was here\"?"); return 0; } else if (is_whirly(u.ustuck->data)) { pline("You can't reach the %s.", surface(u.ux,u.uy)); return 0; } else jello = TRUE; } else if (is_lava(level, u.ux, u.uy)) { pline("You can't write on the lava!"); return 0; } else if (Underwater) { pline("You can't write underwater!"); return 0; } else if (is_pool(level, u.ux,u.uy) || IS_FOUNTAIN(level->locations[u.ux][u.uy].typ)) { pline("You can't write on the water!"); return 0; } if (Is_airlevel(&u.uz) || Is_waterlevel(&u.uz)/* in bubble */) { pline("You can't write in thin air!"); return 0; } if (cantwield(youmonst.data)) { pline("You can't even hold anything!"); return 0; } if (check_capacity(NULL)) return 0; /* One may write with finger, or weapon, or wand, or..., or... * Edited by GAN 10/20/86 so as not to change weapon wielded. */ if (otmp && !validate_object(otmp, styluses, "write with")) return 0; else if (!otmp) otmp = getobj(styluses, "write with"); if (!otmp) return 0; /* otmp == zeroobj if fingers */ if (otmp == &zeroobj) writer = makeplural(body_part(FINGER)); else writer = xname(otmp); /* There's no reason you should be able to write with a wand * while both your hands are tied up. */ if (!freehand() && otmp != uwep && !otmp->owornmask) { pline("You have no free %s to write with!", body_part(HAND)); return 0; } if (jello) { pline("You tickle %s with your %s.", mon_nam(u.ustuck), writer); pline("Your message dissolves..."); return 0; } if (otmp->oclass != WAND_CLASS && !can_reach_floor()) { pline("You can't reach the %s!", surface(u.ux,u.uy)); return 0; } if (IS_ALTAR(level->locations[u.ux][u.uy].typ)) { pline("You make a motion towards the altar with your %s.", writer); altar_wrath(u.ux, u.uy); return 0; } if (IS_GRAVE(level->locations[u.ux][u.uy].typ)) { if (otmp == &zeroobj) { /* using only finger */ pline("You would only make a small smudge on the %s.", surface(u.ux, u.uy)); return 0; } else if (!level->locations[u.ux][u.uy].disturbed) { pline("You disturb the undead!"); level->locations[u.ux][u.uy].disturbed = 1; makemon(&mons[PM_GHOUL], level, u.ux, u.uy, NO_MM_FLAGS); exercise(A_WIS, FALSE); return 1; } } /* SPFX for items */ switch (otmp->oclass) { default: case AMULET_CLASS: case CHAIN_CLASS: case POTION_CLASS: case COIN_CLASS: break; case RING_CLASS: /* "diamond" rings and others should work */ case GEM_CLASS: /* diamonds & other hard gems should work */ if (objects[otmp->otyp].oc_tough) { type = ENGRAVE; break; } break; case ARMOR_CLASS: if (is_boots(otmp)) { type = DUST; break; } /* fall through */ /* Objects too large to engrave with */ case BALL_CLASS: case ROCK_CLASS: pline("You can't engrave with such a large object!"); ptext = FALSE; break; /* Objects too silly to engrave with */ case FOOD_CLASS: case SCROLL_CLASS: case SPBOOK_CLASS: pline("Your %s would get %s.", xname(otmp), is_ice(level, u.ux, u.uy) ? "all frosty" : "too dirty"); ptext = FALSE; break; case RANDOM_CLASS: /* This should mean fingers */ break; /* The charge is removed from the wand before prompting for * the engraving text, because all kinds of setup decisions * and pre-engraving messages are based upon knowing what type * of engraving the wand is going to do. Also, the player * will have potentially seen "You wrest .." message, and * therefore will know they are using a charge. */ case WAND_CLASS: if (zappable(otmp)) { check_unpaid(otmp); zapwand = TRUE; if (Levitation) ptext = FALSE; switch (otmp->otyp) { /* DUST wands */ default: break; /* NODIR wands */ case WAN_LIGHT: case WAN_SECRET_DOOR_DETECTION: case WAN_CREATE_MONSTER: case WAN_WISHING: case WAN_ENLIGHTENMENT: zapnodir(otmp); break; /* IMMEDIATE wands */ /* If wand is "IMMEDIATE", remember to affect the * previous engraving even if turning to dust. */ case WAN_STRIKING: strcpy(post_engr_text, "The wand unsuccessfully fights your attempt to write!" ); break; case WAN_SLOW_MONSTER: if (!Blind) { sprintf(post_engr_text, "The bugs on the %s slow down!", surface(u.ux, u.uy)); } break; case WAN_SPEED_MONSTER: if (!Blind) { sprintf(post_engr_text, "The bugs on the %s speed up!", surface(u.ux, u.uy)); } break; case WAN_POLYMORPH: if (oep) { if (!Blind) { type = (xchar)0; /* random */ random_engraving(buf); } dengr = TRUE; } break; case WAN_NOTHING: case WAN_UNDEAD_TURNING: case WAN_OPENING: case WAN_LOCKING: case WAN_PROBING: break; /* RAY wands */ case WAN_MAGIC_MISSILE: ptext = TRUE; if (!Blind) { sprintf(post_engr_text, "The %s is riddled by bullet holes!", surface(u.ux, u.uy)); } break; /* can't tell sleep from death - Eric Backus */ case WAN_SLEEP: case WAN_DEATH: if (!Blind) { sprintf(post_engr_text, "The bugs on the %s stop moving!", surface(u.ux, u.uy)); } break; case WAN_COLD: if (!Blind) strcpy(post_engr_text, "A few ice cubes drop from the wand."); if (!oep || (oep->engr_type != BURN)) break; case WAN_CANCELLATION: case WAN_MAKE_INVISIBLE: if (oep && oep->engr_type != HEADSTONE) { if (!Blind) pline("The engraving on the %s vanishes!", surface(u.ux,u.uy)); dengr = TRUE; } break; case WAN_TELEPORTATION: if (oep && oep->engr_type != HEADSTONE) { if (!Blind) pline("The engraving on the %s vanishes!", surface(u.ux,u.uy)); teleengr = TRUE; } break; /* type = ENGRAVE wands */ case WAN_DIGGING: ptext = TRUE; type = ENGRAVE; if (!objects[otmp->otyp].oc_name_known) { if (flags.verbose) pline("This %s is a wand of digging!", xname(otmp)); doknown = TRUE; } if (!Blind) strcpy(post_engr_text, IS_GRAVE(level->locations[u.ux][u.uy].typ) ? "Chips fly out from the headstone." : is_ice(level, u.ux, u.uy) ? "Ice chips fly up from the ice surface!" : "Gravel flies up from the floor."); else strcpy(post_engr_text, "You hear drilling!"); break; /* type = BURN wands */ case WAN_FIRE: ptext = TRUE; type = BURN; if (!objects[otmp->otyp].oc_name_known) { if (flags.verbose) pline("This %s is a wand of fire!", xname(otmp)); doknown = TRUE; } strcpy(post_engr_text, Blind ? "You feel the wand heat up." : "Flames fly from the wand."); break; case WAN_LIGHTNING: ptext = TRUE; type = BURN; if (!objects[otmp->otyp].oc_name_known) { if (flags.verbose) pline("This %s is a wand of lightning!", xname(otmp)); doknown = TRUE; } if (!Blind) { strcpy(post_engr_text, "Lightning arcs from the wand."); doblind = TRUE; } else strcpy(post_engr_text, "You hear crackling!"); break; /* type = MARK wands */ /* type = ENGR_BLOOD wands */ } } else /* end if zappable */ if (!can_reach_floor()) { pline("You can't reach the %s!", surface(u.ux,u.uy)); /* If it's a wrestable wand, the player wasted a turn trying. */ if (wrestable(otmp)) return 1; else return 0; } break; case WEAPON_CLASS: if (is_blade(otmp)) { if ((int)otmp->spe > -3) type = ENGRAVE; else pline("Your %s too dull for engraving.", aobjnam(otmp,"are")); } break; case TOOL_CLASS: if (otmp == ublindf) { pline( "That is a bit difficult to engrave with, don't you think?"); return 0; } switch (otmp->otyp) { case MAGIC_MARKER: if (otmp->spe <= 0) pline("Your marker has dried out."); else type = MARK; break; case TOWEL: /* Can't really engrave with a towel */ ptext = FALSE; if (oep) if ((oep->engr_type == DUST ) || (oep->engr_type == ENGR_BLOOD) || (oep->engr_type == MARK )) { if (!Blind) pline("You wipe out the message here."); else pline("Your %s %s %s.", xname(otmp), otense(otmp, "get"), is_ice(level, u.ux, u.uy) ? "frosty" : "dusty"); dengr = TRUE; } else pline("Your %s can't wipe out this engraving.", xname(otmp)); else pline("Your %s %s %s.", xname(otmp), otense(otmp, "get"), is_ice(level, u.ux, u.uy) ? "frosty" : "dusty"); break; default: break; } break; case VENOM_CLASS: if (wizard) { pline("Writing a poison pen letter??"); break; } case ILLOBJ_CLASS: impossible("You're engraving with an illegal object!"); break; } if (IS_GRAVE(level->locations[u.ux][u.uy].typ)) { if (type == ENGRAVE || type == 0) type = HEADSTONE; else { /* ensures the "cannot wipe out" case */ type = DUST; dengr = FALSE; teleengr = FALSE; buf[0] = (char)0; } } /* End of implement setup */ /* Identify stylus */ if (doknown) { makeknown(otmp->otyp); more_experienced(0,10); } if (teleengr) { rloc_engr(oep); oep = NULL; } if (dengr) { del_engr(oep, level); oep = NULL; } /* Something has changed the engraving here */ if (*buf) { make_engr_at(level, u.ux, u.uy, buf, moves, type); pline("The engraving now reads: \"%s\".", buf); ptext = FALSE; } if (zapwand && (otmp->spe < 0)) { pline("%s %sturns to dust.", The(xname(otmp)), Blind ? "" : "glows violently, then "); if (!IS_GRAVE(level->locations[u.ux][u.uy].typ)) pline("You are not going to get anywhere trying to write in the %s with your dust.", is_ice(level, u.ux, u.uy) ? "frost" : "dust"); useup(otmp); ptext = FALSE; } if (!ptext) { /* Early exit for some implements. */ if (otmp->oclass == WAND_CLASS && !can_reach_floor()) pline("You can't reach the %s!", surface(u.ux,u.uy)); return 1; } /* Special effects should have deleted the current engraving (if * possible) by now. */ if (oep) { char c = 'n'; /* Give player the choice to add to engraving. */ if (type == HEADSTONE) { /* no choice, only append */ c = 'y'; } else if ( (type == oep->engr_type) && (!Blind || (oep->engr_type == BURN) || (oep->engr_type == ENGRAVE)) ) { c = yn_function("Do you want to add to the current engraving?", ynqchars, 'y'); if (c == 'q') { pline("Never mind."); return 0; } } if (c == 'n' || Blind) { if ( (oep->engr_type == DUST) || (oep->engr_type == ENGR_BLOOD) || (oep->engr_type == MARK) ) { if (!Blind) { pline("You wipe out the message that was %s here.", ((oep->engr_type == DUST) ? "written in the dust" : ((oep->engr_type == ENGR_BLOOD) ? "scrawled in blood" : "written"))); del_engr(oep, level); oep = NULL; } else /* Don't delete engr until after we *know* we're engraving */ eow = TRUE; } else if ( (type == DUST) || (type == MARK) || (type == ENGR_BLOOD) ) { pline( "You cannot wipe out the message that is %s the %s here.", oep->engr_type == BURN ? (is_ice(level, u.ux, u.uy) ? "melted into" : "burned into") : "engraved in", surface(u.ux,u.uy)); return 1; } else if ( (type != oep->engr_type) || (c == 'n') ) { if (!Blind || can_reach_floor()) pline("You will overwrite the current message."); eow = TRUE; } } } eloc = surface(u.ux,u.uy); switch(type){ default: everb = (oep && !eow ? "add to the weird writing on" : "write strangely on"); break; case DUST: everb = (oep && !eow ? "add to the writing in" : "write in"); eloc = is_ice(level, u.ux, u.uy) ? "frost" : "dust"; break; case HEADSTONE: everb = (oep && !eow ? "add to the epitaph on" : "engrave on"); break; case ENGRAVE: everb = (oep && !eow ? "add to the engraving in" : "engrave in"); break; case BURN: everb = (oep && !eow ? ( is_ice(level, u.ux,u.uy) ? "add to the text melted into" : "add to the text burned into") : ( is_ice(level, u.ux,u.uy) ? "melt into" : "burn into")); break; case MARK: everb = (oep && !eow ? "add to the graffiti on" : "scribble on"); break; case ENGR_BLOOD: everb = (oep && !eow ? "add to the scrawl on" : "scrawl on"); break; } /* Tell adventurer what is going on */ if (otmp != &zeroobj) pline("You %s the %s with %s.", everb, eloc, doname(otmp)); else pline("You %s the %s with your %s.", everb, eloc, makeplural(body_part(FINGER))); /* Prompt for engraving! */ sprintf(qbuf,"What do you want to %s the %s here?", everb, eloc); getlin(qbuf, ebuf); /* Count the actual # of chars engraved not including spaces */ len = strlen(ebuf); for (sp = ebuf; *sp; sp++) if (isspace(*sp)) len -= 1; if (len == 0 || strchr(ebuf, '\033')) { if (zapwand) { if (!Blind) pline("%s, then %s.", Tobjnam(otmp, "glow"), otense(otmp, "fade")); return 1; } else { pline("Never mind."); if (otmp && otmp->oclass == WAND_CLASS && wrestable(otmp)) return 1; /* disallow zero turn wrest */ else return 0; } } /* A single `x' is the traditional signature of an illiterate person */ if (len != 1 || (!strchr(ebuf, 'x') && !strchr(ebuf, 'X'))) u.uconduct.literate++; /* Mix up engraving if surface or state of mind is unsound. Note: this won't add or remove any spaces. */ for (sp = ebuf; *sp; sp++) { if (isspace(*sp)) continue; if (((type == DUST || type == ENGR_BLOOD) && !rn2(25)) || (Blind && !rn2(11)) || (Confusion && !rn2(7)) || (Stunned && !rn2(4)) || (Hallucination && !rn2(2))) *sp = ' ' + rnd(96 - 2); /* ASCII '!' thru '~' (excludes ' ' and DEL) */ } /* Previous engraving is overwritten */ if (eow) { del_engr(oep, level); oep = NULL; } /* Figure out how long it took to engrave, and if player has * engraved too much. */ switch(type){ default: multi = -(len/10); if (multi) nomovemsg = "You finish your weird engraving."; break; case DUST: multi = -(len/10); if (multi) nomovemsg = "You finish writing in the dust."; break; case HEADSTONE: case ENGRAVE: multi = -(len/10); if ((otmp->oclass == WEAPON_CLASS) && ((otmp->otyp != ATHAME) || otmp->cursed)) { multi = -len; maxelen = ((otmp->spe + 3) * 2) + 1; /* -2 = 3, -1 = 5, 0 = 7, +1 = 9, +2 = 11 * Note: this does not allow a +0 anything (except * an athame) to engrave "Elbereth" all at once. * However, you could now engrave "Elb", then * "ere", then "th". */ pline("Your %s dull.", aobjnam(otmp, "get")); if (otmp->unpaid) { struct monst *shkp = shop_keeper(level, *u.ushops); if (shkp) { pline("You damage it, you pay for it!"); bill_dummy_object(otmp); } } if (len > maxelen) { multi = -maxelen; otmp->spe = -3; } else if (len > 1) otmp->spe -= len >> 1; else otmp->spe -= 1; /* Prevent infinite engraving */ } else
int dodrink() { struct obj *otmp,*objs; struct monst *mtmp; int unkn = 0, nothing = 0; otmp = getobj("!", "drink"); if(!otmp) return(0); if(!strcmp(objects[otmp->otyp].oc_descr, "smoky") && !rn2(13)) { ghost_from_bottle(); goto use_it; } switch(otmp->otyp){ case POT_RESTORE_STRENGTH: unkn++; pline("Wow! This makes you feel great!"); if(u.ustr < u.ustrmax) { u.ustr = u.ustrmax; flags.botl = 1; } break; case POT_BOOZE: unkn++; pline("Ooph! This tastes like liquid fire!"); Confusion += d(3,8); /* the whiskey makes us feel better */ if(u.uhp < u.uhpmax) losehp(-1, "bottle of whiskey"); if(!rn2(4)) { pline("You pass out."); multi = -rnd(15); nomovemsg = "You awake with a headache."; } break; case POT_INVISIBILITY: if(Invis || See_invisible) nothing++; else { if(!Blind) pline("Gee! All of a sudden, you can't see yourself."); else pline("You feel rather airy."), unkn++; newsym(u.ux,u.uy); } Invis += rn1(15,31); break; case POT_FRUIT_JUICE: pline("This tastes like fruit juice."); lesshungry(20); break; case POT_HEALING: pline("You begin to feel better."); flags.botl = 1; u.uhp += rnd(10); if(u.uhp > u.uhpmax) u.uhp = ++u.uhpmax; if(Blind) Blind = 1; /* see on next move */ if(Sick) Sick = 0; break; case POT_PARALYSIS: if(Levitation) pline("You are motionlessly suspended."); else pline("Your feet are frozen to the floor!"); nomul(-(rn1(10,25))); break; case POT_MONSTER_DETECTION: if(!fmon) { strange_feeling(otmp, "You feel threatened."); return(1); } else { cls(); for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) if(mtmp->mx > 0) at(mtmp->mx,mtmp->my,mtmp->data->mlet); prme(); pline("You sense the presence of monsters."); more(); docrt(); } break; case POT_OBJECT_DETECTION: if(!fobj) { strange_feeling(otmp, "You feel a pull downward."); return(1); } else { for(objs = fobj; objs; objs = objs->nobj) if(objs->ox != u.ux || objs->oy != u.uy) goto outobjmap; pline("You sense the presence of objects close nearby."); break; outobjmap: cls(); for(objs = fobj; objs; objs = objs->nobj) at(objs->ox,objs->oy,objs->olet); prme(); pline("You sense the presence of objects."); more(); docrt(); } break; case POT_SICKNESS: pline("Yech! This stuff tastes like poison."); if(Poison_resistance) pline("(But in fact it was biologically contaminated orange juice.)"); losestr(rn1(4,3)); losehp(rnd(10), "contaminated potion"); break; case POT_CONFUSION: if(!Confusion) pline("Huh, What? Where am I?"); else nothing++; Confusion += rn1(7,16); break; case POT_GAIN_STRENGTH: pline("Wow do you feel strong!"); if(u.ustr >= 118) break; /* > 118 is impossible */ if(u.ustr > 17) u.ustr += rnd(118-u.ustr); else u.ustr++; if(u.ustr > u.ustrmax) u.ustrmax = u.ustr; flags.botl = 1; break; case POT_SPEED: if(Wounded_legs) { heal_legs(); unkn++; break; } if(!(Fast & ~INTRINSIC)) pline("You are suddenly moving much faster."); else pline("Your legs get new energy."), unkn++; Fast += rn1(10,100); break; case POT_BLINDNESS: if(!Blind) pline("A cloud of darkness falls upon you."); else nothing++; Blind += rn1(100,250); seeoff(0); break; case POT_GAIN_LEVEL: pluslvl(); break; case POT_EXTRA_HEALING: pline("You feel much better."); flags.botl = 1; u.uhp += d(2,20)+1; if(u.uhp > u.uhpmax) u.uhp = (u.uhpmax += 2); if(Blind) Blind = 1; if(Sick) Sick = 0; break; case POT_LEVITATION: if(!Levitation) float_up(); else nothing++; Levitation += rnd(100); u.uprops[PROP(RIN_LEVITATION)].p_tofn = float_down; break; default: impossible("What a funny potion! (%u)", otmp->otyp); return(0); } if(nothing) { unkn++; pline("You have a peculiar feeling for a moment, then it passes."); } if(otmp->dknown && !objects[otmp->otyp].oc_name_known) { if(!unkn) { objects[otmp->otyp].oc_name_known = 1; more_experienced(0,10); } else if(!objects[otmp->otyp].oc_uname) docall(otmp); } use_it: useup(otmp); return(1); }
int doconsult(struct monst *oracl) { int umoney = money_cnt(invent); int u_pay, minor_cost = 50, major_cost = 500 + 50 * u.ulevel; int add_xpts; const char *qbuf; /* TODO: Do we want this? The purpose seems to be specifically to prevent repeating an Oracle donation. */ action_completed(); if (!oracl) { pline("There is no one here to consult."); return 0; } else if (!oracl->mpeaceful) { pline("%s is not in the mood for conversation (believe it or not...)", Monnam(oracl)); return 0; } else if (!umoney) { pline("You have no money. There's no free lunch in wireless... and in being an oracle!"); return 0; } qbuf = msgprintf("\"Would you mind talking for a little bit?\" (%d %s)", minor_cost, currency(minor_cost)); switch (ynq(qbuf)) { default: case 'q': return 0; case 'y': if (umoney < minor_cost) { pline("You don't even have enough money for that! There's no free lunch in wireless... and in being an oracle!"); return 0; } u_pay = minor_cost; break; case 'n': if (umoney <= minor_cost || /* don't even ask */ (oracle_cnt == 1 || oracle_flg < 0)) return 0; qbuf = msgprintf("\"Oh! You'd like to sit and talk for a _long_ while?\" (%d %s)", major_cost, currency(major_cost)); if (yn(qbuf) != 'y') return 0; u_pay = (umoney < major_cost ? umoney : major_cost); break; } money2mon(oracl, u_pay); add_xpts = 0; /* first oracle of each type gives experience points */ if (u_pay == minor_cost) { outrumor(1, BY_ORACLE); if (!u.uevent.minor_oracle) add_xpts = u_pay / (u.uevent.major_oracle ? 25 : 10); /* 5 pts if very 1st, or 2 pts if major already done */ u.uevent.minor_oracle = TRUE; } else { boolean cheapskate = u_pay < major_cost; outoracle(cheapskate, TRUE); if (!cheapskate && !u.uevent.major_oracle) add_xpts = u_pay / (u.uevent.minor_oracle ? 25 : 10); /* ~100 pts if very 1st, ~40 pts if minor already done */ u.uevent.major_oracle = TRUE; historic_event(FALSE, "received advice from The Oracle."); exercise(A_WIS, !cheapskate); } if (add_xpts) { more_experienced(add_xpts, u_pay / 50); newexplevel(); } return 1; }
int doread() { register struct obj *scroll; register boolean confused = (Confusion != 0); known = FALSE; scroll = getobj(readable, "read"); /* "#-" added by GAN 10/22/86 */ if(!scroll) return(0); /* below added to allow reading of fortune cookies */ if(scroll->otyp == FORTUNE_COOKIE) { if(flags.verbose) You("break up the cookie and throw away the pieces."); outrumor(bcsign(scroll), TRUE); useup(scroll); return(1); } else if(scroll->olet != SCROLL_SYM #ifdef SPELLS && scroll->olet != SPBOOK_SYM #endif ) { pline("That is a silly thing to read."); return(0); } if(Blind) { #ifdef SPELLS if (scroll->olet == SPBOOK_SYM) { pline("Being blind, you cannot read the mystic runes."); return(0); } else #endif if (!scroll->dknown) { pline("Being blind, you cannot read the formula on the scroll."); return(0); } } #ifndef NO_SIGNAL scroll->in_use = TRUE; /* now being read */ #endif #ifdef SPELLS if(scroll->olet == SPBOOK_SYM) { if(confused) { You("cannot grasp the meaning of this tome."); useup(scroll); return(0); } else return(study_book(scroll)); } #endif if(scroll->otyp != SCR_BLANK_PAPER) { if(Blind) pline("As you pronounce the formula on it, the scroll disappears."); else pline("As you read the scroll, it disappears."); if(confused) { if (Hallucination) pline("Being so trippy, you screw up..."); else pline("Being confused, you mispronounce the magic words..."); } } if(!seffects(scroll)) { if(!objects[scroll->otyp].oc_name_known) { if(known && !confused) { makeknown(scroll->otyp); more_experienced(0,10); } else if(!objects[scroll->otyp].oc_uname) docall(scroll); } if(!(scroll->otyp == SCR_BLANK_PAPER) || confused) useup(scroll); #ifndef NO_SIGNAL else scroll->in_use = FALSE; #endif } return(1); }
int dozap(void) { struct obj *obj; xchar zx, zy; obj = getobj("/", "zap"); if (!obj) return (0); if (obj->spe < 0 || (obj->spe == 0 && rn2(121))) { pline("Nothing Happens."); return (1); } if (obj->spe == 0) pline("You wrest one more spell from the worn-out wand."); if (!(objects[obj->otyp].bits & NODIR) && !getdir(1)) return (1); /* make him pay for knowing !NODIR */ obj->spe--; if (objects[obj->otyp].bits & IMMEDIATE) { if (u.uswallow) bhitm(u.ustuck, obj); else if (u.dz) { if (u.dz > 0) { struct obj *otmp = o_at(u.ux, u.uy); if (otmp) bhito(otmp, obj); } } else bhit(u.dx, u.dy, rn1(8, 6), 0, bhitm, bhito, obj); } else { switch (obj->otyp) { case WAN_LIGHT: litroom(TRUE); break; case WAN_SECRET_DOOR_DETECTION: if (!findit()) return (1); break; case WAN_CREATE_MONSTER: { int cnt = 1; if (!rn2(23)) cnt += rn2(7) + 1; while (cnt--) makemon(NULL, u.ux, u.uy); } break; case WAN_WISHING: { char buf[BUFSZ]; struct obj *otmp; if (u.uluck + rn2(5) < 0) { pline("Unfortunately, nothing happens."); break; } pline("You may wish for an object. What do you want? "); getlin(buf); if (buf[0] == '\033') buf[0] = 0; otmp = readobjnam(buf); otmp = addinv(otmp); prinv(otmp); break; } case WAN_DIGGING: /* * Original effect (approximately): * from CORR: dig until we pierce a wall * from ROOM: piece wall and dig until we reach * an ACCESSIBLE place. * Currently: dig for digdepth positions; * also down on request of Lennart Augustsson. */ { struct rm *room; int digdepth; if (u.uswallow) { struct monst *mtmp = u.ustuck; pline("You pierce %s's stomach wall!", monnam(mtmp)); mtmp->mhp = 1; /* almost dead */ unstuck(mtmp); mnexto(mtmp); break; } if (u.dz) { if (u.dz < 0) { pline("You loosen a rock from the ceiling."); pline("It falls on your head!"); losehp(1, "falling rock"); mksobj_at(ROCK, u.ux, u.uy); fobj->quan = 1; stackobj(fobj); if (Invisible) newsym(u.ux, u.uy); } else dighole(); break; } zx = u.ux + u.dx; zy = u.uy + u.dy; digdepth = 8 + rn2(18); Tmp_at(-1, '*'); /* open call */ while (--digdepth >= 0) { if (!isok(zx, zy)) break; room = &levl[zx][zy]; Tmp_at(zx, zy); if (!xdnstair) { if (zx < 3 || zx > COLNO - 3 || zy < 3 || zy > ROWNO - 3) break; if (room->typ == HWALL || room->typ == VWALL) { room->typ = ROOM; break; } } else if (room->typ == HWALL || room->typ == VWALL || room->typ == SDOOR || room->typ == LDOOR) { room->typ = DOOR; digdepth -= 2; } else if (room->typ == SCORR || !room->typ) { room->typ = CORR; digdepth--; } mnewsym(zx, zy); zx += u.dx; zy += u.dy; } mnewsym(zx, zy); /* not always necessary */ Tmp_at(-1, -1); /* closing call */ break; } default: buzz((int)obj->otyp - WAN_MAGIC_MISSILE, u.ux, u.uy, u.dx, u.dy); break; } if (!objects[obj->otyp].oc_name_known) { objects[obj->otyp].oc_name_known = 1; more_experienced(0, 10); } } return (1); }