oracle tidbit

From the newsgroup, while rehashing our bug page entries someone
mentioned that buying a minor consultation from the oracle exercizes
wisdom twice.  First when getrumor() chooses one, then again when
outrumor(BY_ORACLE) delivers it.

     This also simplifies some #if GOLDOBJ conditional code.
This commit is contained in:
nethack.rankin
2012-05-11 22:36:33 +00:00
parent 0add521787
commit 18dfc82175
2 changed files with 10 additions and 24 deletions

View File

@@ -361,6 +361,7 @@ properly handle destruction of equipment carried by monsters hit by
disintegration breath; life-saving retained conferred properties of disintegration breath; life-saving retained conferred properties of
formerly worn items (loss of steed's saddle caused much confusion) formerly worn items (loss of steed's saddle caused much confusion)
don't exercize or abuse wisdom when rumors get used for random graffiti don't exercize or abuse wisdom when rumors get used for random graffiti
don't exercize wisdom twice for each minor oracle consultation
don't welcome the hero to Delphi if the Oracle was angered before first entry don't welcome the hero to Delphi if the Oracle was angered before first entry
create_object() created lizard corpses without timers and troll corpses with create_object() created lizard corpses without timers and troll corpses with
their revive timers, then changed the corpsenm field their revive timers, then changed the corpsenm field

View File

@@ -300,7 +300,7 @@ int mechanism;
(!rn2(4) ? "offhandedly " : (!rn2(3) ? "casually " : (!rn2(4) ? "offhandedly " : (!rn2(3) ? "casually " :
(rn2(2) ? "nonchalantly " : "")))); (rn2(2) ? "nonchalantly " : ""))));
verbalize1(line); verbalize1(line);
exercise(A_WIS, TRUE); /* [WIS exercized by getrumor()] */
return; return;
case BY_COOKIE: case BY_COOKIE:
pline(fortune_msg); pline(fortune_msg);
@@ -422,14 +422,17 @@ int
doconsult(oracl) doconsult(oracl)
register struct monst *oracl; register struct monst *oracl;
{ {
#ifdef GOLDOBJ long umoney;
long umoney = money_cnt(invent);
#endif
int u_pay, minor_cost = 50, major_cost = 500 + 50 * u.ulevel; int u_pay, minor_cost = 50, major_cost = 500 + 50 * u.ulevel;
int add_xpts; int add_xpts;
char qbuf[QBUFSZ]; char qbuf[QBUFSZ];
multi = 0; multi = 0;
#ifndef GOLDOBJ
umoney = u.ugold;
#else
umoney = money_cnt(invent);
#endif
if (!oracl) { if (!oracl) {
There("is no one here to consult."); There("is no one here to consult.");
@@ -437,11 +440,7 @@ register struct monst *oracl;
} else if (!oracl->mpeaceful) { } else if (!oracl->mpeaceful) {
pline("%s is in no mood for consultations.", Monnam(oracl)); pline("%s is in no mood for consultations.", Monnam(oracl));
return 0; return 0;
#ifndef GOLDOBJ
} else if (!u.ugold) {
#else
} else if (!umoney) { } else if (!umoney) {
#endif
You("have no money."); You("have no money.");
return 0; return 0;
} }
@@ -454,41 +453,27 @@ register struct monst *oracl;
case 'q': case 'q':
return 0; return 0;
case 'y': case 'y':
#ifndef GOLDOBJ
if (u.ugold < (long)minor_cost) {
#else
if (umoney < (long)minor_cost) { if (umoney < (long)minor_cost) {
#endif
You("don't even have enough money for that!"); You("don't even have enough money for that!");
return 0; return 0;
} }
u_pay = minor_cost; u_pay = minor_cost;
break; break;
case 'n': case 'n':
#ifndef GOLDOBJ
if (u.ugold <= (long)minor_cost || /* don't even ask */
#else
if (umoney <= (long)minor_cost || /* don't even ask */ if (umoney <= (long)minor_cost || /* don't even ask */
#endif
(oracle_cnt == 1 || oracle_flg < 0)) return 0; (oracle_cnt == 1 || oracle_flg < 0)) return 0;
Sprintf(qbuf, Sprintf(qbuf,
"\"Then dost thou desire a major one?\" (%d %s)", "\"Then dost thou desire a major one?\" (%d %s)",
major_cost, currency((long)major_cost)); major_cost, currency((long)major_cost));
if (yn(qbuf) != 'y') return 0; if (yn(qbuf) != 'y') return 0;
#ifndef GOLDOBJ u_pay = (umoney < (long)major_cost) ? (int)umoney : major_cost;
u_pay = (u.ugold < (long)major_cost ? (int)u.ugold
: major_cost);
#else
u_pay = (umoney < (long)major_cost ? (int)umoney
: major_cost);
#endif
break; break;
} }
#ifndef GOLDOBJ #ifndef GOLDOBJ
u.ugold -= (long)u_pay; u.ugold -= (long)u_pay;
oracl->mgold += (long)u_pay; oracl->mgold += (long)u_pay;
#else #else
money2mon(oracl, (long)u_pay); money2mon(oracl, (long)u_pay);
#endif #endif
context.botl = 1; context.botl = 1;
add_xpts = 0; /* first oracle of each type gives experience points */ add_xpts = 0; /* first oracle of each type gives experience points */