/* various kinds of wishes */ void wish(int blessing) { int i; char wishstr[80]; clearmsg(); print1("What do you wish for? "); if (blessing < 0) deathprint(); else strcpy(wishstr,msgscanstring()); if (blessing < 0 || strcmp(wishstr,"Death")==0) { print2("As you wish, so shall it be."); p_death("a deathwish"); } if (strcmp(wishstr,"Power")==0) { print2("You feel a sudden surge of energy"); Player.mana=calcmana()*10; } else if (strcmp(wishstr,"Skill")==0) { print2("You feel more competent."); if (gamestatusp(CHEATED)) gain_experience(10000); else gain_experience(min(10000,Player.xp)); } else if (strcmp(wishstr,"Wealth")==0) { print2("You are submerged in shower of gold pieces!"); Player.cash += 10000; } else if (strcmp(wishstr,"Balance")==0) { print2("You feel neutral."); Player.alignment = 0; } else if (strcmp(wishstr,"Chaos")==0) { print2("You feel chaotic."); Player.alignment -= 25; } else if (strcmp(wishstr,"Law")==0) { print2("You feel lawful."); Player.alignment += 25; } else if (strcmp(wishstr,"Location")==0) strategic_teleport(1); else if (strcmp(wishstr,"Knowledge")==0) { print2("You feel more knowledgeable."); i = random_range(NUMSPELLS); if (Spells[i].known) Spells[i].powerdrain = (max(1,Spells[i].powerdrain/2)); else Spells[i].known = TRUE; } else if (strcmp(wishstr,"Health")==0) { print2("You feel vigorous"); Player.hp = max( Player.hp, Player.maxhp); Player.status[DISEASED] = 0; Player.status[POISONED] = 0; Player.food = 43; /* Wish for Health when starving does some good. PGM */ } else if (strcmp(wishstr,"Destruction")==0) annihilate(gamestatusp(CHEATED)); else if (strcmp(wishstr,"Acquisition")==0) acquire(gamestatusp(CHEATED)); else if (strcmp(wishstr,"Summoning")==0) summon(gamestatusp(CHEATED),-1); else if (strcmp(wishstr,"Stats") == 0 && gamestatusp(CHEATED)) { Player.str = Player.maxstr = Player.con = Player.maxcon = Player.agi = Player.maxagi = Player.dex = Player.maxdex = Player.iq = Player.maxiq = Player.pow = Player.maxpow = 200; calc_melee(); } else print2("You feel stupid."); dataprint(); showflags(); }
/* Attempt to break an object o */ int damage_item(Object* o) { /* special case -- break star gem */ if (o->id == OB_STARGEM) { print1("The Star Gem shatters into a million glistening shards...."); if (Current_Environment == E_STARPEAK) { if (!State.getKilledLawbringer()) print2("You hear an agonizing scream of anguish and despair."); morewait(); print1("A raging torrent of energy escapes in an explosion of magic!"); print2("The energy flows to the apex of Star Peak where there is"); morewait(); clearmsg(); print1("an enormous explosion!"); morewait(); annihilate(1); print3("You seem to gain strength in the chaotic glare of magic!"); Player.str = max(Player.str, Player.maxstr + 5); /* FIXED! 12/25/98 */ Player.pow = max(Player.pow, Player.maxpow + 5); /* ditto */ Player.alignment -= 200; dispose_lost_objects(1,o); } else { morewait(); print1("The shards coalesce back together again, and vanish"); print2("with a muted giggle."); dispose_lost_objects(1,o); Objects[o->id].uniqueness = UNIQUE_UNMADE; /* FIXED! 12/30/98 */ } return 1; } else { if (o->fragility < random_range(30)) { if (o->objchar == STICK && o->charge > 0) { strcpy(Str1,"Your "); strcat(Str1,(o->blessing >= 0 ? o->truename : o->cursestr)); strcat(Str1," explodes!"); print1(Str1); morewait(); nprint1(" Ka-Blamm!!!"); /* general case. Some sticks will eventually do special things */ morewait(); manastorm(Player.x, Player.y, o->charge*o->level*10); dispose_lost_objects(1,o); return 1; } else if ((o->blessing > 0) && (o->level > random_range(10))) { strcpy(Str1,"Your "); strcat(Str1,itemid(o)); strcat(Str1," glows strongly."); print1(Str1); return 0; } else if ((o->blessing < -1) && (o->level > random_range(10))) { strcpy(Str1,"You hear an evil giggle from your "); strcat(Str1,itemid(o)); print1(Str1); return 0; } else if (o->plus > 0) { strcpy(Str1,"Your "); strcat(Str1,itemid(o)); strcat(Str1," glows and then fades."); print1(Str1); o->plus--; return 0; } else { if (o->blessing > 0) print1("You hear a faint despairing cry!"); else if (o->blessing < 0) print1("You hear an agonized scream!"); strcpy(Str1,"Your "); strcat(Str1,itemid(o)); strcat(Str1," shatters in a thousand lost fragments!"); print2(Str1); morewait(); dispose_lost_objects(1,o); return 1; } } return 0; } }
/* function to read a scroll */ void read_scroll(int typ) { int i,j; if (typ<0 || typ>=MAXSCROLL) return; /* be sure we are within bounds */ if (scrollknown[typ] == 0) scrollknown[typ] = 1; lprintf("\nYou read a scroll of %s.", &(scrollname[typ][1])); switch(typ) { case SENCHANTARM: enchantarmor(ENCH_SCROLL); return; case SENCHANTWEAP: enchweapon(ENCH_SCROLL); return; case SENLIGHTEN: lflush(); 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 SBLANK: return; case SCREATEMONST: createmonster(makemonst(level+1)); return; case SCREATEITEM: something(playerx, playery, level); return; case SAGGMONST: c[AGGRAVATE]+=800; return; case STIMEWARP: /* * This code is slightly wrong in that, if gtime is small and * we can't go back by the required number of mobuls, it's * still reported that we did. I don't think this is * critical -- dmr */ i = (rnd(1000) - 850)/100; if (i==0) i=1; gtime += 100*i; if (gtime < 0) gtime = 0; lprintf("\nYou go %sward in time by %d mobul%s", (i<0)?"back":"for", (i<0)?-i:i, i==1?"":"s"); adjusttime((long)(i*100));/* adjust time for time warping */ return; case STELEPORT: oteleport(0); return; case SAWARENESS: c[AWARENESS] += 1800; return; case SHASTEMONST: c[HASTEMONST] += rnd(55)+12; lprintf(" You feel nervous."); return; case SMONSTHEAL: for (i=0; i<MAXY; i++) for (j=0; j<MAXX; j++) if (mitem[j][i].mon) hitp[j][i] = monster[mitem[j][i].mon].hitpoints; lprintf(" You feel uneasy."); return; case SSPIRITPROT: c[SPIRITPRO] += 300 + rnd(200); bottomline(); return; case SUNDEADPROT: c[UNDEADPRO] += 300 + rnd(200); bottomline(); return; case SSTEALTH: c[STEALTH] += 250 + rnd(250); bottomline(); return; case SMAGICMAP: lflush(); 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 SHOLDMONST: c[HOLDMONST] += 30; bottomline(); return; case SGEMPERFECT: for (i=0; i<IVENSIZE; i++) switch(iven[i]) { case ODIAMOND: case ORUBY: case OEMERALD: case OSAPPHIRE: j = ivenarg[i]; j *= 2; if (j <= 0 && ivenarg[i]) j=2550; ivenarg[i] = j; break; } break; case SSPELLEXT: for (i=0; i<11; i++) c[exten[i]] <<= 1; break; case SIDENTIFY: for (i=0; i<IVENSIZE; i++) { if (iven[i]==OPOTION) potionknown[ivenarg[i]] = 1; if (iven[i]==OSCROLL) scrollknown[ivenarg[i]] = 1; } break; case SREMCURSE: removecurse(); break; case SANNIHILATE: annihilate(); break; case SPULVERIZE: godirect(22,150,"The ray hits the %s.",0,' '); break; case SLIFEPROT: c[LIFEPROT]++; break; }; }