/* subroutine to randomly create monsters if needed */ static void randmonst(void) { if (c[TIMESTOP]) return; /* don't make monsters if time is stopped */ if (--rmst <= 0) { rmst = 120 - (level << 2); fillmonst(makemonst(level)); } }
/* * mmove(x,y,xd,yd) Function to actually perform the monster movement * int x,y,xd,yd; * * Enter with the from coordinates in (x,y) and the destination coordinates * in (xd,yd). */ static void mmove(int aa, int bb, int cc, int dd) { int tmp,i,flag; char *who = ""; char *p = ""; flag=0; /* set to 1 if monster hit by arrow trap */ if ((cc==playerx) && (dd==playery)) { hitplayer(aa,bb); return; } i=item[cc][dd]; if ((i==OPIT) || (i==OTRAPDOOR)) switch(mitem[aa][bb]) { case BAT: case EYE: case SPIRITNAGA: case PLATINUMDRAGON: case WRAITH: case VAMPIRE: case SILVERDRAGON: case POLTERGEIST: case DEMONLORD: case DEMONLORD+1: case DEMONLORD+2: case DEMONLORD+3: case DEMONLORD+4: case DEMONLORD+5: case DEMONLORD+6: case DEMONPRINCE: break; default: mitem[aa][bb]=0; /* fell in a pit or trapdoor */ }; tmp = mitem[aa][bb]; mitem[cc][dd] = tmp; if (i==OANNIHILATION) { if (tmp>=DEMONLORD+3) /* demons dispel spheres */ { cursors(); lprintf("\nThe %s dispels the sphere!",monster[tmp].name); rmsphere(cc,dd); /* delete the sphere */ } else mitem[cc][dd]=i=tmp=0; } stealth[cc][dd]=1; if ((hitp[cc][dd] = hitp[aa][bb]) < 0) hitp[cc][dd]=1; mitem[aa][bb] = 0; if (tmp == LEPRECHAUN) switch(i) { case OGOLDPILE: case OMAXGOLD: case OKGOLD: case ODGOLD: case ODIAMOND: case ORUBY: case OEMERALD: case OSAPPHIRE: item[cc][dd] = 0; /* leprechaun takes gold */ }; if (tmp == TROLL) /* if a troll regenerate him */ if ((gtime & 1) == 0) if (monster[tmp].hitpoints > hitp[cc][dd]) hitp[cc][dd]++; if (i==OTRAPARROW) /* arrow hits monster */ { who = "An arrow"; if ((hitp[cc][dd] -= rnd(10)+level) <= 0) { mitem[cc][dd]=0; flag=2; } else flag=1; } if (i==ODARTRAP) /* dart hits monster */ { who = "A dart"; if ((hitp[cc][dd] -= rnd(6)) <= 0) { mitem[cc][dd]=0; flag=2; } else flag=1; } if (i==OTELEPORTER) /* monster hits teleport trap */ { flag=3; fillmonst(mitem[cc][dd]); mitem[cc][dd]=0; } if (cdesc[BLINDCOUNT]) return; /* if blind don't show where monsters are */ if (know[cc][dd] & HAVESEEN) { p=0; if (flag) cursors(); switch(flag) { case 1: p="\n%s hits the %s"; break; case 2: p="\n%s hits and kills the %s"; break; case 3: p="\nThe %s%s gets teleported"; who=""; break; }; if (p) { lprintf(p,who,monster[tmp].name); } } /* if (yrepcount>1) { know[aa][bb] &= 2; know[cc][dd] &= 2; return; } */ if (know[aa][bb] & HAVESEEN) show1cell(aa,bb); if (know[cc][dd] & HAVESEEN) show1cell(cc,dd); }