X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/94b5353c71e7246077d468afe68d51ce85fc213d..2fdc1bcd83cf255b8f01e2d876eef60c49044ad1:/larn/moreobj.c diff --git a/larn/moreobj.c b/larn/moreobj.c index 737154f2..7c6766f7 100644 --- a/larn/moreobj.c +++ b/larn/moreobj.c @@ -1,19 +1,24 @@ -#ifndef lint -static char rcsid[] = "$NetBSD: moreobj.c,v 1.3 1995/03/23 08:33:54 cgd Exp $"; -#endif /* not lint */ +/* $NetBSD: moreobj.c,v 1.4 1997/10/18 20:03:32 christos Exp $ */ -/* moreobj.c Larn is copyrighted 1986 by Noah Morgan. - * - * Routines in this file: - * - * oaltar() - * othrone() - * ochest() - * ofountain() +/* + * moreobj.c Larn is copyrighted 1986 by Noah Morgan. + * + * Routines in this file: + * + * oaltar() othrone() ochest() ofountain() */ +#include +#ifndef lint +__RCSID("$NetBSD: moreobj.c,v 1.4 1997/10/18 20:03:32 christos Exp $"); +#endif /* not lint */ +#include +#include +#include #include "header.h" +#include "extern.h" -static void ohear(); +static void ohear __P((void)); +static void fch __P((int, long *)); /* * ****** @@ -22,96 +27,115 @@ static void ohear(); * * subroutine to process an altar object */ +void oaltar() - { - unsigned long k; +{ + unsigned long k; - lprcat("\nDo you (p) pray (d) desecrate"); iopts(); - while (1) - { - while (1) switch(getchar()) - { - case 'p': lprcat(" pray\nDo you (m) give money or (j) just pray? "); - while (1) switch(getchar()) - { - case 'j': if (rnd(100)<75) - lprcat("\nnothing happens"); - else if (rnd(13)<4) ohear(); - else if (rnd(43) == 10) - { - if (c[WEAR]) lprcat("\nYou feel your armor vibrate for a moment"); - enchantarmor(); return; - } - else if (rnd(43) == 10) - { - if (c[WIELD]) lprcat("\nYou feel your weapon vibrate for a moment"); - enchweapon(); return; - } - else createmonster(makemonst(level+1)); - return; - - case 'm': lprcat("\n\n"); cursor(1,24); cltoeoln(); - cursor(1,23); cltoeoln(); - lprcat("how much do you donate? "); - k = readnum((long)c[GOLD]); - if (c[GOLD] 50) { ohear(); return; } - else if (rnd(43) == 5) - { - if (c[WEAR]) lprcat("\nYou feel your armor vibrate for a moment"); - enchantarmor(); return; - } - else if (rnd(43) == 8) - { - if (c[WIELD]) lprcat("\nYou feel your weapon vibrate for a moment"); - enchweapon(); return; - } - else lprcat("\nThank You."); - bottomline(); return; - - case '\33': return; - }; - - case 'd': lprcat(" desecrate"); - if (rnd(100)<60) - { createmonster(makemonst(level+2)+8); c[AGGRAVATE] += 2500; } - else - if (rnd(101)<30) - { - lprcat("\nThe altar crumbles into a pile of dust before your eyes"); - forget(); /* remember to destroy the altar */ + lprcat("\nDo you (p) pray (d) desecrate"); + iopts(); + while (1) { + while (1) + switch (getchar()) { + case 'p': + lprcat(" pray\nDo you (m) give money or (j) just pray? "); + while (1) + switch (getchar()) { + case 'j': + if (rnd(100) < 75) + lprcat("\nnothing happens"); + else if (rnd(13) < 4) + ohear(); + else if (rnd(43) == 10) { + if (c[WEAR]) + lprcat("\nYou feel your armor vibrate for a moment"); + enchantarmor(); + return; + } else if (rnd(43) == 10) { + if (c[WIELD]) + lprcat("\nYou feel your weapon vibrate for a moment"); + enchweapon(); + return; + } else + createmonster(makemonst(level + 1)); + return; + + case 'm': + lprcat("\n\n"); + cursor(1, 24); + cltoeoln(); + cursor(1, 23); + cltoeoln(); + lprcat("how much do you donate? "); + k = readnum((long) c[GOLD]); + if (c[GOLD] < k) { + lprcat("\nYou don't have that much!"); + return; } - else - lprcat("\nnothing happens"); - return; + c[GOLD] -= k; + if (k < c[GOLD] / 10 || k < rnd(50)) { + createmonster(makemonst(level + 1)); + c[AGGRAVATE] += 200; + } else if (rnd(101) > 50) { + ohear(); + return; + } else if (rnd(43) == 5) { + if (c[WEAR]) + lprcat("\nYou feel your armor vibrate for a moment"); + enchantarmor(); + return; + } else if (rnd(43) == 8) { + if (c[WIELD]) + lprcat("\nYou feel your weapon vibrate for a moment"); + enchweapon(); + return; + } else + lprcat("\nThank You."); + bottomline(); + return; - case 'i': - case '\33': ignore(); - if (rnd(100)<30) { createmonster(makemonst(level+1)); c[AGGRAVATE] += rnd(450); } - else lprcat("\nnothing happens"); - return; - }; - } + case '\33': + return; + }; + + case 'd': + lprcat(" desecrate"); + if (rnd(100) < 60) { + createmonster(makemonst(level + 2) + 8); + c[AGGRAVATE] += 2500; + } else if (rnd(101) < 30) { + lprcat("\nThe altar crumbles into a pile of dust before your eyes"); + forget(); /* remember to destroy + * the altar */ + } else + lprcat("\nnothing happens"); + return; + + case 'i': + case '\33': + ignore(); + if (rnd(100) < 30) { + createmonster(makemonst(level + 1)); + c[AGGRAVATE] += rnd(450); + } else + lprcat("\nnothing happens"); + return; + }; } +} /* function to cast a +3 protection on the player */ static void ohear() - { +{ lprcat("\nYou have been heard!"); - if (c[ALTPRO]==0) c[MOREDEFENSES]+=3; + if (c[ALTPRO] == 0) + c[MOREDEFENSES] += 3; c[ALTPRO] += 500; /* protection field */ bottomline(); - } +} /* ******* @@ -120,68 +144,85 @@ ohear() subroutine to process a throne object */ +void othrone(arg) - int arg; - { - register int i,k; + int arg; +{ + int i, k; - lprcat("\nDo you (p) pry off jewels, (s) sit down"); iopts(); - while (1) - { - while (1) switch(getchar()) - { - case 'p': lprcat(" pry off"); k=rnd(101); - if (k<25) - { - for (i=0; i 0 they are raised if x < 0 they are lowered */ +void fntchange(how) - int how; - { - register long j; + int how; +{ + long j; lprc('\n'); - switch(rnd(9)) - { - case 1: lprcat("Your strength"); fch(how,&c[0]); break; - case 2: lprcat("Your intelligence"); fch(how,&c[1]); break; - case 3: lprcat("Your wisdom"); fch(how,&c[2]); break; - case 4: lprcat("Your constitution"); fch(how,&c[3]); break; - case 5: lprcat("Your dexterity"); fch(how,&c[4]); break; - case 6: lprcat("Your charm"); fch(how,&c[5]); break; - case 7: j=rnd(level+1); - if (how < 0) - { lprintf("You lose %d hit point",(long)j); if (j>1) lprcat("s!"); else lprc('!'); losemhp((int)j); } - else - { lprintf("You gain %d hit point",(long)j); if (j>1) lprcat("s!"); else lprc('!'); raisemhp((int)j); } - bottomline(); break; - - case 8: j=rnd(level+1); - if (how > 0) - { - lprintf("You just gained %d spell",(long)j); raisemspells((int)j); - if (j>1) lprcat("s!"); else lprc('!'); - } - else - { - lprintf("You just lost %d spell",(long)j); losemspells((int)j); - if (j>1) lprcat("s!"); else lprc('!'); - } - bottomline(); break; - - case 9: j = 5*rnd((level+1)*(level+1)); - if (how < 0) - { - lprintf("You just lost %d experience point",(long)j); - if (j>1) lprcat("s!"); else lprc('!'); loseexperience((long)j); - } - else - { - lprintf("You just gained %d experience point",(long)j); - if (j>1) lprcat("s!"); else lprc('!'); raiseexperience((long)j); - } - break; + switch (rnd(9)) { + case 1: + lprcat("Your strength"); + fch(how, &c[0]); + break; + case 2: + lprcat("Your intelligence"); + fch(how, &c[1]); + break; + case 3: + lprcat("Your wisdom"); + fch(how, &c[2]); + break; + case 4: + lprcat("Your constitution"); + fch(how, &c[3]); + break; + case 5: + lprcat("Your dexterity"); + fch(how, &c[4]); + break; + case 6: + lprcat("Your charm"); + fch(how, &c[5]); + break; + case 7: + j = rnd(level + 1); + if (how < 0) { + lprintf("You lose %d hit point", (long) j); + if (j > 1) + lprcat("s!"); + else + lprc('!'); + losemhp((int) j); + } else { + lprintf("You gain %d hit point", (long) j); + if (j > 1) + lprcat("s!"); + else + lprc('!'); + raisemhp((int) j); } - cursors(); + bottomline(); + break; + + case 8: + j = rnd(level + 1); + if (how > 0) { + lprintf("You just gained %d spell", (long) j); + raisemspells((int) j); + if (j > 1) + lprcat("s!"); + else + lprc('!'); + } else { + lprintf("You just lost %d spell", (long) j); + losemspells((int) j); + if (j > 1) + lprcat("s!"); + else + lprc('!'); + } + bottomline(); + break; + + case 9: + j = 5 * rnd((level + 1) * (level + 1)); + if (how < 0) { + lprintf("You just lost %d experience point", (long) j); + if (j > 1) + lprcat("s!"); + else + lprc('!'); + loseexperience((long) j); + } else { + lprintf("You just gained %d experience point", (long) j); + if (j > 1) + lprcat("s!"); + else + lprc('!'); + raiseexperience((long) j); + } + break; } + cursors(); +}