📄 object.c
字号:
case 19: lprcat("\nYou feel greedy . . ."); nap(2000); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) { k=item[j][i]; if ((k==ODIAMOND) || (k==ORUBY) || (k==OEMERALD) || (k==OMAXGOLD) || (k==OSAPPHIRE) || (k==OLARNEYE) || (k==OGOLDPILE)) { know[j][i]=1; show1cell(j,i); } } showplayer(); return; case 20: c[HP] = c[HPMAX]; break; /* instant healing */ case 1: lprcat("\nYou feel better"); if (c[HP] == c[HPMAX]) raisemhp(1); else if ((c[HP] += rnd(20)+20+c[LEVEL]) > c[HPMAX]) c[HP]=c[HPMAX]; break; case 2: lprcat("\nSuddenly, you feel much more skillful!"); raiselevel(); raisemhp(1); return; case 3: lprcat("\nYou feel strange for a moment"); c[rund(6)]++; break; case 4: lprcat("\nYou feel more self confident!"); c[WISDOM] += rnd(2); break; case 5: lprcat("\nWow! You feel great!"); if (c[STRENGTH]<12) c[STRENGTH]=12; else c[STRENGTH]++; break; case 6: lprcat("\nYour charm went up by one!"); c[CHARISMA]++; break; case 8: lprcat("\nYour intelligence went up by one!"); c[INTELLIGENCE]++; break; case 10: for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) if (mitem[j][i]) { know[j][i]=1; show1cell(j,i); } /* monster detection */ return; case 12: lprcat("\nThis potion has no taste to it"); return; case 15: lprcat("\nWOW!!! You feel Super-fantastic!!!"); if (c[HERO]==0) for (i=0; i<6; i++) c[i] += 11; c[HERO] += 250; break; case 16: lprcat("\nYou have a greater intestinal constitude!"); c[CONSTITUTION]++; break; case 17: lprcat("\nYou now have incredibly bulging muscles!!!"); if (c[GIANTSTR]==0) c[STREXTRA] += 21; c[GIANTSTR] += 700; break; case 18: lprcat("\nYou feel a chill run up your spine!"); c[FIRERESISTANCE] += 1000; break; case 0: lprcat("\nYou fall asleep. . ."); i=rnd(11)-(c[CONSTITUTION]>>2)+2; while(--i>0) { parse2(); nap(1000); } cursors(); lprcat("\nYou woke up!"); return; case 7: lprcat("\nYou become dizzy!"); if (--c[STRENGTH] < 3) c[STRENGTH]=3; break; case 11: lprcat("\nYou stagger for a moment . ."); for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) know[j][i]=0; nap(2000); draws(0,MAXX,0,MAXY); /* potion of forgetfulness */ return; case 13: lprcat("\nYou can't see anything!"); /* blindness */ c[BLINDCOUNT]+=500; return; case 14: lprcat("\nYou feel confused"); c[CONFUSE]+= 20+rnd(9); return; case 21: lprcat("\nYou don't seem to be affected"); return; /* cure dianthroritis */ case 22: lprcat("\nYou feel a sickness engulf you"); /* poison */ c[HALFDAM] += 200 + rnd(200); return; case 23: lprcat("\nYou feel your vision sharpen"); /* see invisible */ c[SEEINVISIBLE] += rnd(1000)+400; monstnamelist[INVISIBLESTALKER] = 'I'; return; }; bottomline(); /* show new stats */ return; }/* ******* OSCROLL ******* function to process a magic scroll */oscroll(typ) int typ; { lprcat("\nDo you "); if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts(); while (1) switch(getchar()) { case '\33': case 'i': ignore(); return; case 'r': if (c[BLINDCOUNT]) break; lprcat("read"); forget(); if (typ==2 || typ==15) { show1cell(playerx,playery); cursors(); } /* destroy it */ read_scroll(typ); return; case 't': lprcat("take"); if (take(OSCROLL,typ)==0) forget(); /* destroy it */ return; }; }/* data for the function to read a scroll */static int xh,yh,yl,xl;static char curse[] = { BLINDCOUNT, CONFUSE, AGGRAVATE, HASTEMONST, ITCHING, LAUGHING, DRAINSTRENGTH, CLUMSINESS, INFEEBLEMENT, HALFDAM };static char exten[] = { PROTECTIONTIME, DEXCOUNT, STRCOUNT, CHARMCOUNT, INVISIBILITY, CANCELLATION, HASTESELF, GLOBE, SCAREMONST, HOLDMONST, TIMESTOP };char time_change[] = { HASTESELF,HERO,ALTPRO,PROTECTIONTIME,DEXCOUNT, STRCOUNT,GIANTSTR,CHARMCOUNT,INVISIBILITY,CANCELLATION, HASTESELF,AGGRAVATE,SCAREMONST,STEALTH,AWARENESS,HOLDMONST,HASTEMONST, FIRERESISTANCE,GLOBE,SPIRITPRO,UNDEADPRO,HALFDAM,SEEINVISIBLE, ITCHING,CLUMSINESS, WTW };/* * function to adjust time when time warping and taking courses in school */adjtime(tim) register long tim; { register int j; for (j=0; j<26; j++) /* adjust time related parameters */ if (c[time_change[j]]) if ((c[time_change[j]] -= tim) < 1) c[time_change[j]]=1; regen(); }/* function to read a scroll */read_scroll(typ) int typ; { register int i,j; if (typ<0 || typ>=MAXSCROLL) return; /* be sure we are within bounds */ scrollname[typ][0] = ' '; switch(typ) { case 0: lprcat("\nYour armor glows for a moment"); enchantarmor(); return; case 1: lprcat("\nYour weapon glows for a moment"); enchweapon(); return; /* enchant weapon */ case 2: lprcat("\nYou have been granted enlightenment!"); yh = min(playery+7,MAXY); xh = min(playerx+25,MAXX); yl = max(playery-7,0); xl = max(playerx-25,0); for (i=yl; i<yh; i++) for (j=xl; j<xh; j++) know[j][i]=1; nap(2000); draws(xl,xh,yl,yh); return; case 3: lprcat("\nThis scroll seems to be blank"); return; case 4: createmonster(makemonst(level+1)); return; /* this one creates a monster */ case 5: something(level); /* create artifact */ return; case 6: c[AGGRAVATE]+=800; return; /* aggravate monsters */ case 7: gtime += (i = rnd(1000) - 850); /* time warp */ if (i>=0) lprintf("\nYou went forward in time by %d mobuls",(long)((i+99)/100)); else lprintf("\nYou went backward in time by %d mobuls",(long)(-(i+99)/100)); adjtime((long)i); /* adjust time for time warping */ return; case 8: oteleport(0); return; /* teleportation */ case 9: c[AWARENESS] += 1800; return; /* expanded awareness */ case 10: c[HASTEMONST] += rnd(55)+12; return; /* haste monster */ case 11: for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) if (mitem[j][i]) hitp[j][i] = monster[mitem[j][i]].hitpoints; return; /* monster healing */ case 12: c[SPIRITPRO] += 300 + rnd(200); bottomline(); return; /* spirit protection */ case 13: c[UNDEADPRO] += 300 + rnd(200); bottomline(); return; /* undead protection */ case 14: c[STEALTH] += 250 + rnd(250); bottomline(); return; /* stealth */ case 15: lprcat("\nYou have been granted enlightenment!"); /* magic mapping */ for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) know[j][i]=1; nap(2000); draws(0,MAXX,0,MAXY); return; case 16: c[HOLDMONST] += 30; bottomline(); return; /* hold monster */ case 17: for (i=0; i<26; i++) /* gem perfection */ switch(iven[i]) { case ODIAMOND: case ORUBY: case OEMERALD: case OSAPPHIRE: j = ivenarg[i]; j &= 255; j <<= 1; if (j > 255) j=255; /* double value */ ivenarg[i] = j; break; } break; case 18: for (i=0; i<11; i++) c[exten[i]] <<= 1; /* spell extension */ break; case 19: for (i=0; i<26; i++) /* identify */ { if (iven[i]==OPOTION) potionname[ivenarg[i]][0] = ' '; if (iven[i]==OSCROLL) scrollname[ivenarg[i]][0] = ' '; } break; case 20: for (i=0; i<10; i++) /* remove curse */ if (c[curse[i]]) c[curse[i]] = 1; break; case 21: annihilate(); break; /* scroll of annihilation */ case 22: godirect(22,150,"The ray hits the %s",0,' '); /* pulverization */ break; case 23: c[LIFEPROT]++; break; /* life protection */ }; }oorb() { }opit() { register int i; if (rnd(101)<81) if (rnd(70) > 9*c[DEXTERITY]-packweight() || rnd(101)<5) if (level==MAXLEVEL-1) obottomless(); else if (level==MAXLEVEL+MAXVLEVEL-1) obottomless(); else { if (rnd(101)<20) { i=0; lprcat("\nYou fell into a pit! Your fall is cushioned by an unknown force\n"); } else { i = rnd(level*3+3); lprintf("\nYou fell into a pit! You suffer %d hit points damage",(long)i); lastnum=261; /* if he dies scoreboard will say so */ } losehp(i); nap(2000); newcavelevel(level+1); draws(0,MAXX,0,MAXY); } }obottomless() { lprcat("\nYou fell into a bottomless pit!"); beep(); nap(3000); died(262); }oelevator(dir) int dir; {#ifdef lint int x; x=dir; dir=x;#endif lint }ostatue() { }omirror() { }obook() { lprcat("\nDo you "); if (c[BLINDCOUNT]==0) lprcat("(r) read it, "); lprcat("(t) take it"); iopts(); while (1) switch(getchar()) { case '\33': case 'i': ignore(); return; case 'r': if (c[BLINDCOUNT]) break; lprcat("read"); /* no more book */ readbook(iarg[playerx][playery]); forget(); return; case 't': lprcat("take"); if (take(OBOOK,iarg[playerx][playery])==0) forget(); /* no more book */ return; }; }/* function to read a book */readbook(lev) register int lev; { register int i,tmp; if (lev<=3) i = rund((tmp=splev[lev])?tmp:1); else i = rnd((tmp=splev[lev]-9)?tmp:1) + 9; spelknow[i]=1; lprintf("\nSpell \"%s\": %s\n%s",spelcode[i],spelname[i],speldescript[i]); if (rnd(10)==4) { lprcat("\nYour int went up by one!"); c[INTELLIGENCE]++; bottomline(); } }ocookie() { char *p; lprcat("\nDo you (e) eat it, (t) take it"); iopts(); while (1) switch(getchar()) { case '\33': case 'i': ignore(); return; case 'e': lprcat("eat\nThe cookie tasted good."); forget(); /* no more cookie */ if (c[BLINDCOUNT]) return; if (!(p=fortune(fortfile))) return; lprcat(" A message inside the cookie reads:\n"); lprcat(p); return; case 't': lprcat("take"); if (take(OCOOKIE,0)==0) forget(); /* no more book */ return; }; }/* routine to pick up some gold -- if arg==OMAXGOLD then the pile is worth 100* the argument */ogold(arg) int arg; { register long i; i = iarg[playerx][playery]; if (arg==OMAXGOLD) i *= 100; else if (arg==OKGOLD) i *= 1000; else if (arg==ODGOLD) i *= 10; lprintf("\nIt is worth %d!",(long)i); c[GOLD] += i; bottomgold(); item[playerx][playery] = know[playerx][playery] = 0; /* destroy gold */ }ohome() { register int i; nosignal = 1; /* disable signals */ for (i=0; i<26; i++) if (iven[i]==OPOTION) if (ivenarg[i]==21) { iven[i]=0; /* remove the potion of cure dianthroritis from inventory */ clear(); lprcat("Congratulations. You found a potion of cure dianthroritis.\n"); lprcat("\nFrankly, No one thought you could do it. Boy! Did you surprise them!\n"); if (gtime>TIMELIMIT) { lprcat("\nThe doctor has the sad duty to inform you that your daughter died!\n"); lprcat("You didn't make it in time. In your agony, you kill the doctor,\nyour wife, and yourself! Too bad!\n"); nap(5000); died(269); } else { lprcat("\nThe doctor is now administering the potion, and in a few moments\n"); lprcat("Your daughter should be well on her way to recovery.\n"); nap(6000); lprcat("\nThe potion is"); nap(3000); lprcat(" working! The doctor thinks that\n"); lprcat("your daughter will recover in a few days. Congratulations!\n"); beep(); nap(5000); died(263); } } while (1) { clear(); lprintf("Welcome home %s. Latest word from the doctor is not good.\n",logname); if (gtime>TIMELIMIT) { lprcat("\nThe doctor has the sad duty to inform you that your daughter died!\n"); lprcat("You didn't make it in time. In your agony, you kill the doctor,\nyour wife, and yourself! Too bad!\n"); nap(5000); died(269); } lprcat("\nThe diagnosis is confirmed as dianthroritis. He guesses that\n"); lprintf("your daughter has only %d mobuls left in this world. It's up to you,\n",(long)((TIMELIMIT-gtime+99)/100)); lprintf("%s, to find the only hope for your daughter, the very rare\n",logname); lprcat("potion of cure dianthroritis. It is rumored that only deep in the\n"); lprcat("depths of the caves can this potion be found.\n\n\n"); lprcat("\n ----- press "); standout("return"); lprcat(" to continue, "); standout("escape"); lprcat(" to leave ----- "); i=getchar(); while (i!='\33' && i!='\n') i=getchar(); if (i=='\33') { drawscreen(); nosignal = 0; /* enable signals */ return; } } }/* routine to save program space */iopts() { lprcat(", or (i) ignore it? "); }ignore() { lprcat("ignore\n"); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -