jcc@axis.fr (Jean-Christophe Collet) (06/09/88)
Hi folks, Here are some patches which will make the way DRAGONS work in nethack better. First, I was upset that after I had killed a yellow (blue, etc..) dragon, I could only find a DEAD DRAGON ( losing color in fight ?), so any dead dragon could give me fire resistance ( even white dragons :-< ). Second, I think that, like in D&D, there should be commom, uncommon, rare and very rare dragons (black dragons as common as red ones :-{ ). Well, I patched all that (was'nt so easy) and I hope you'll like the mods. (sorry for line numbers, but my sources are a real mess). Note that you have to add the following line in config.h : #define DRAGONS /* Complete Dragons Code - JC Collet */ NB : During the process I turned the CORPSE_I_TO_C macro into a function, which is, in my mind, cleaner, specialy if you wish to add monsters.... 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 ------ *** eat.c.orig Fri Jun 3 15:49:32 1988 --- eat.c Tue Jun 7 16:13:07 1988 *************** *** 423,428 } } #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) --- 423,429 ----- } } + #ifndef DRAGONS #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) *************** *** 426,431 #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) poisonous(otmp) register struct obj *otmp; { --- 427,459 ----- #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) + #else + char CORPSE_I_TO_C(otyp) { + char let; + #ifdef KAA + if (otyp == DEAD_DEMON) + let = '&'; + else if (otyp == DEAD_GIANT) + let = '9'; + else + #endif + #ifdef SAC + if (otyp == DEAD_SOLDIER) + let = '3'; + else + #endif + if (otyp < DEAD_GREY_DRAGON) + let = ((char) ('@' + (otyp - DEAD_HUMAN))); + else if (otyp <= DEAD_YELLOW_DRAGON) + let = 'D'; + else if (otyp >= DEAD_ACID_BLOB) + let = ((char) ('a' + (otyp - DEAD_ACID_BLOB))); + else + let = ((char) ('@' + (otyp - DEAD_HUMAN - 7))); + return(let); + } + #endif + poisonous(otmp) register struct obj *otmp; { *************** *** 437,442 /* returns 1 if some text was printed */ eatcorpse(otmp) register struct obj *otmp; { #ifdef KAA register char let; #else --- 465,474 ----- /* returns 1 if some text was printed */ eatcorpse(otmp) register struct obj *otmp; { + #ifdef DRAGONS + register char let = CORPSE_I_TO_C(otmp->otyp); + register tp = 0; + #else #ifdef KAA register char let; #else *************** *** 451,456 #ifdef SAC if(otmp->otyp == DEAD_SOLDIER) let='3'; #endif /* SAC */ if(let != 'a' && moves > otmp->age + 50 + rn2(100)) { tp++; pline("Ulch -- that meat was tainted!"); --- 483,489 ----- #ifdef SAC if(otmp->otyp == DEAD_SOLDIER) let='3'; #endif /* SAC */ + #endif /* DRAGONS */ if(let != 'a' && moves > otmp->age + 50 + rn2(100)) { tp++; pline("Ulch -- that meat was tainted!"); *************** *** 515,520 HConfusion += 50; break; case 'D': HFire_resistance |= INTRINSIC; break; case 'E': --- 548,600 ----- HConfusion += 50; break; case 'D': + #ifdef DRAGONS + switch (otmp->otyp) { + case DEAD_GREY_DRAGON : + case DEAD_RED_DRAGON : + HFire_resistance |= INTRINSIC; + break; + case DEAD_WHITE_DRAGON : + HCold_resistance |= INTRINSIC; + break; + case DEAD_GREEN_DRAGON : + HPoison_resistance |= INTRINSIC; + break; + case DEAD_ORANGE_DRAGON : + pline("You feel so tired......ZZZ!"); + nomul(-rnd(25)); + break; + case DEAD_YELLOW_DRAGON : + if(Stoned) { + pline("What a pity - you just destroyed a future piece of art!"); + tp++; + Stoned = 0; + } else { + pline("It burns!"); + losehp(d(6,6),"dead yellow dragon"); + } + break; + case DEAD_BLUE_DRAGON : + if (Shock_resistance) { + pline("You get blasted by a lightning bolt from the corspe!"); + pline("But it doesn't seems to affect you then..."); + pline("Strange new energy courses through your body!"); + HShock_resistance |= INTRINSIC; + } else { + pline("You get blasted by a lightning bolt from the corspe!"); + losehp(d(6,6),"dead blue dragon"); + } + break; + case DEAD_BLACK_DRAGON : + pline("Your skin hardens !"); + if (!(Protection & INTRINSIC)) { + Protection |= INTRINSIC; + if (!u.ublessed) + u.ublessed = rnd(3) + 1; + } else u.ublessed++; + break; + } + #else HFire_resistance |= INTRINSIC; #endif break; *************** *** 516,521 break; case 'D': HFire_resistance |= INTRINSIC; break; case 'E': HTelepat |= INTRINSIC; --- 596,602 ----- } #else HFire_resistance |= INTRINSIC; + #endif break; case 'E': HTelepat |= INTRINSIC; *** makedefs.c.ori Mon Jun 6 16:18:23 1988 --- makedefs.c Mon Jun 6 16:18:49 1988 *************** *** 630,635 strcpy (s, current->string); for(c = s; *c != 0; c++) capitalize(c); for(testobj = more; testobj != 0; testobj = testobj->next) if(! strcmp(s, testobj->string)) return(1); --- 630,641 ----- strcpy (s, current->string); for(c = s; *c != 0; c++) capitalize(c); + #ifdef DRAGONS + /* Horrible kludge to avoid #ifdef .. #endif problems + for the Dragons Code */ + if (!strcmp(s,"DEAD_DRAGON")) + return(1); + #endif for(testobj = more; testobj != 0; testobj = testobj->next) if(! strcmp(s, testobj->string)) return(1); *** makemon.c.orig Tue May 31 15:15:33 1988 --- makemon.c Wed Jun 8 16:16:51 1988 *************** *** 125,130 mtmp->my = y; mtmp->mcansee = 1; if(ptr->mlet == 'D') { mtmp->dragon = rn2(8); switch(mtmp->dragon) { case 0: mtmp->data = &grey_dragon; break; --- 126,170 ----- mtmp->my = y; mtmp->mcansee = 1; if(ptr->mlet == 'D') { + #ifdef DRAGONS + short dice; + dice = rn2(20); + if (dice >= 10) { + /* Commom dragons */ + switch (rn2(3)) { + case 0 : mtmp->data = &grey_dragon; + mtmp->dragon = 0; + break; + case 1 : mtmp->data = &red_dragon; + mtmp->dragon = 1; + break; + case 2 : mtmp->data = &white_dragon; + mtmp->dragon = 3; + break; + } + } else if (dice >=5) { + /* Uncommon dragons */ + switch (rn2(3)) { + case 0 : mtmp->data = &orange_dragon; + mtmp->dragon = 2; + break; + case 1 : mtmp->data = &blue_dragon; + mtmp->dragon = 5; + break; + case 2 : mtmp->data = &yellow_dragon; + mtmp->dragon = 7; + break; + } + } else if (dice >=2) { + /* Rare dragon */ + mtmp->data = &green_dragon; + mtmp->dragon = 6; + } else { + /* Very Rare dragon */ + mtmp->data = &black_dragon; + mtmp->dragon = 4; + } + #else mtmp->dragon = rn2(8); switch(mtmp->dragon) { case 0: mtmp->data = &grey_dragon; break; *************** *** 136,141 case 6: mtmp->data = &green_dragon; break; case 7: mtmp->data = &yellow_dragon; break; } } /* if gnome, make a gremlin or if gremlin make sure it stays gremlin */ if((ptr->mlet == 'G' && zlevel >= 10 && rn2(4)) || --- 176,182 ----- case 6: mtmp->data = &green_dragon; break; case 7: mtmp->data = &yellow_dragon; break; } + #endif /* DRAGONS */ } /* if gnome, make a gremlin or if gremlin make sure it stays gremlin */ if((ptr->mlet == 'G' && zlevel >= 10 && rn2(4)) || *** mkobj.c.orig Mon Jun 6 12:20:48 1988 --- mkobj.c Mon Jun 6 13:20:33 1988 *************** *** 59,64 } #endif struct obj * mkobj(let) { int realtype; --- 59,66 ----- } #endif + #ifdef DRAGONS + struct obj * mk_dead_dragon(dragon) { int realtype; *************** *** 60,65 #endif struct obj * mkobj(let) { int realtype; switch (let) { --- 62,113 ----- #ifdef DRAGONS struct obj * + mk_dead_dragon(dragon) { + int realtype; + realtype = DEAD_GREY_DRAGON + dragon; + return(mksobj(realtype)); + } + + struct obj * + mk_dead_dragon_at(x,y, dragon) + register int x,y, dragon; + { + register struct obj *otmp = mk_dead_dragon(dragon); + otmp->ox = x; + otmp->oy = y; + otmp->nobj = fobj; + fobj = otmp; + return(otmp); + } + + struct obj * + mk_named_dead_dragon (x, y, nm, lth, dragon) + /* used for Dragon Corpses */ + register x, y; + char * nm; + register int lth; + int dragon; + { + register struct obj *otmp; + register struct obj *obj2; + + if (lth == 0) return (mk_dead_dragon_at (x,y, dragon)); + + otmp = mk_dead_dragon(dragon); + obj2 = newobj(lth); + *obj2 = *otmp; + obj2->onamelth = lth; + (void) strcpy (ONAME(obj2), nm); + free( (char *)otmp); + obj2->ox = x; + obj2->oy = y; + obj2->nobj = fobj; + fobj = obj2; + return(obj2); + } + #endif + + struct obj * mkobj(let) { int realtype; switch (let) { *************** *** 70,75 case '3': { realtype = DEAD_SOLDIER; break; } case '9': { realtype = DEAD_GIANT; break; } case '&': { realtype = DEAD_DEMON; break; } default: realtype = letter(let) ? CORPSE + ((let>'Z') ? (let-'a'+'Z'-'@'+1) : (let-'@')) : probtype(let); --- 118,137 ----- case '3': { realtype = DEAD_SOLDIER; break; } case '9': { realtype = DEAD_GIANT; break; } case '&': { realtype = DEAD_DEMON; break; } + #ifdef DRAGONS + default: { + if (letter(let)) + if (let == 'D') + realtype = DEAD_GREY_DRAGON + rn2(7); + else + if (let >= 'E' && let <= 'z') + realtype = CORPSE + 7 + ((let>'Z') ? (let-'a'+'Z'-'@'+1) : (let-'@')); + else + realtype = CORPSE + (let-'@'); + else + realtype = probtype(let); + } + #else default: realtype = letter(let) ? CORPSE + ((let>'Z') ? (let-'a'+'Z'-'@'+1) : (let-'@')) : probtype(let); *************** *** 73,78 default: realtype = letter(let) ? CORPSE + ((let>'Z') ? (let-'a'+'Z'-'@'+1) : (let-'@')) : probtype(let); } return(mksobj(realtype)); } --- 135,141 ----- default: realtype = letter(let) ? CORPSE + ((let>'Z') ? (let-'a'+'Z'-'@'+1) : (let-'@')) : probtype(let); + #endif } return(mksobj(realtype)); } *************** *** 76,82 } return(mksobj(realtype)); } ! struct obj zeroobj; --- 139,145 ----- } return(mksobj(realtype)); } ! struct obj zeroobj; *** mon.c.orig Mon Jun 6 11:56:04 1988 --- mon.c Thu Jun 9 14:43:48 1988 *************** *** 6,11 extern struct monst *makemon(), *mkmon_at(); extern struct trap *maketrap(); extern struct obj *mkobj_at(), *mksobj_at(); extern char *hcolor(); #ifdef KAA extern boolean stoned; --- 6,15 ----- extern struct monst *makemon(), *mkmon_at(); extern struct trap *maketrap(); extern struct obj *mkobj_at(), *mksobj_at(); + #ifdef DRAGONS + extern struct obj *mk_dead_dragon(), *mk_dead_dragon_at(), + *mk_named_dead_dragon(); + #endif extern char *hcolor(); #ifdef KAA extern boolean stoned; *************** *** 675,680 #endif if(index("NTVm&w",mdat->mlet) || tmp2) { #ifndef RPH register struct obj *obj2 = mkobj_at(tmp,x,y); #else register struct obj *obj2; --- 679,691 ----- #endif if(index("NTVm&w",mdat->mlet) || tmp2) { #ifndef RPH + #ifdef DRAGONS + register struct obj *obj2; + if (tmp == 'D') + obj2 = mk_dead_dragon_at(x,y,mtmp->dragon); + else + obj2 = mkobj_at(tmp,x,y); + #else register struct obj *obj2 = mkobj_at(tmp,x,y); #endif #else *************** *** 676,681 if(index("NTVm&w",mdat->mlet) || tmp2) { #ifndef RPH register struct obj *obj2 = mkobj_at(tmp,x,y); #else register struct obj *obj2; if (letter(tmp)) --- 687,693 ----- obj2 = mkobj_at(tmp,x,y); #else register struct obj *obj2 = mkobj_at(tmp,x,y); + #endif #else register struct obj *obj2; if (letter(tmp)) *************** *** 678,684 register struct obj *obj2 = mkobj_at(tmp,x,y); #else register struct obj *obj2; ! if (letter(tmp)) obj2 = mk_named_obj_at(tmp, x, y, old_name, old_nlth); # ifdef KOPS --- 690,703 ----- #endif #else register struct obj *obj2; ! if (letter(tmp)) ! #ifdef DRAGONS ! if (tmp == 'D') { ! obj2 = mk_named_dead_dragon(x,y, ! old_name, old_nlth, ! mtmp->dragon); ! } else ! #endif obj2 = mk_named_obj_at(tmp, x, y, old_name, old_nlth); # ifdef KOPS *** pray.c.orig Tue Jun 7 15:03:38 1988 --- pray.c Tue Jun 7 15:04:27 1988 *************** *** 156,162 break; } } ! #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) --- 156,164 ----- break; } } ! #ifdef DRAGONS ! extern char CORPSE_I_TO_C(); ! #else #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) *************** *** 160,165 #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) extern char POISONOUS[]; --- 162,168 ----- #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) + #endif /* DRAGONS */ extern char POISONOUS[]; *************** *** 174,179 if(!otmp) return(0); ftmp = &objects[otmp->otyp]; #ifdef KAA if(otmp->otyp == DEAD_DEMON) let='&'; else if (otmp->otyp == DEAD_GIANT) let='9'; --- 177,183 ----- if(!otmp) return(0); ftmp = &objects[otmp->otyp]; + #ifndef DRAGONS #ifdef KAA if(otmp->otyp == DEAD_DEMON) let='&'; else if (otmp->otyp == DEAD_GIANT) let='9'; *************** *** 181,186 #else let = CORPSE_I_TO_C(otmp->otyp); #endif /* judge the food value by the nutrition, as well as some aging behavior */ --- 185,193 ----- #else let = CORPSE_I_TO_C(otmp->otyp); #endif + #else + let = CORPSE_I_TO_C(otmp->otyp); + #endif /* DRAGONS */ /* judge the food value by the nutrition, as well as some aging behavior */ *** zap.c.orig Wed Apr 20 10:33:11 1988 --- zap.c Tue Jun 7 15:16:36 1988 *************** *** 994,1000 mon->mhp -= tmp; return(tmp); } ! #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) --- 997,1005 ----- mon->mhp -= tmp; return(tmp); } ! #ifdef DRAGONS ! extern char CORPSE_I_TO_C(); ! #else #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) *************** *** 998,1003 #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) revive(obj) register struct obj *obj; { --- 1003,1010 ----- #define CORPSE_I_TO_C(otyp) (char) ((otyp >= DEAD_ACID_BLOB)\ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) + #endif /* DRAGONS */ + revive(obj) register struct obj *obj; { *************** *** 1005,1010 register int let; if(obj->olet == FOOD_SYM && obj->otyp > CORPSE) { #ifdef KAA switch (obj->otyp) { case DEAD_HUMAN: { let = 'Z'; break; } --- 1012,1018 ----- register int let; if(obj->olet == FOOD_SYM && obj->otyp > CORPSE) { + #ifndef DRAGONS #ifdef KAA switch (obj->otyp) { case DEAD_HUMAN: { let = 'Z'; break; } *************** *** 1031,1036 delobj(obj); mtmp = mkmon_at(CORPSE_I_TO_C(obj->otyp),obj->ox,obj->oy); #endif } return(!!mtmp); /* TRUE if some monster created */ } --- 1039,1054 ----- delobj(obj); mtmp = mkmon_at(CORPSE_I_TO_C(obj->otyp),obj->ox,obj->oy); #endif + #else + delobj(obj); + mtmp = mkmon_at(CORPSE_I_TO_C(obj->otyp),obj->ox,obj->oy); + #ifdef KAA + if (mtmp && obj->otyp == DEAD_HUMAN) { + mtmp->mhp = mtmp->mhpmax = 100; + mtmp->mspeed = MFAST; + } + #endif /* KAA */ + #endif /* DRAGONS */ } return(!!mtmp); /* TRUE if some monster created */ } *** objects.h.orig Thu Jun 9 17:48:56 1988 --- objects.h Mon Jun 6 16:21:28 1988 *************** *** 47,52 FOOD("dead giant ant", 0, 1, 3, 30), FOOD("dead giant bat", 0, 1, 3, 30), FOOD("dead centaur", 0, 5, 50, 500), FOOD("dead dragon", 0, 15, 150, 1500), FOOD("dead floating eye", 0, 1, 1, 10), FOOD("dead freezing sphere", 0, 1, 1, 10), --- 47,62 ----- FOOD("dead giant ant", 0, 1, 3, 30), FOOD("dead giant bat", 0, 1, 3, 30), FOOD("dead centaur", 0, 5, 50, 500), + #ifdef DRAGONS + FOOD("dead grey dragon", 0, 15, 150, 1500), + FOOD("dead red dragon", 0, 15, 150, 1500), + FOOD("dead orange dragon", 0, 15, 150, 1500), + FOOD("dead white dragon", 0, 15, 150, 1500), + FOOD("dead black dragon", 0, 15, 150, 1500), + FOOD("dead blue dragon", 0, 15, 150, 1500), + FOOD("dead green dragon", 0, 15, 150, 1500), + FOOD("dead yellow dragon", 0, 15, 150, 1500), + #else FOOD("dead dragon", 0, 15, 150, 1500), #endif FOOD("dead floating eye", 0, 1, 1, 10), *************** *** 48,53 FOOD("dead giant bat", 0, 1, 3, 30), FOOD("dead centaur", 0, 5, 50, 500), FOOD("dead dragon", 0, 15, 150, 1500), FOOD("dead floating eye", 0, 1, 1, 10), FOOD("dead freezing sphere", 0, 1, 1, 10), FOOD("dead gnome", 0, 1, 10, 100), --- 58,64 ----- FOOD("dead yellow dragon", 0, 15, 150, 1500), #else FOOD("dead dragon", 0, 15, 150, 1500), + #endif FOOD("dead floating eye", 0, 1, 1, 10), FOOD("dead freezing sphere", 0, 1, 1, 10), FOOD("dead gnome", 0, 1, 10, 100), *** config.h.orig Thu Jun 9 17:54:09 1988 --- config.h Thu Jun 9 17:54:05 1988 *************** *** 233,238 #define DOGRENADE /* Grenade code */ #define YODA /* Light Sword Code - JC Collet */ #define JCC /* Some change for display - JC Collet */ #if defined(MSDOS) && defined(GRAPHICS) #define TERMLIB /* enable use of termcap file c:\etc\termcap */ --- 233,239 ----- #define DOGRENADE /* Grenade code */ #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 */