void activate() { int index; char response; clearmsg(); print1("Activate -- item [i] or artifact [a] or quit [ESCAPE]?"); do response = (char) mcigetc(); while ((response != 'i') && (response != 'a') && (response != ESCAPE)); if (response != ESCAPE) { if (response == 'i') index = getitem(THING); else if (response == 'a') index = getitem(ARTIFACT); if (index != ABORT) { clearmsg(); print1("You activate it.... "); morewait(); item_use(Player.possessions[index]); } else setgamestatus(SKIP_MONSTERS); } else setgamestatus(SKIP_MONSTERS); }
/* read a scroll, book, tome, etc. */ void peruse() { int index; struct object *obj; clearmsg(); if (Player.status[BLINDED] > 0) print3("You're blind -- you can't read!!!"); else if (Player.status[AFRAID] > 0) print3("You are too afraid to stop to read a scroll!"); else { print1("Read -- "); index = getitem(SCROLL); if (index == ABORT) setgamestatus(SKIP_MONSTERS); else { obj = Player.possessions[index]; if (obj->objchar != SCROLL) { print3("There's nothing written on "); nprint3(itemid(obj)); } else { nprint1("You carefully unfurl the scroll...."); morewait(); item_use(obj); dispose_lost_objects(1,obj); } } } }
void eat() { int index; struct object *obj; clearmsg(); print1("Eat --"); index = getitem(FOOD); if (index == ABORT) setgamestatus(SKIP_MONSTERS); else { obj = Player.possessions[index]; if ((obj->objchar != FOOD)&&(obj->objchar != CORPSE)) { print3("You can't eat "); nprint3(itemid(obj)); } else { if (obj->usef == I_FOOD) Player.food = max(0,Player.food+obj->aux); item_use(obj); dispose_lost_objects(1,obj); if (Current_Dungeon == E_COUNTRYSIDE) { Time += 100; hourly_check(); } } } foodcheck(); }
void l_void_station(void) { int i,something=FALSE; if (cinema_confirm("You're about to Peter Pan into an endless void.")=='y') { if (Level->mlist == NULL) { print2("You fall forever. Eventually you die of starvation."); morewait(); while(Player.hp>0) { Time+=60; hourly_check(); usleep(250000); } } else { print1("You enter the void."); print2("You feel a sudden surge of power from five directions."); morewait(); something = (Player.packptr > 0); if (! something) for(i=0;((i<MAXITEMS)&&(!something));i++) if (Player.possessions[i] != NULL) something = TRUE; if (something) { print1("The flow of power is disrupted by something!"); print2("The power is unbalanced! You lose control!"); morewait(); print1("Each of your cells explodes with a little scream of pain."); print2("Your disrupted essence merges with the megaflow."); p_death("the Power of the Void"); } else if (! gamestatusp(PREPARED_VOID)){ print1("The hungry void swallows you whole!"); print2("Your being dissipates with a pathetic little sigh...."); p_death("the Emptyness of the Void"); } else { print1("The flow of power rages through your body,"); print2("but you manage to master the surge!"); print3("You feel adept...."); morewait();clearmsg(); print1("With a thought, you soar up through the void to the"); print2("place from whence you came."); print3("As the platform of the Challenge dwindles beneath you"); morewait(); clearmsg(); print1("You see Death raise his scythe to you in a salute."); Player.rank[ADEPT] = 1; setgamestatus(COMPLETED_CHALLENGE); FixedPoints = calc_points(); /* set so change_environment puts player in correct temple! */ Player.x = 49; Player.y = 59; print2("You find yourself back in the Temple of Destiny."); morewait(); change_environment(E_TEMPLE); } } } else print2("You back away from the edge...."); }
void identify(int blessing) { int index; clearmsg(); if (blessing == 0) { index = getitem_prompt("Identify: ", NULL_ITEM); if (index == CASHVALUE) print3("Your money is really money."); else if (index == ABORT) setgamestatus(SKIP_MONSTERS); else { if (Player.possessions[index]->objchar == FOOD) Player.possessions[index]->known = 1; else { Player.possessions[index]->known = 2; Objects[Player.possessions[index]->id].known = 1; } print1("Identified: "); mprint(itemid(Player.possessions[index])); } } else if (blessing < 0) { print2("You feel forgetful."); for (index=0; index<MAXITEMS; index++) if (Player.possessions[index] != NULL) { Player.possessions[index]->known = 0; Objects[Player.possessions[index]->id].known = 0; } } else { print2("You feel encyclopaedic."); for (index=0; index<MAXITEMS; index++) if (Player.possessions[index] != NULL) { if (Player.possessions[index]->objchar == FOOD) Player.possessions[index]->known = 1; else { Player.possessions[index]->known = 2; Objects[Player.possessions[index]->id].known = 1; } } for (index=0; index<Player.packptr; index++) if (Player.pack[index] != NULL) { if (Player.pack[index]->objchar == FOOD) Player.pack[index]->known = 1; else { Player.pack[index]->known = 2; Objects[Player.pack[index]->id].known = 1; } } } calc_melee(); }
void l_enter_court(void) { print1("You have found a magical portal! Enter it? [yn] "); if (ynq1()=='y') { if (! gamestatusp(COMPLETED_CASTLE)) { if (! gamestatusp(ATTACKED_ORACLE)) { print2("A dulcet voice says: 'Jolly good show!'"); morewait(); } setgamestatus(COMPLETED_CASTLE); } change_environment(E_COURT); } }
void quaff() { int index; struct object *obj; clearmsg(); print1("Quaff --"); index = getitem(POTION); if (index == ABORT) setgamestatus(SKIP_MONSTERS); else { obj = Player.possessions[index]; if (obj->objchar != POTION) { print3("You can't drink "); nprint3(itemid(obj)); } else { print1("You drink it down.... "); item_use(obj); morewait(); dispose_lost_objects(1,obj); } } }
/* enchant */ void enchant(int delta) { int i,used = FALSE; long change_cash; if (delta < 0) { i = random_item(); if (i == ABORT || Player.possessions[i]->usef == I_NOTHING || Player.possessions[i]->usef == I_NO_OP || Player.possessions[i]->usef == I_NORMAL_ARMOR || Player.possessions[i]->usef == I_NORMAL_WEAPON || Player.possessions[i]->usef == I_NORMAL_SHIELD || Player.possessions[i]->objchar == FOOD || Player.possessions[i]->objchar == MISSILEWEAPON) { print1("You feel fortunate."); morewait(); } else if (Player.possessions[i]->blessing < 0 || (Player.possessions[i]->objchar == ARTIFACT && random_range(3))) { if (Player.possessions[i]->uniqueness == COMMON) print1("Your "); nprint1(itemid(Player.possessions[i])); nprint1(" glows, but the glow flickers out..."); morewait(); } else { used = (Player.possessions[i]->used); if (used) { Player.possessions[i]->used = FALSE; item_use(Player.possessions[i]); } if (Player.possessions[i]->uniqueness == COMMON) print1("Your "); nprint1(itemid(Player.possessions[i])); nprint1(" radiates an aura of mundanity!"); morewait(); Player.possessions[i]->plus = 0; Player.possessions[i]->charge = -1; Player.possessions[i]->usef = I_NOTHING; if (used) { Player.possessions[i]->used = TRUE; item_use(Player.possessions[i]); } } } else { i = getitem(CASH); if (i == ABORT) { print1("You feel unlucky."); morewait(); } else if (i == CASHVALUE) { print1("You enchant your money.... What a concept!"); change_cash = Player.cash*(random_range(7) - 3)/6; if (change_cash > 0) print2("Seems to have been a good idea!"); else print2("Maybe it wasn't such a good idea...."); Player.cash += change_cash; morewait(); } else if (Player.possessions[i]->objchar == ARTIFACT) { if (Player.possessions[i]->usef != Objects[Player.possessions[i]->id].usef) { print1("It re-acquires its magical aura!"); Player.possessions[i]->usef = Objects[Player.possessions[i]->id].usef; } else { print1("The enchantment spell enfolds the "); nprint1(itemid(Player.possessions[i])); print2("and the potent enchantment of the Artifact causes a backlash!"); morewait(); clearmsg(); manastorm(Player.x,Player.y,Player.possessions[i]->level*5); } } else { if (Player.possessions[i]->plus > random_range(20)+1) { print1("Uh-oh, the force of the enchantment was too much!"); print2("There is a loud explosion!"); morewait(); manastorm(Player.x,Player.y,Player.possessions[i]->plus*5); dispose_lost_objects(1,Player.possessions[i]); } else { used = (Player.possessions[i]->used); if (used) { setgamestatus(SUPPRESS_PRINTING); Player.possessions[i]->used = FALSE; item_use(Player.possessions[i]); resetgamestatus(SUPPRESS_PRINTING); } print1("The item shines!"); morewait(); Player.possessions[i]->plus += delta+1; if (Player.possessions[i]->charge > -1) Player.possessions[i]->charge += ((delta+1) * (random_range(10) + 1)); if (used) { setgamestatus(SUPPRESS_PRINTING); Player.possessions[i]->used = TRUE; item_use(Player.possessions[i]); resetgamestatus(SUPPRESS_PRINTING); } } } calc_melee(); } }
/* bless */ void bless(int blessing) { int index,used; if (blessing < 0) { index = random_item(); if (index == ABORT) { print1("You feel fortunate."); morewait(); } else { print1("A foul odor arises from "); if (Player.possessions[index]->uniqueness == COMMON) nprint1("your "); nprint1(itemid(Player.possessions[index])); morewait(); used = (Player.possessions[index]->used); if (used) { setgamestatus(SUPPRESS_PRINTING); Player.possessions[index]->used = FALSE; item_use(Player.possessions[index]); resetgamestatus(SUPPRESS_PRINTING); } Player.possessions[index]->blessing -= 2; if (Player.possessions[index]->blessing < 0) Player.possessions[index]->plus = abs(Player.possessions[index]->plus) - 1; if (used) { setgamestatus(SUPPRESS_PRINTING); Player.possessions[index]->used = TRUE; item_use(Player.possessions[index]); resetgamestatus(SUPPRESS_PRINTING); } } } else { index = getitem(NULL_ITEM); if (index == CASHVALUE) { print1("Blessing your money has no effect."); morewait(); } else if (index != ABORT) { used = (Player.possessions[index]->used == TRUE); if (used) { setgamestatus(SUPPRESS_PRINTING); Player.possessions[index]->used = FALSE; item_use(Player.possessions[index]); resetgamestatus(SUPPRESS_PRINTING); } print1("A pure white light surrounds the item... "); if (Player.possessions[index]->blessing < 0-(blessing+1)) { print2("which is evil enough to resist the effect of the blessing!"); morewait(); } else if (Player.possessions[index]->blessing < -1) { print2("which disintegrates under the influence of the holy aura!"); morewait(); Player.itemweight -= Player.possessions[index]->weight; dispose_lost_objects(1,Player.possessions[index]); } else if (Player.possessions[index]->blessing < blessing+1) { print2("which now seems affected by afflatus!"); morewait(); Player.possessions[index]->blessing++; Player.possessions[index]->plus = abs(Player.possessions[index]->plus)+1; } else { print2("The hierolux fades without any appreciable effect...."); morewait(); } if (used && (Player.possessions[index] != NULL)) { setgamestatus(SUPPRESS_PRINTING); Player.possessions[index]->used = TRUE; item_use(Player.possessions[index]); resetgamestatus(SUPPRESS_PRINTING); } } } calc_melee(); }
void l_order(void) { pob newitem; pml ml; print1("The Headquarters of the Order of Paladins."); morewait(); if ((Player.rank[ORDER]==PALADIN) && (Player.level > Justiciarlevel) && gamestatusp(GAVE_STARGEM) && Player.alignment > 300) { print1("You have succeeded in your quest!"); morewait(); print1("The previous Justiciar steps down in your favor."); print2("You are now the Justiciar of Rampart and the Order!"); strcpy(Justiciar,Player.name); for (ml = Level->mlist; ml && (ml->m->id != HISCORE_NPC || ml->m->aux2 != 15); ml = ml->next) /* just scan for current Justicar */; if (ml) { m_remove(ml->m); /* signals "death" -- no credit to player, though */ } Justiciarlevel = Player.level; morewait(); Justiciarbehavior = fixnpc(4); save_hiscore_npc(15); clearmsg(); print1("You are awarded a blessed shield of deflection!"); morewait(); newitem = ((pob) checkmalloc(sizeof(objtype))); *newitem = Objects[OB_DEFLECT]; /* shield of deflection */ newitem->blessing = 9; gain_item(newitem); morewait(); Player.rank[ORDER] = JUSTICIAR; Player.maxstr += 5; Player.str += 5; Player.maxpow += 5; Player.pow += 5; } if (Player.alignment < 1) { if (Player.rank[ORDER] > 0) { print1("You have been tainted by chaos!"); print2("You are stripped of your rank in the Order!"); morewait(); Player.rank[ORDER]= -1; send_to_jail(); } else print1("Get thee hence, minion of chaos!"); } else if (Player.rank[ORDER] == -1) print1("Thou again? Get thee hence, minion of chaos!"); else if (Player.rank[ORDER] == 0) { if (Player.rank[ARENA] != 0) print1("We do not accept bloodstained gladiators into our Order."); else if (Player.rank[LEGION] != 0) print1("Go back to your barracks, mercenary!"); else { print1("Dost thou wish to join our Order? [yn] "); if (ynq1()=='y') { print1("Justiciar "); nprint1(Justiciar); nprint1(" welcomes you to the Order."); print2("'Mayest thou always follow the sublime path of Law.'"); morewait(); print1("You are now a Gallant in the Order."); print2("You are given a horse and a blessed spear."); morewait(); Player.rank[ORDER] = GALLANT; Player.guildxp[ORDER] = 1; setgamestatus(MOUNTED); newitem = ((pob) checkmalloc(sizeof(objtype))); *newitem = Objects[OB_SPEAR]; /* spear */ newitem->blessing = 9; newitem->plus = 1; newitem->known = 2; gain_item(newitem); } } } else { print1("'Welcome back, Paladin.'"); if (!gamestatusp(MOUNTED)) { print2("You are given a new steed."); setgamestatus(MOUNTED); } morewait(); clearmsg(); if ((Player.hp < Player.maxhp) || (Player.status[DISEASED]) || (Player.status[POISONED])) print1("Your wounds are treated by a medic."); cleanse(0); Player.hp = Player.maxhp; if ( Player.food <= 40 ) { Player.food = 40; print2("You get a hot meal from the refectory."); } morewait(); clearmsg(); if (Player.rank[ORDER]==PALADIN) { if (Player.level <= Justiciarlevel) print2("You are not experienced enough to advance."); else if (Player.alignment < 300) print2("You are not sufficiently Lawful as yet to advance."); else print2("You must give the Star Gem to the LawBringer."); } else if (Player.rank[ORDER]==CHEVALIER) { if (Player.guildxp[ORDER] < 4000) print2("You are not experienced enough to advance."); else if (Player.alignment < 200) print2("You are not sufficiently Lawful as yet to advance."); else { print1("You are made a Paladin of the Order!"); print2("You learn the Spell of Heroism and get Mithril Plate!"); morewait(); newitem = ((pob) checkmalloc(sizeof(objtype))); *newitem = Objects[OB_MITHRIL_PLATE]; /* mithril plate armor */ newitem->blessing = 9; newitem->known = 2; gain_item(newitem); morewait(); clearmsg(); print1("To advance you must rescue the Star Gem and return it"); print2("to its owner, the LawBringer, who resides on Star Peak."); morewait(); print1("The Star Gem was stolen by the cursed Prime Sorceror,"); print2("whose headquarters may be found beyond the Astral Plane."); morewait(); print1("The Oracle will send you to the Astral Plane if you"); print2("prove yourself worthy to her."); morewait(); Spells[S_HERO].known = TRUE; Player.rank[ORDER] = PALADIN; } } else if (Player.rank[ORDER]==GUARDIAN) { if (Player.guildxp[ORDER] < 1500) print2("You are not experienced enough to advance."); else if (Player.alignment < 125) print2("You are not yet sufficiently Lawful to advance."); else { Player.rank[ORDER] = CHEVALIER; print1("You are made a Chevalier of the Order!"); print2("You are given a Mace of Disruption!"); morewait(); clearmsg(); newitem = ((pob) checkmalloc(sizeof(objtype))); *newitem = Objects[OB_MACE_DISRUPT]; /* mace of disruption */ newitem->known = 2; gain_item(newitem); } } else if (Player.rank[ORDER]==GALLANT) { if (Player.guildxp[ORDER] < 400) print2("You are not experienced enough to advance."); else if (Player.alignment < 50) print2("You are not Lawful enough to advance."); else { print1("You are made a Guardian of the Order of Paladins!"); print2("You are given a Holy Hand Grenade (of Antioch)."); morewait(); print1("You hear a nasal monotone in the distance...."); print2("'...and the number of thy counting shall be 3...'"); morewait(); clearmsg(); Player.rank[ORDER] = GUARDIAN; newitem = ((pob) checkmalloc(sizeof(objtype))); *newitem = Objects[OB_ANTIOCH]; /* holy hand grenade. */ newitem->known = 2; gain_item(newitem); } } } showflags(); }
/* deal with a new player command in dungeon or city mode*/ void p_process(void) { static int searchval=0; if (Player.status[BERSERK]) if (goberserk()) { setgamestatus(SKIP_PLAYER); drawvision(Player.x,Player.y); } if (! gamestatusp(SKIP_PLAYER)) { if (searchval > 0) { searchval--; if (searchval == 0) resetgamestatus(FAST_MOVE); } drawvision(Player.x,Player.y); if (! gamestatusp(FAST_MOVE)) { searchval = 0; Cmd = mgetc(); clear_if_necessary(); } Command_Duration = 0; switch (Cmd) { case ' ': case 13: setgamestatus(SKIP_MONSTERS); break; /*no op on space or return*/ case 6: abortshadowform(); break; /* ^f */ case 7: wizard(); break; /* ^g */ case 4: player_dump(); break; /* ^d */ case 9: display_pack(); morewait(); xredraw(); break; /* ^i */ case 11: if (gamestatusp(CHEATED)) frobgamestatus(); break; case 12: xredraw(); setgamestatus(SKIP_MONSTERS); break; /* ^l */ #if !defined(WIN32) case 16: bufferprint(); setgamestatus(SKIP_MONSTERS); break; /* ^p */ #else case 15: bufferprint(); setgamestatus(SKIP_MONSTERS); break; /* ^o */ #endif case 18: redraw(); setgamestatus(SKIP_MONSTERS); break; /* ^r */ case 23: if (gamestatusp(CHEATED)) drawscreen(); break; /* ^w */ case 24: /* ^x */ if (gamestatusp(CHEATED) || Player.rank[ADEPT]) wish(1); Command_Duration = 5; break; case 'a': zapwand(); Command_Duration = Player.speed*8/5; break; case 'c': closedoor(); Command_Duration = Player.speed*2/5; break; case 'd': drop(); Command_Duration = Player.speed*5/5; break; case 'e': eat(); Command_Duration = 30; break; case 'f': fire(); Command_Duration = Player.speed*5/5; break; case 'g': pickup(); Command_Duration = Player.speed*10/5; break; case 'i': do_inventory_control(); break; case 'm': magic(); Command_Duration = 12; break; case 'o': opendoor(); Command_Duration = Player.speed*5/5; break; case 'p': pickpocket(); Command_Duration = Player.speed*20/5; break; case 'q': quaff(); Command_Duration = 10; break; case 'r': peruse(); Command_Duration = 20; break; case 's': search(&searchval); Command_Duration = 20; break; case 't': talk(); Command_Duration = 10; break; case 'v': vault(); Command_Duration = Player.speed*10/5; break; case 'x': examine(); Command_Duration = 1; break; case 'z': bash_location(); Command_Duration = Player.speed*10/5; break; case 'A': activate(); Command_Duration = 10; break; case 'C': callitem(); break; case 'D': disarm(); Command_Duration = 30; break; case 'E': dismount_steed(); Command_Duration = Player.speed*10/5; break; case 'F': tacoptions(); break; case 'G': give(); Command_Duration = 10; break; case 'I': if (! optionp(TOPINV)) top_inventory_control(); else { display_possessions(); inventory_control(); } break; case 'M': city_move(); Command_Duration = 10; break; case 'O': setoptions(); #if defined(WIN32) show_screen(); xredraw(); #endif break; case 'P': show_license(); break; /* actually show_license is in file.c */ case 'Q': quit(); break; case 'R': rename_player(); break; case 'S': save(FALSE); break; case 'T': tunnel(); Command_Duration = Player.speed*30/5; break; case 'V': version(); break; case 'Z': bash_item(); Command_Duration = Player.speed*10/5; break; case '.': rest(); Command_Duration = 10; break; case ',': Command_Duration = 10; nap(); break; case '>': downstairs(); break; case '<': upstairs(); break; case '@': p_movefunction(Level->site[Player.x][Player.y].p_locf); Command_Duration = 5; break; case '#': if (gamestatusp(CHEATED)) editstats(); break; /* RAC - char editor */ case '/': charid(); setgamestatus(SKIP_MONSTERS); break; case '?': help(); setgamestatus(SKIP_MONSTERS); break; case '4': case 'h': moveplayer(-1,0); Command_Duration = Player.speed*5/5; break; case '2': case 'j': moveplayer(0,1); Command_Duration = Player.speed*5/5; break; case '8': case 'k': moveplayer(0,-1); Command_Duration = Player.speed*5/5; break; case '6': case 'l': moveplayer(1,0); Command_Duration = Player.speed*5/5; break; case '1': case 'b': moveplayer(-1,1); Command_Duration = Player.speed*5/5; break; case '3': case 'n': moveplayer(1,1); Command_Duration = Player.speed*5/5; break; case '7': case 'y': moveplayer(-1,-1); Command_Duration = Player.speed*5/5; break; case '9': case 'u': moveplayer(1,-1); Command_Duration = Player.speed*5/5; break; case '5': setgamestatus(SKIP_MONSTERS); /* don't do anything; a dummy turn */ Cmd = mgetc(); while ((Cmd != ESCAPE) && ((Cmd < '1') || (Cmd > '9') || (Cmd=='5'))) { print3("Run in keypad direction [ESCAPE to abort]: "); Cmd = mgetc(); } if (Cmd != ESCAPE) setgamestatus(FAST_MOVE); else clearmsg3(); break; case 'H': setgamestatus(FAST_MOVE); Cmd = 'h'; moveplayer(-1,0); Command_Duration = Player.speed*4/5; break; case 'J': setgamestatus(FAST_MOVE); Cmd = 'j'; moveplayer(0,1); Command_Duration = Player.speed*4/5; break; case 'K': setgamestatus(FAST_MOVE); Cmd = 'k'; moveplayer(0,-1); Command_Duration = Player.speed*4/5; break; case 'L': setgamestatus(FAST_MOVE); Cmd = 'l'; moveplayer(1,0); Command_Duration = Player.speed*4/5; break; case 'B': setgamestatus(FAST_MOVE); Cmd = 'b'; moveplayer(-1,1); Command_Duration = Player.speed*4/5; break; case 'N': setgamestatus(FAST_MOVE); Cmd = 'n'; moveplayer(1,1); Command_Duration = Player.speed*4/5; break; case 'Y': setgamestatus(FAST_MOVE); Cmd = 'y'; moveplayer(-1,-1); Command_Duration = Player.speed*4/5; break; case 'U': setgamestatus(FAST_MOVE); Cmd = 'u'; moveplayer(1,-1); Command_Duration = Player.speed*4/5; break; default: commanderror(); setgamestatus(SKIP_MONSTERS); break; } } if (Current_Environment != E_COUNTRYSIDE) roomcheck(); screencheck(Player.x,Player.y); }
void m_death(struct monster *m) { pob corpse; pml ml; int x; int y; int found = FALSE; m->hp = -1; if(los_p(Player.x, Player.y, m->x, m->y)) { putspot(m->x, m->y, getspot(m->x, m->y, FALSE)); gain_experience(m->xpv); calc_melee(); if(m->uniqueness != COMMON) { strcpy(Str1, m->monstring); } else { strcpy(Str1, "The "); strcat(Str1, m->monstring); } strcat(Str1, " is dead!"); mprint(Str1); } m_dropstuff(m); /* Death */ if(m->id == (ML10 + 0)) { mprint("Death lies sprawled out on the ground..."); mprint("Death laughs ironically and gets back to his feet."); mprint("He gestures and another scythe appears in his hands."); switch(random_range(10)) { case 0: mprint("Death performs a little bow and goes back on guard."); break; case 1: mprint("\'A hit! A palpable hit!\' Death goes back on the attack."); break; case 2: mprint("\'Ah, if only it could be so simple!\' snickers Death."); break; case 3: mprint("\'This fool things he can slay death! What a jest!\' says Death."); break; case 4: mprint("\'You point is well taken.\' says Death, attacking again."); break; case 5: mprint("\'Oh, come now, stop delaying the inevitable.\' says Death."); break; case 6: mprint("\'Your destiny ends here with me.\' says Death, scythe raised."); break; case 7: mprint("\'I almost felt that.\' says Death, smiling."); break; case 8: mprint("\'Timeo Mortis?\' asks Death quizzically, \'Not me!\'"); break; case 9: mprint("Death sighs theatrically. \'They never learn.\'"); break; } strengthen_death(m); } else { Level->site[m->x][m->y].creature = NULL; if(random_range(2) || (m->uniqueness != COMMON)) { corpse = (pob)malloc(sizeof(objtype)); make_corpse(corpse, m); drop_at(m->x, m->y, corpse); } plotspot(m->x, m->y, FALSE); switch(m->id) { case ML0 + 8: /* Hiscore NPC */ switch(m->aux2) { case 0: mprint("You hear a faroff dirge. You feel a sense of triumph."); break; case 1: case 2: case 3: case 4: case 5: case 6: mprint("You hear a faroff sound like angels crying..."); strcpy(Priest[1], nameprint()); Priestbehavior[1] = 2933; break; case 7: mprint("A furtive figure dashes out of the shadows, takes a look at"); mprint("the corpse, and runs away!"); strcpy(Shadowlord, nameprint()); Shadowlordbehavior = 2912; break; case 8: mprint("An aide-de-camp approaches, removes the corpse's insignia,"); mprint("and departs."); strcpy(Commandant, nameprint()); Commandantbehavior = 2912; break; case 9: mprint("An odd glow surrounds the corpse, and slowly fades."); strcpy(Archmage, nameprint()); Archmagebehavior = 2933; break; case 10: mprint("A demon materializes, takes a quick look at the corpse,"); mprint("and teleports away with a faint popping noise."); strcpy(Prime, nameprint()); Primebehavior = 2932; break; case 11: mprint("A sports columnist rushes forward and takes a quick photo"); mprint("of the corpse and rushes off muttering about a deadline."); strcpy(Champion, nameprint()); Championbehavior = 2913; break; case 12: mprint("You hear a fanfare in the distance, and feel dismayed."); strcpy(Duke, nameprint()); Dukebehavior = 2911; break; case 13: if(Player.alignment > 10) { mprint("You feel smug."); } else if(Player.alignment < 10) { mprint("You feel ashamed."); } strcpy(Chaoslord, nameprint()); Chaoslordbehavior = 2912; break; case 14: if(Player.alignment < 10) { mprint("You feel smug."); } else if(Player.alignment > 10) { mprint("You feel ashamed."); } strcpy(Lawlord, nameprint()); Lawlordbehavior = 2911; break; case 15: /* * Just a tad complicated. Promote a new justiciar if * an guards are left in the city, otherwise destroy * the Order! */ Player.alignment -= 100; if(!gamestatusp(DESTROYED_ORDER)) { mprint("In the distance you hear a trumpet. A Servent of Law"); mprint("materializes, sheds a tear, and leaves."); strcpy(Justiciar, nameprint()); Justiciarbehavior = 2911; /* Promote one of the city guards to be justiciar */ ml = City->mlist; while(!found && (ml != NULL)) { if((ml->m->id == (ML0 + 3)) && (ml->m->hp > 0)) { found = 1; } else { found = 0; } if(!found) { ml = ml->next; } } if(ml != NULL) { mprint("A new justiciar has been promoted!"); x = ml->m->x; y = ml->m->y; ml->m->x = x; ml->m->y = y; ml->m->click = (Tick + 1) % 60; m_status_reset(ml->m, AWAKE); m_status_reset(ml->m, HOSTILE); } /* * Will cause order to be destroyed if no guards or justiciar */ alert_guards(); } else { mprint("A Servant of Chaos materializes, grabs the corpse,"); mprint("snickers a bit, and vanishes."); } } break; case ML0 + 3: /* Guard */ Player.alignment -= 10; if((Current_Environment == E_CITY) || (Current_Environment == E_VILLAGE)) { alert_guards(); } break; case ML3 + 5: /* Goblin king */ if(!gamestatusp(ATTACKED_ORACLE)) { mprint("You seem to hear a woman's voice from far off:"); mprint("\'Well don! Come to me now...\'"); } setgamestatus(COMPLETED_CAVES); break; case ML7 + 5: /* Great worm */ if(!gamestatusp(ATTACKED_ORACLE)) { mprint("A female voice sounds from just behind your ear:"); mprint("\'Well fought! I have some new advice for you...\'"); } setgamestatus(COMPLETED_SEWERS); break; case ML10 + 1: setgamestatus(KILLED_EATER); break; case ML10 + 2: setgamestatus(KILLED_LAWBRINGER); break; case ML10 + 3: setgamestatus(KILLED_DRAGONLORD); break; case ML10 + 4: setgamestatus(COMPLETED_VOLCANO); if(!gamestatusp(ATTACKED_ORACLE)) { mprint("You feel a soft touch on your shoulder..."); mprint("You turn around but there is no one there!"); mprint("You turn back and see a not: \'See me soon.\'"); mprint("The note vanishes in a burst of blue fire!"); } break; case ML10 + 9: /* Elemental master */ if(!gamestatusp(ATTACKED_ORACLE)) { mprint("Words appear before you, traced in blue flame!"); mprint("\'Return to the Prime Plane via the Circle of Sorcerors..."); } break; } } dodrawspot(m->x, m->y); }
void l_condo(void) { pol ol,prev=NULL; int i,done=FALSE,over=FALSE,weeksleep=FALSE; char response; if (! gamestatusp(SOLD_CONDO)) { response = cinema_interact ("rp","Rampart Arms. Weekly Condo Rentals and Purchases", "Which are you interested in [r,p, or ESCAPE] ", NULL); if (response == 'p') { print2("Only 50,000Au. Buy it? [yn] "); if (ynq2()=='y') { if (Player.cash < 50000) print3("No mortgages, buddy."); else { setgamestatus(SOLD_CONDO); Player.cash-=50000; dataprint(); print2("You are the proud owner of a luxurious condo penthouse."); Condoitems = NULL; } } } else if (response == 'r') { print2("Weekly Rental, 1000Au. Pay for it? [yn] "); if (ynq2()=='y') { if (Player.cash < 1000) print2("Hey, pay the rent or out you go...."); else { weeksleep = TRUE; Player.cash -=1000; dataprint(); } } } else print2("Please keep us in mind for your housing needs."); } else { while (! done) { menuclear(); menuprint("Home Sweet Home\n"); menuprint("a: Leave items in your safe.\n"); menuprint("b: Retrieve items.\n"); menuprint("c: Take a week off to rest.\n"); menuprint("d: Retire permanently.\n"); menuprint("ESCAPE: Leave this place.\n"); showmenu(); response = (char) mcigetc(); if (response == 'a') { i = getitem(NULL_ITEM); if (i != ABORT) { if (Player.possessions[i]->blessing < 0) print2("The item just doesn't want to be stored away..."); else { ol = ((pol) checkmalloc(sizeof(oltype))); ol->thing = Player.possessions[i]; ol->next = Condoitems; Condoitems = ol; conform_unused_object(Player.possessions[i]); Player.possessions[i] = NULL; } } } else if (response == 'b') { ol = Condoitems; while ((ol != NULL) && (! over)) { print1("Retrieve "); nprint1(itemid(ol->thing)); nprint1(" [ynq] "); response = (char) mcigetc(); /* DAG -- fix memory leak where object list nodes weren't deleted */ if (response == 'y') { gain_item(ol->thing); if (ol == Condoitems) { ol = ol->next; free( Condoitems ); Condoitems = ol; } else { ol=ol->next; free( prev->next ); prev->next = ol; } } else if (response == 'q') over = TRUE; else { prev = ol; ol = ol->next; } } } else if (response == 'c') { weeksleep = TRUE; print1("You take a week off to rest..."); morewait(); } else if (response == 'd') { clearmsg(); if (cinema_confirm("You ponder settling down here for good.") == 'y') { p_win(); } } else if (response == ESCAPE) done = TRUE; } xredraw(); } if (weeksleep) { clearmsg(); print1("Taking a week off to rest..."); morewait(); toggle_item_use(TRUE); Player.hp = Player.maxhp; Player.str = Player.maxstr; Player.agi = Player.maxagi; Player.con = Player.maxcon; Player.dex = Player.maxdex; Player.iq = Player.maxiq; Player.pow = Player.maxpow; for (i=0; i<NUMSTATI; i++) if (Player.status[i]<1000) Player.status[i]=0; toggle_item_use(FALSE); Player.food = 36; print2("You're once again fit and ready to continue your adventure."); Time += 60*24*7; Date += 7; moon_check(); timeprint(); } }
void l_oracle(void) { char response; if (gamestatusp(ATTACKED_ORACLE) && (! gamestatusp(COMPLETED_ASTRAL))) { print1("You come before a blue crystal dais. You see a broken mirror."); print2("Look in the mirror? [yn] "); if (ynq2()=='y') { print1("A strange force rips you from your place...."); Player.hp = 1; print2("You feel drained...."); dataprint(); print3("You find yourself in a weird flickery maze."); change_environment(E_ASTRAL); } } else { print1("You come before a blue crystal dais. There is a bell and a mirror."); print2("Ring the bell [b], look in the mirror [m], or leave [ESCAPE] "); do response = (char) mcigetc(); while ((response != 'b') && (response != 'm') && (response != ESCAPE)); if (response == 'b') { print1("The ringing note seems to last forever."); print2("You notice a robed figure in front of you...."); morewait(); print1("The oracle doffs her cowl. Her eyes glitter with blue fire!"); print2("Attack her? [yn] "); if (ynq2() == 'y') { setgamestatus(ATTACKED_ORACLE); print1("The oracle deftly avoids your attack."); print2("She sneers at you and vanishes."); } else { print2("She stares at you...and speaks:"); if (!gamestatusp(SPOKE_TO_DRUID)) { print3("'The ArchDruid speaks wisdom in his forest shrine.'"); } else if (!gamestatusp(COMPLETED_CAVES)) { print3("'Thou mayest find aught of interest in the caves to the South.'"); } else if (!gamestatusp(COMPLETED_SEWERS)) { print3("'Turn thy attention to the abyssal depths of the city.'"); } else if (!gamestatusp(COMPLETED_CASTLE)) { print3("'Explorest thou the depths of the Castle of the ArchMage.'"); } else if (!gamestatusp(COMPLETED_ASTRAL)) { morewait(); print1("'Journey to the Astral Plane and meet the Gods' servants.'"); print2("The oracle holds out her hand. Do you take it? [yn] "); if (ynq2()=='y') { print1("'Beware: Only the Star Gem can escape the Astral Plane.'"); print2("A magic portal opens behind the oracle. She leads you"); morewait(); print1("through a sequence of special effects that would have"); print2("IL&M technicians cursing in awe and deposits you in an"); morewait(); clearmsg(); print1("odd looking room whose walls seem strangely insubstantial."); gain_experience(5000); change_environment(E_ASTRAL); } else print3("You detect the hint of a sneer from the oracle."); } else if (!gamestatusp(COMPLETED_VOLCANO)) { print3("'The infernal maw may yield its secrets to thee now.'"); } else if (!gamestatusp(COMPLETED_CHALLENGE)) { print3("'The challenge of adepthood yet awaits thee.'"); } else { morewait(); print1("'My lord: Thou hast surpassed my tutelage forever."); print2("Fare thee well.'"); print3("The oracle replaces her hood and seems to fade away...."); } } } else if (response == 'm') { print1("You seem to see yourself. Odd...."); knowledge(1); } else print2("You leave this immanent place."); } }
/* Prayer occurs at altars, hence the name of the function */ void l_altar() { int i; int deity; char response; if(Current_Environment == E_COUNTRYSIDE) { deity = DRUID; } else { deity = Level->site[Player.x][Player.y].aux; } switch(deity) { case ODIN: print1("This granite altar is graven with a gallows."); break; case SET: print1("This sandstone altar has a black hand drawn on it."); break; case HECATE: print1("This silver altar is inlaid with a black cresent moon."); break; case ATHENA: print1("This golden altar is inscribed with an owl."); break; case DESTINY: print1("This crystal altar is in the form of an omega."); break; case DRUID: print1("This oaken altar is ornately engraved with leaves."); break; default: print1("This rude altar has no markings."); break; } print2("Worship at this altar? [yn] "); if(ynq2() == 'y') { if(Player.rank[PRIESTHOOD] == 0) { increase_priest_rank(deity); } else if(!check_sacrilege(deity)) { if(Blessing) { print1("You have a sense of immanence."); } print2("Request a Blessing, Sacrifice an item, or just Pray [b,s,p] "); response = mcigetc(); while((response != 'b') && (response != 's') && (response != 'p') && (response != ESCAPE)) { response = mcigetc(); } if(response == 'b') { print1("You beg a heavenly benefice."); print2("You hear a gong resonating throughout eternity..."); morewait(); if(Blessing) { print1("A shaft of lecent radiance lances dwon from the heavens!"); print2("You feel uplifted..."); morewait(); gain_experience(Player.rank[PRIESTHOOD] * Player.rank[PRIESTHOOD] * 50); cleanse(1); heal(10); bless(1); Blessing = FALSE; increase_priest_rank(deity); } else { print1("Your ardent plea is ignored."); print2("You feel ashamed."); Player.xp -= (Player.xp / 4); } calc_melee(); } else if(response == 's') { print1("Which item to Sacrifice?"); i = getitem('\0'); if(i == ABORT) { i = 0; } if(Player.possessions[i] == NULL) { print1("You have insulted your deity!"); print2("Not a good idea, as it turns out..."); dispel(-1); p_damage(Player.hp - 1, UNSTOPPABLE, "a god's pique"); } else if(true_item_value(Player.possessions[i]) > (Player.rank[PRIESTHOOD] * Player.rank[PRIESTHOOD] * Player.rank[PRIESTHOOD] * 50)) { print1("With a burst of blue flame, your offering vanishes!"); dispose_lost_objects(1, Player.possessions[i]); print2("A violet nimbus settles around your head and slowly fades."); morewait(); Blessing = TRUE; } else { print1("A darkling glow envelopes your offering!"); print2("The glow slowly fades..."); morewait(); setgamestatus(SUPPRESS_PRINTING); if(Player.possessions[i]->used) { Player.possessions[i]->used = FALSE; item_use(Player.possessions[i]); Player.possessions[i]->blessing = -1 - abs(Player.possessions[i]->blessing); Player.possessions[i]->used = TRUE; item_use(Player.possessions[i]); } else { Player.possessions[i]->blessing = -1 - abs(Player.possessions[i]->blessing); } resetgamestatus(SUPPRESS_PRINTING); } } else if(response == 'p') { if(deity != Player.patron) { print1("Nothing seems to happen."); } else { increase_priest_rank(deity); } } } } }
/* Has all kinds of effects in different circumstances. Eventually will be more interesting */ void s_ritual(void) { pob symbol; int i,roomno; int x,y; mprint("You begin your ritual...."); mprint("You enter a deep trance. Time Passes..."); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); if (RitualHour == hour()) mprint("Your mental fatigue prevents from completing the ritual!"); else if (random_range(100) > Player.iq+Player.pow+Player.level) mprint("Your concentration was broken -- the ritual fails!"); else { mprint("You charge the ritual with magical energy and focus your will."); mprint("Time Passes..."); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); setgamestatus(SKIP_PLAYER); time_clock(FALSE); RitualHour = hour(); /* set of random conditions for different ritual effects */ if (Current_Environment == E_CITY) { mprint("Flowing waves of mystical light congeal all around you."); mprint("'Like wow, man! Colors!'"); mprint("Appreciative citizens throw you spare change."); Player.cash +=random_range(50); } else if ( (roomno=Level->site[Player.x][Player.y].roomnumber) >= ROOMBASE ) { if (RitualRoom == roomno) mprint("For some reason the ritual doesn't work this time..."); else { RitualRoom = roomno; switch (RitualRoom) { case RS_TREASURE: /* ransacked treasure chamber */ mprint("Your spell sets off frenetic growth all around you!"); for(i=0; i<8; i++) { Level->site[Player.x+Dirs[0][i]][Player.y+Dirs[1][i]].locchar = HEDGE; Level->site[Player.x+Dirs[0][i]][Player.y+Dirs[1][i]].p_locf = L_TRIFID; lset(Player.x+Dirs[0][i], Player.y+Dirs[1][i], CHANGED); } break; case RS_HAREM: /* harem */ case RS_BOUDOIR: /* boudoir */ mprint("A secret panel opens next to the bed...."); if (random_range(2)) summon(0,INCUBUS); /* succubus/incubus */ else summon(0,SATYR); /* satyr/nymph */ break; case RS_SHRINE: /*shrine to high magic */ mprint("A storm of mana coaelesces around you."); mprint("You are buffeted by bursts of random magic."); p_damage(random_range(Player.pow),UNSTOPPABLE,"high magic"); mprint("Continue ritual? Could be dangerous.... [yn] "); if (ynq()=='y') s_wish(); else mprint("The mana fades away to nothingness."); x = Player.x; y = Player.y; while (x >= 0 && Level->site[x - 1][y].roomnumber == RS_SHRINE) x--; while (y >= 0 && Level->site[x][y - 1].roomnumber == RS_SHRINE) y--; for (i = 0; Level->site[x][y].roomnumber == RS_SHRINE;) { Level->site[x][y].roomnumber = RS_ZORCH; lset(x, y, CHANGED); x++; i++; if (Level->site[x][y].roomnumber != RS_SHRINE) { x -= i; i = 0; y++; } } break; case RS_MAGIC_LAB: /* magician's lab */ mprint("Your magical activity sets off a latent spell in the lab!"); cast_spell(random_range(NUMSPELLS)); break; case RS_PENTAGRAM: /* pentagram room */ mprint("A smoky form begins to coalesce...."); summon(-1,-1); mprint("Fortunately, it seems confined to the pentagram."); m_status_reset(Level->mlist->m,MOBILE); break; case RS_OMEGA_DAIS: /* blue omega room */ mprint("The Lords of Destiny look upon you...."); if (Player.level > 10) { mprint("A curtain of blue flames leaps up from the omega."); morewait(); l_adept(); } else { if (Player.patron == DESTINY) { mprint("Your patrons take pity on you."); if ((Player.rank[PRIESTHOOD]<SPRIEST) && (! find_item(&symbol,OB_SYMBOL_DESTINY,-1))) { symbol = ((pob) checkmalloc(sizeof(objtype))); *symbol = Objects[OB_SYMBOL_DESTINY]; symbol->known = 2; symbol->charge = 17; gain_item(symbol); mprint("You feel uplifted."); } else gain_experience(min(1000,Player.xp)); } else if (random_range(3)==1) { mprint("You feel Fated."); gain_experience(Player.level*Player.level*10); Player.hp = max(Player.hp, Player.maxhp); } else if (random_range(2)) { mprint("You feel Doomed."); Player.hp = 1; Player.mana = 0; Player.xp = 0; } else mprint("The Lords of Destiny laugh at you!"); } break; default: mprint("Well, not much effect. Chalk it up to experience."); gain_experience(Player.level*5); break; } } } else { if (RitualRoom == Level->site[Player.x][Player.y].roomnumber) mprint("The ritual fails for some unexplainable reason."); else { mprint("The ritual seems to be generating some spell effect."); RitualRoom = Level->site[Player.x][Player.y].roomnumber; switch (RitualRoom) { case RS_WALLSPACE: shadowform(); break; case RS_CORRIDOR: haste(0); break; case RS_PONDS: breathe(0); break; case RS_ADEPT: hero(1); break; default: mprint("The ritual doesn't seem to produce any tangible results..."); gain_experience(Player.level*6); } } } } }
void send_to_jail(void) { if (Player.rank[ORDER] > 0) { print1("A member of the Order of Paladins sent to jail!"); print2("It cannot be!"); morewait(); print1("You are immediately expelled permanently from the Order!"); print2("Your name is expunged from the records...."); Player.rank[ORDER] = -1; } else if (gamestatusp(DESTROYED_ORDER)) print1("The destruction of the Order of Paladins has negated the law!"); else if ((Current_Environment != E_CITY) && (Last_Environment != E_CITY)) print1("Fortunately, there is no jail around here, so you are freed!"); else { pacify_guards(); if (((Current_Environment == E_HOUSE) || (Current_Environment == E_MANSION) || (Current_Environment == E_HOVEL)) && (Last_Environment == E_CITY)) { setgamestatus(SUPPRESS_PRINTING); change_environment(E_CITY); resetgamestatus(SUPPRESS_PRINTING); } if (Current_Environment == E_CITY) { if (gamestatusp(UNDEAD_GUARDS)) { print1("You are taken to a weirdly deserted chamber where an undead"); print2("Magistrate presides over a court of ghosts and haunts."); morewait(); print1("'Mr. Foreman, what is the verdict?'"); print2("'Guilty as charged, your lordship.'"); morewait(); clearmsg(); print1("'Guilty..."); morewait(); nprint1("Guilty..."); morewait(); nprint1("Guilty..."); morewait(); nprint1("Guilty...'"); clearmsg(); print1("The members of the court close in around, fingers pointing."); print2("You feel insubstantial hands closing around your throat...."); print3("You feel your life draining away!"); while(Player.level > 0) { Player.level--; Player.xp /= 2; Player.hp /= 2; dataprint(); } Player.maxhp = Player.maxcon; morewait(); print1("You are finally released, a husk of your former self...."); Player.x = 58; Player.y = 40; screencheck(Player.x,Player.y); } /* Hmm... The sorcerors ought to be able to get you free, too, * although of course they should have their *own* price. */ else if (Player.alignment + random_range(200) < 0) { print1("Luckily for you, a smooth-tongued advocate from the"); print2("Rampart Chaotic Liberties Union gets you off!"); Player.x = 58; Player.y = 40; screencheck(Player.x,Player.y); } else switch(Imprisonment++) { case 0: print1("The Magistrate sternly reprimands you."); print2("As a first-time offender, you are given probation."); Player.y = 58; Player.x = 40; screencheck(Player.x,Player.y); break; case 1: print1("The Magistrate expresses shame for your conduct."); print2("You are thrown in jail!"); morewait(); repair_jail(); Player.y = 54; Player.x = 37 + (2*random_range(4)); screencheck(Player.x,Player.y); l_portcullis_trap(); break; default: print1("The Magistrate renders summary judgement."); print2("You are sentenced to prison!"); morewait(); print1("The guards recognize you as a 'three-time-loser'"); print2("...and beat you up a little to teach you a lesson."); p_damage(random_range(Imprisonment * 10), UNSTOPPABLE, "police brutality"); morewait(); repair_jail(); Player.y = 54; Player.x = 37 + (2*random_range(4)); screencheck(Player.x,Player.y); l_portcullis_trap(); } } } }