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; }
doeat(){ register struct obj *otmp; register struct objclass *ftmp; register tmp; /* Is there some food (probably a heavy corpse) here on the ground? */ if(!Levitation) for(otmp = fobj; 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: case CRYSKNIFE: 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, (char *) 0)); } 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) { register struct obj *obj; extern struct obj *splitobj(); 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); } ftmp = &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); flags.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 #ifdef QUEST if(otmp->otyp == CARROT && !Blind){ u.uhorizon++; setsee(); pline("Your vision improves."); } else #endif QUEST 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 outrumor(); } 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]; (void) sprintf(msgbuf, "You finished eating the %s.", ftmp->oc_name); nomovemsg = msgbuf; } 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); }