jcc@axis.fr (Jean-Christophe Collet) (08/02/88)
Hi folks, my last contribution to Nethack before some times... (I will be away for one month...). These patches are a fundamental modification of the sacrifice stuff. I've always finded it to easy (Got a luck of 10 after 300-400 moves, then the hand of EL*TH a while later...). Was absolutly illogical (was'nt it Mr Spock ?). So I introduced altars (#) in rooms. Now you can only make sacrifices on altars, and only killed monsters. BEWARE there are more than one type of altars... ( :-} grin) ! SPOILERS will be sent/posted on request (By Email, please). NOTES : 1) you have to insert the line : #define ALTARS /* Altars Code (imcompatible with SINKS) - JC Collet */ in the config.h 2) This code is incompatible with the KITCHEN SINKS (they share the same symbol) so you have to comment out the #define SINKS from the config.h Happy hacking jcc ------------------------------------------------------------------------------- jcc@axis.fr ! "An artificial intelligence is better than none !" ..!mcvax!inria!axis!jcc ! "Artificial intelligence matches natural stupidity !" Collet jean-christophe ! "Objets inanimes avez vous donc une ame ?" ------------------------------------------------------------------------------- Axis Digital | 135 rue d'aguesseau | <this space left intentionaly blank> 92100 Boulogne | France | ------------------------------------------------------------------------------- ------ CUT HERE --- CUT HERE --- CUT HERE --- CUT HERE --- CUT HERE ------ *** config.h.old Mon Aug 1 20:47:12 1988 --- config.h Mon Aug 1 18:49:12 1988 *************** *** 234,239 #define YODA /* Light Sword Code - JC Collet */ #define JCC /* Some change for display - JC Collet */ #define DRAGONS /* Complete Dragons Code - JC Collet */ #if defined(MSDOS) && defined(GRAPHICS) #define TERMLIB /* enable use of termcap file c:\etc\termcap */ --- 234,240 ----- #define YODA /* Light Sword Code - JC Collet */ #define JCC /* Some change for display - JC Collet */ #define DRAGONS /* Complete Dragons Code - JC Collet */ + #define ALTARS /* Altars Code (imcompatible with SINKS) - JC Collet */ #if defined(MSDOS) && defined(GRAPHICS) #define TERMLIB /* enable use of termcap file c:\etc\termcap */ *** decl.c.old Mon Aug 1 20:48:06 1988 --- decl.c Mon Aug 1 20:48:29 1988 *************** *** 20,25 #ifdef SINKS '#', #endif #ifdef JCC '-','-','-','-','-', #endif --- 20,28 ----- #ifdef SINKS '#', #endif + #ifdef ALTARS + '#', + #endif /* ALTARS */ #ifdef JCC '-','-','-','-','-', #endif *** dothrow.c.old Mon Aug 1 20:49:32 1988 --- dothrow.c Mon Aug 1 18:49:14 1988 *************** *** 153,158 hitfloor(obj) register struct obj *obj; { pline("%s hits the floor.", Doname(obj)); if(obj->otyp == EXPENSIVE_CAMERA) { pline("It is shattered in a thousand pieces!"); --- 153,163 ----- hitfloor(obj) register struct obj *obj; { + #ifdef ALTARS + if (IS_ALTAR(levl[u.ux][u.uy].typ)) + pline("%s hits the altar.",Doname(obj)); + else + #endif /* ALTARS */ pline("%s hits the floor.", Doname(obj)); if(obj->otyp == EXPENSIVE_CAMERA) { pline("It is shattered in a thousand pieces!"); *************** *** 172,177 obfree(obj, Null(obj)); #endif } else if(obj->olet == POTION_SYM) { pline("The flask breaks, and you smell a peculiar odor ..."); potionbreathe(obj); obfree(obj, Null(obj)); --- 177,202 ----- obfree(obj, Null(obj)); #endif } else if(obj->olet == POTION_SYM) { + #ifdef ALTARS + if (IS_ALTAR(levl[u.ux][u.uy].typ)) { + if (obj->otyp == POT_HOLY_WATER) { + pline("The flask breaks, and the potion flows on the altar!"); + if (levl[u.ux][u.uy].typ < BLESSED_ALTAR) { + levl[u.ux][u.uy].typ++; + pline("The altar seems cleaner!"); + return; + } + } + if (obj->otyp == POT_SICKNESS) { + pline("The flask breaks, and the potion flows on the altar!"); + if (levl[u.ux][u.uy].typ > CURSED_ALTAR) { + levl[u.ux][u.uy].typ--; + pline("The altar seems darker!"); + return; + } + } + } + #endif /* ALTARS */ pline("The flask breaks, and you smell a peculiar odor ..."); potionbreathe(obj); obfree(obj, Null(obj)); *** hack.c.old Mon Aug 1 20:49:53 1988 --- hack.c Mon Aug 1 18:49:17 1988 *************** *** 307,312 #ifdef SINKS || IS_SINK(levl[u.ux][u.uy].typ) #endif ) nomul(0); } --- 307,315 ----- #ifdef SINKS || IS_SINK(levl[u.ux][u.uy].typ) #endif + #ifdef ALTARS + || IS_ALTAR(levl[u.ux][u.uy].typ) + #endif ) nomul(0); } *** invent.c.old Mon Aug 1 20:46:26 1988 --- invent.c Mon Aug 1 18:49:21 1988 *** makedefs.c.old Mon Aug 1 20:50:37 1988 --- makedefs.c Mon Aug 1 18:49:29 1988 *************** *** 260,265 printf("#\ta corridor (or a kitchen sink)\n"); else #endif #ifdef SPELLS if (!strcmp(inline, "+ a door")) printf("+\ta door (or a spell book)\n"); --- 260,270 ----- printf("#\ta corridor (or a kitchen sink)\n"); else #endif + #ifdef ALTARS + if (!strcmp(inline, "# a corridor")) + printf("#\ta corridor (or an altar)\n"); + else + #endif #ifdef SPELLS if (!strcmp(inline, "+ a door")) printf("+\ta door (or a spell book)\n"); *** mklev.c.old Mon Aug 1 20:51:19 1988 --- mklev.c Mon Aug 1 18:49:35 1988 *************** *** 162,167 #ifdef SINKS if(!rn2(80)) mksink(croom); #endif if(!rn2(3)) { (void) mkobj_at(0, somex(), somey()); tryct = 0; --- 162,170 ----- #ifdef SINKS if(!rn2(80)) mksink(croom); #endif + #ifdef ALTARS + if (!rn2(40)) mkaltar(croom); + #endif if(!rn2(3)) { (void) mkobj_at(0, somex(), somey()); tryct = 0; *************** *** 995,997 } #endif /* SINKS /**/ --- 998,1027 ----- } #endif /* SINKS /**/ + #ifdef ALTARS + mkaltar(croom) + register struct mkroom *croom; + { + register xchar mx,my; + register int tryct = 0; + + do { + if(++tryct > 200) + return; + mx = somex(); + my = somey(); + } while(t_at(mx, my) || levl[mx][my].typ == STAIRS + #ifdef FOUNTAINS + || IS_FOUNTAIN(levl[mx][my].typ) + #endif + #ifdef NEWCLASS + || IS_THRONE(levl[mx][my].typ) + #endif + ); + + /* Put an altar at mx, my */ + + levl[mx][my].typ = CURSED_ALTAR + rn2(3); + levl[mx][my].scrsym = ALTAR_SYM; + } + #endif /* ALTARS */ *** options.c.old Mon Aug 1 20:51:44 1988 --- options.c Mon Aug 1 18:49:39 1988 *************** *** 269,274 #ifdef SINKS SETPCHAR(sink, 34); #endif SETPCHAR(crwall,36); SETPCHAR(twall,38); SETPCHAR(tdwall,40); --- 269,277 ----- #ifdef SINKS SETPCHAR(sink, 34); #endif + #ifdef ALTARS + SETPCHAR(altar, 34); + #endif SETPCHAR(crwall,36); SETPCHAR(twall,38); SETPCHAR(tdwall,40); *************** *** 303,308 #endif #ifdef SINKS SETPCHAR(sink, 17); #endif #undef SETPCHAR #endif /* JCC */ --- 306,314 ----- #endif #ifdef SINKS SETPCHAR(sink, 17); + #endif + #ifdef ALTARS + SETPCHAR(altar, 17); #endif #undef SETPCHAR #endif /* JCC */ *** pager.c.old Mon Aug 1 20:52:17 1988 --- pager.c Mon Aug 1 18:49:42 1988 *************** *** 74,79 #ifdef SINKS else if (r == showsyms.sink) q = defsyms.sink; #endif else q = r; #endif /* GRAPHICS */ --- 74,82 ----- #ifdef SINKS else if (r == showsyms.sink) q = defsyms.sink; #endif + #ifdef ALTARS + else if (r == showsyms.altar) q = defsyms.altar; + #endif else q = r; #endif /* GRAPHICS */ *** pray.c.old Mon Aug 1 20:55:06 1988 --- pray.c Mon Aug 1 18:49:46 1988 *************** *** 174,179 char let; char *hcolor (); otmp = getobj("%", "sacrifice"); if(!otmp) return(0); --- 174,188 ----- char let; char *hcolor (); + #ifdef ALTARS + extern struct permonst d_lord; + struct monst *mtmp; + + if (!IS_ALTAR(levl[u.ux][u.uy].typ)) { + pline("Thou shalt find a better place, dumb !"); + return 0; + } + #endif otmp = getobj("%", "sacrifice"); if(!otmp) return(0); *************** *** 178,183 if(!otmp) return(0); ftmp = &objects[otmp->otyp]; #ifndef DRAGONS #ifdef KAA if(otmp->otyp == DEAD_DEMON) let='&'; --- 187,198 ----- if(!otmp) return(0); ftmp = &objects[otmp->otyp]; + #ifdef ALTARS + if (otmp->otyp < CORPSE) { + pline("Thou shalt find a better thing to sacrifice, stingy!"); + return 0; + } + #endif /* ALTARS */ #ifndef DRAGONS #ifdef KAA if(otmp->otyp == DEAD_DEMON) let='&'; *************** *** 190,195 let = CORPSE_I_TO_C(otmp->otyp); #endif /* DRAGONS */ /* judge the food value by the nutrition, as well as some aging behavior */ value = ftmp->nutrition; --- 205,211 ----- let = CORPSE_I_TO_C(otmp->otyp); #endif /* DRAGONS */ + #ifndef ALTARS /* judge the food value by the nutrition, as well as some aging behavior */ value = ftmp->nutrition; *************** *** 202,207 else if(index(POISONOUS, let)) { value = -10; /* gods get annoyed */ } if (value == 0) { --- 218,285 ----- else if(index(POISONOUS, let)) { value = -10; /* gods get annoyed */ } + #else + /* We'll try to make the sacrifice stuff smarter */ + + if (index("@NnLu",let)) { /* Human sacrifice, AAAARRRRRGGGGHHHH */ + if (levl[u.ux][u.uy].typ == CURSED_ALTAR) { + /* Human sacrifice on cursed altars + is equivalent to demon summoning */ + pline("The blood flood on the altar,"); + pline("which vanishes in a black cloud !"); + levl[u.ux][u.uy].typ = ROOM; + if(Invis) newsym(u.ux, u.uy); + useup(otmp); /* Make the bodie disapear */ + #ifdef HARD + if(!(mtmp = makemon(&d_lord,u.ux,u.uy))){ + #else + if(!(mtmp = makemon(PM_DEMON,u.ux,u.uy))){ + #endif + pline("The cloud dissipates."); + return 1; + } + mnexto(mtmp); + pline("You have summoned a demon lord !"); + pline("You are frightened to death, and unable to move."); + nomul(-3); + return 1; + } + pline("You'll regret this infamous offense !"); + change_luck(-5); + u.ugangr += 2; + value = -10; + /* Make the altar cursed because of you */ + levl[u.ux][u.uy].typ = CURSED_ALTAR; + #ifdef DRAGONS + } else if (let == 'D') { + /* Do something special about Dragons */ + switch (otmp->otyp) { + case DEAD_GREY_DRAGON : + case DEAD_RED_DRAGON : + case DEAD_WHITE_DRAGON : + value = 400; + break; + case DEAD_ORANGE_DRAGON : + case DEAD_BLUE_DRAGON : + case DEAD_YELLOW_DRAGON : + value = 500; + break; + case DEAD_GREEN_DRAGON : + value = 600; + break; + case DEAD_BLACK_DRAGON : + value = 800; + break; + } + #endif + } else if (let == '&') { + /* Jack Pot */ + value = 800; + } else if (let != 'a' && (moves > otmp->age + 50)) + value = 0; /* Old Stuff */ + else { + int ct; + struct permonst *ptr; for(ct = 0; ct < CMNUM; ct++) { ptr = &mons[ct]; *************** *** 203,208 value = -10; /* gods get annoyed */ } if (value == 0) { pline ("Nothing happens."); --- 281,306 ----- int ct; struct permonst *ptr; + for(ct = 0; ct < CMNUM; ct++) { + ptr = &mons[ct]; + if(ptr->mlet == let) + break; + } + value = (ptr->mlevel * 70) - ( ptr->ac * 20) + (ptr->damn*10); + } + if (levl[u.ux][u.uy].typ == CURSED_ALTAR) { + if (value > 0) + value = -value; + else + value -= 10; + } + if (levl[u.ux][u.uy].typ == BLESSED_ALTAR) + if (value > 0) { + value *= 3; /* +50% */ + value /= 2; + } + #endif /* ALTARS */ + if (value == 0) { pline ("Nothing happens."); *************** *** 232,237 else pline("Your sacrifice is consumed in a burst of flame!"); if(u.ugangr) { u.ugangr -= ((value / 800) * 4); if(u.ugangr < 0) u.ugangr = 0; if(u.ugangr != saved_anger) --- 330,338 ----- else pline("Your sacrifice is consumed in a burst of flame!"); if(u.ugangr) { + #ifdef ALTARS + u.ugangr -= ((value * 4) / 800); + #else u.ugangr -= ((value / 800) * 4); #endif /* ALTARS */ if(u.ugangr < 0) u.ugangr = 0; *************** *** 233,238 if(u.ugangr) { u.ugangr -= ((value / 800) * 4); if(u.ugangr < 0) u.ugangr = 0; if(u.ugangr != saved_anger) if (u.ugangr) --- 334,340 ----- u.ugangr -= ((value * 4) / 800); #else u.ugangr -= ((value / 800) * 4); + #endif /* ALTARS */ if(u.ugangr < 0) u.ugangr = 0; if(u.ugangr != saved_anger) if (u.ugangr) *************** *** 248,253 } else if (u.ublesscnt > 0) { u.ublesscnt -= ((value / 800 /* a food ration */) * 300); if(u.ublesscnt < 0) u.ublesscnt = 0; if(u.ublesscnt != saved_cnt) --- 350,358 ----- } else if (u.ublesscnt > 0) { + #ifdef ALTARS + u.ublesscnt -= ((value * 300) / 800); + #else u.ublesscnt -= ((value / 800 /* a food ration */) * 300); #endif /* ALTARS */ if(u.ublesscnt < 0) u.ublesscnt = 0; *************** *** 249,254 else if (u.ublesscnt > 0) { u.ublesscnt -= ((value / 800 /* a food ration */) * 300); if(u.ublesscnt < 0) u.ublesscnt = 0; if(u.ublesscnt != saved_cnt) { --- 354,360 ----- u.ublesscnt -= ((value * 300) / 800); #else u.ublesscnt -= ((value / 800 /* a food ration */) * 300); + #endif /* ALTARS */ if(u.ublesscnt < 0) u.ublesscnt = 0; if(u.ublesscnt != saved_cnt) { *************** *** 265,270 } else /* you were already in pretty good standing */ { change_luck((value / 800) * LUCKMAX); if (u.uluck != saved_luck) { --- 371,379 ----- } else /* you were already in pretty good standing */ { + #ifdef ALTARS + change_luck((value * LUCKMAX) / 1600); + #else change_luck((value / 800) * LUCKMAX); #endif /* ALTARS */ if (u.uluck != saved_luck) *************** *** 266,271 else /* you were already in pretty good standing */ { change_luck((value / 800) * LUCKMAX); if (u.uluck != saved_luck) { if (Hallucination) pline ("You see crabgrass at your feet. A funny thing in a dungeon."); --- 375,381 ----- change_luck((value * LUCKMAX) / 1600); #else change_luck((value / 800) * LUCKMAX); + #endif /* ALTARS */ if (u.uluck != saved_luck) { if (Hallucination) pline ("You see crabgrass at your feet. A funny thing in a dungeon."); *** prisym.c.old Mon Aug 1 20:55:34 1988 --- prisym.c Mon Aug 1 18:49:50 1988 *************** *** 279,284 tmp = SINK_SYM; break; #endif /* case POOL: tmp = POOL_SYM; --- 279,291 ----- tmp = SINK_SYM; break; #endif + #ifdef ALTARS + case CURSED_ALTAR: + case NEUTRAL_ALTAR: + case BLESSED_ALTAR: + tmp = ALTAR_SYM; + break; + #endif /* case POOL: tmp = POOL_SYM; *** rm.h.old Mon Aug 1 20:56:29 1988 --- rm.h Mon Aug 1 18:49:58 1988 *************** *** 33,38 #define FOUNTAIN 20 #define THRONE 21 #define SINK 22 #else #define SDOOR 3 #define SCORR 4 --- 33,43 ----- #define FOUNTAIN 20 #define THRONE 21 #define SINK 22 + #ifdef ALTARS + #define CURSED_ALTAR 22 + #define NEUTRAL_ALTAR 23 + #define BLESSED_ALTAR 24 + #endif #else #define SDOOR 3 #define SCORR 4 *************** *** 46,51 #define FOUNTAIN 11 #define THRONE 12 #define SINK 13 #endif /* * Avoid using the level types in inequalities: --- 51,60 ----- #define FOUNTAIN 11 #define THRONE 12 #define SINK 13 + #ifdef ALTARS + #define CURSED_ALTAR 13 + #define NEUTRAL_ALTAR 14 + #define BLESSED_ALTAR 15 #endif #endif /* *************** *** 47,52 #define THRONE 12 #define SINK 13 #endif /* * Avoid using the level types in inequalities: * these types are subject to change. --- 56,62 ----- #define NEUTRAL_ALTAR 14 #define BLESSED_ALTAR 15 #endif + #endif /* * Avoid using the level types in inequalities: * these types are subject to change. *************** *** 71,76 #define IS_THRONE(typ) ((typ) == THRONE) #define IS_FOUNTAIN(typ) ((typ) == FOUNTAIN) #define IS_SINK(typ) ((typ) == SINK) /* * The level-map symbols may be compiled in or defined at initialization time */ --- 81,89 ----- #define IS_THRONE(typ) ((typ) == THRONE) #define IS_FOUNTAIN(typ) ((typ) == FOUNTAIN) #define IS_SINK(typ) ((typ) == SINK) + #ifdef ALTARS + #define IS_ALTAR(typ) ((typ) >= CURSED_ALTAR && (typ) <= BLESSED_ALTAR) + #endif /* * The level-map symbols may be compiled in or defined at initialization time */ *************** *** 98,103 #define THRONE_SYM '\\' #define WEB_SYM '"' #define SINK_SYM '#' #else /* GRAPHICS */ /* screen symbols for using character graphics. */ --- 111,119 ----- #define THRONE_SYM '\\' #define WEB_SYM '"' #define SINK_SYM '#' + #ifdef ALTARS + #define ALTAR_SYM '#' + #endif #else /* GRAPHICS */ /* screen symbols for using character graphics. */ *************** *** 116,121 #ifdef SINKS unsigned char sink; #endif #ifdef JCC unsigned char crwall, twall, tdwall, tlwall, trwall; #endif --- 132,140 ----- #ifdef SINKS unsigned char sink; #endif + #ifdef ALTARS + unsigned char altar; + #endif #ifdef JCC unsigned char crwall, twall, tdwall, tlwall, trwall; #endif *************** *** 140,145 #define THRONE_SYM showsyms.throne #define WEB_SYM showsyms.web #define SINK_SYM showsyms.sink #ifdef JCC #define CRWALL_SYM showsyms.crwall #define TUPWALL_SYM showsyms.twall --- 159,167 ----- #define THRONE_SYM showsyms.throne #define WEB_SYM showsyms.web #define SINK_SYM showsyms.sink + #ifdef ALTARS + #define ALTAR_SYM showsyms.altar; + #endif #ifdef JCC #define CRWALL_SYM showsyms.crwall #define TUPWALL_SYM showsyms.twall *** zap.c.old Mon Aug 1 20:57:02 1988 --- zap.c Mon Aug 1 18:50:02 1988 *************** *** 459,464 if(u.uswallow) bhitm(u.ustuck, obj); else if(u.dz) { if(u.dz > 0 && o_at(u.ux,u.uy)) { register struct obj *otmp; --- 459,485 ----- if(u.uswallow) bhitm(u.ustuck, obj); else if(u.dz) { + #ifdef ALTARS + /* Wands of probing help to know the true nature + of altars */ + if ( obj->otyp == WAN_PROBING && u.dz > 0 + && IS_ALTAR(levl[u.ux][u.uy].typ) ) { + char *s; + switch (levl[u.ux][u.uy].typ) { + case CURSED_ALTAR : + s = "black"; + break; + case NEUTRAL_ALTAR : + s = "red"; + break; + case BLESSED_ALTAR : + s = "gold"; + break; + } + pline("the altar glows %s for a moment.", + Hallucination ? hcolor() : s); + } + #endif /* ALTARS */ if(u.dz > 0 && o_at(u.ux,u.uy)) { register struct obj *otmp;