void l_hedge(void) { if (Player.patron == DRUID) print1("You move through the hedges freely."); else { print1("You struggle in the brambly hedge... "); switch(random_range(6)) { case 0: print2("You are stabbed by thorns!"); p_damage(random_range(6),NORMAL_DAMAGE,"a hedge"); print3("The thorns were poisonous!"); p_poison(random_range(12)); break; case 1: print2("You are stabbed by thorns!"); p_damage(random_range(12),NORMAL_DAMAGE,"a hedge"); break; case 2: print2("You seem to have gotten stuck in the hedge."); Player.status[IMMOBILE]+=random_range(5)+1; break; case 3: if (Player.possessions[O_CLOAK] != NULL) { print2("Your cloak was torn on the brambles!"); dispose_lost_objects(1,Player.possessions[O_CLOAK]); } else print2("Ouch! These thorns are scratchy!"); break; default: print2("You make your way through unscathed."); break; } } }
/* checks current food status of player, every hour, and when food is eaten */ void foodcheck(void) { if (Player.food > 48) { print3("You vomit up your huge meal."); Player.food = 12; } else if (Player.food == 30) print3("Time for a smackerel of something."); else if (Player.food == 20) print3("You feel hungry."); else if (Player.food == 12) print3("You are ravenously hungry."); else if (Player.food == 3) { print3("You feel weak."); if (State.getFastMove()) { drawvision(Player.x,Player.y); State.setFastMove(false); } } else if (Player.food < 0) { if (State.getFastMove()) { drawvision(Player.x,Player.y); State.setFastMove(false); } print3("You're starving!"); p_damage(-5*Player.food,UNSTOPPABLE,"starvation"); } showflags(); }
void l_whirlwind(void) { print1("Buffeting winds swirl you up!"); p_damage(random_range(difficulty()*10),NORMAL_DAMAGE,"a magic whirlwind"); if (random_range(2)) { print2("You are jolted by lightning!"); p_damage(random_range(difficulty()*10),ELECTRICITY,"a magic whirlwind"); } morewait(); if (random_range(2)) { print1("The whirlwind carries you off...."); if (random_range(20)==17) print2("'I don't think we're in Kansas anymore, toto.'"); p_teleport(0); } }
/* drops every portcullis on level, then kills itself and all similar traps. */ void l_drop_every_portcullis(void) { int i,j,slam=FALSE; print3("Click."); morewait(); for(j=0;j<Level->level_length;j++) for(i=0;i<Level->level_width;i++) { if (Level->site[i][j].p_locf == L_DROP_EVERY_PORTCULLIS) { Level->site[i][j].p_locf = L_NO_OP; lset(i, j, CHANGED); } else if ((Level->site[i][j].p_locf == L_PORTCULLIS) && (Level->site[i][j].locchar != PORTCULLIS)) { Level->site[i][j].locchar = PORTCULLIS; lset(i, j, CHANGED); putspot(i,j,PORTCULLIS); if ((i==Player.x)&&(j==Player.y)) { print3("Smash! You've been hit by a falling portcullis!"); morewait(); p_damage(random_range(1000),NORMAL_DAMAGE,"a portcullis"); } slam = TRUE; } } if (slam) print3("You hear heavy walls slamming down!"); }
void l_fire(void) { print1("You boldly stride through the curtain of fire..."); if (gamestatusp(MOUNTED)) { print2("Your horse is fried and so are you..."); resetgamestatus(MOUNTED); } p_damage(random_range(100),FLAME,"self-immolation"); }
void l_lava(void) { print1("Very clever -- walking into a pool of lava..."); if (gamestatusp(MOUNTED)) { print2("Your horse is incinerated... You fall in too!"); resetgamestatus(MOUNTED); } morewait(); if (strcmp(Player.name,"Saltheart Foamfollower")==0) { print1("Strangely enough, you don't seem terribly affected."); p_damage(1,UNSTOPPABLE,"slow death in a pool of lava"); } else { p_damage(random_range(75),FLAME,"incineration in a pool of lava"); if (Player.hp> 0) p_drown(); Player.status[IMMOBILE]+=2; } }
void weapon_demonblade(int dmgmod, pob o, pmt m) { if (o->blessing > -1) { mprint("Demonblade disintegrates with a soft sigh."); mprint("You stop foaming at the mouth."); Player.status[BERSERK] = 0; conform_lost_object(o); } else if (m->specialf == M_SP_DEMON) { mprint("The demon flees in terror before your weapon!"); m_vanish(m); } else if (m->meleef != M_MELEE_SPIRIT) { if (m->level > random_range(10)) { if( Player.hp < Player.maxhp ) Player.hp = min(Player.maxhp,Player.hp+m->hp); Player.str++; if( Player.pow < Player.maxpow ) Player.pow = min(Player.maxpow,Player.pow+m->level); m_death(m); mprint("You feel a surge of raw power from Demonblade!"); } else p_hit(m,Player.dmg+dmgmod,NORMAL_DAMAGE); } else { mprint("Demonblade howls as it strikes the spirit!"); if (random_range(10) == 1) { mprint("... and shatters into a thousand lost fragments!"); morewait(); p_damage(50,UNSTOPPABLE,"Demonblade exploding"); conform_lost_object(o); } else { mprint("You feel your lifeforce draining...."); p_damage(25,UNSTOPPABLE,"a backlash of negative energies"); Player.str -= 3; Player.con -= 3; if (Player.str < 1 || Player.con < 1) p_death("a backlash of negative energies"); } } }
void m_strike_sonic(pmt m) { if (m->uniqueness == COMMON) { strcpy(Str2,"The "); strcat(Str2,m->monstring); } else strcpy(Str2,m->monstring); strcat(Str2," screams at you!"); mprint(Str2); p_damage(m->dmg,OTHER_MAGIC,"a sonic blast"); }
void breathe(int blessing) { if (blessing > -1) { mprint("Your breath is energized!"); Player.status[BREATHING] += 6+blessing; } else { mprint("You choke as your lungs fill with water!"); p_damage(50,UNSTOPPABLE,"drowning"); } }
void Monster::m_strike_sonic() { if (this->uniqueness == COMMON) { strcpy(Str2,"The "); strcat(Str2,this->name); } else strcpy(Str2,this->name); strcat(Str2," screams at you!"); mprint(Str2); p_damage(this->dmg,OTHER_MAGIC,"a sonic blast"); }
void l_rubble(void) { int screwup = random_range(100) - (Player.agi + Player.level); print1("You climb over the unstable pile of rubble...."); if (screwup < 0) print2("No problem!"); else { print2("You tumble and fall in a small avalanche of debris!"); print3("You're trapped in the pile!"); Player.status[IMMOBILE]+=2; p_damage(screwup/5,UNSTOPPABLE,"rubble and debris"); morewait(); } }
void i_pepper_food(pob o) { mprint("You innocently start to chew the szechuan pepper....."); morewait(); mprint("hot."); morewait(); mprint("Hot."); morewait(); mprint("Hot!"); morewait(); mprint("HOT!!!!!!"); morewait(); p_damage(1,UNSTOPPABLE,"a szechuan pepper"); mprint("Your sinuses melt and run out your ears."); mprint("Your mouth and throat seem to be permanently on fire."); mprint("You feel much more awake now...."); Player.immunity[SLEEP]++; }
void s_wish(void) { if (random_range(100) > Player.iq+Player.pow+Player.level) { mprint("Your concentration is flawed!"); mprint("The spell energy backfires!"); p_damage(random_range(Spells[S_WISH].powerdrain), UNSTOPPABLE, "a backfired wish spell"); } else { wish(0); if (Spells[S_WISH].known) { mprint("The power of the spell is too much for you to withstand!"); mprint("All memory of the spell is expunged from your brain."); Spells[S_WISH].known = FALSE; } } }
void l_adept(void) { print1("You see a giant shimmering gate in the form of an omega."); if (! gamestatusp(ATTACKED_ORACLE)) { if (Player.str+Player.con+Player.iq+Player.pow < 100) print2("A familiar female voice says: I would not advise this now...."); else print2("A familiar female voice says: Go for it!"); } morewait(); clearmsg(); if (cinema_confirm("You're about to step into the mystic portal.")!='y') { if (Player.level > 100) { print1("The Lords of Destiny spurn your cowardice and indecision..."); Player.xp = 0; Player.level = 0; Player.hp = Player.maxhp = Player.con; Player.mana = calcmana(); print2("You suddenly feel very inexperienced."); dataprint(); morewait(); clearmsg(); } print1("You edge away from the challenge."); } else { clearmsg(); print1("You pass through the portal."); morewait(); drawomega(); print1("Like wow man! Colors! "); if (Player.patron != DESTINY) { print2("Strange forces try to tear you apart!"); p_damage(random_range(200),UNSTOPPABLE,"a vortex of chaos"); } else print2("Some strange force shields you from a chaos vortex!"); morewait(); print1("Your head spins for a moment...."); print2("and clears...."); morewait(); Player.hp = Player.maxhp; Player.mana = calcmana(); change_environment(E_ABYSS); } }
void weapon_lightsabre(int dmgmod, pob o, pmt m) { if (! o->known) { mprint("Fumbling with the cylinder, you press the wrong stud...."); p_damage(100,UNSTOPPABLE,"fumbling with a lightsabre"); o->known = 1; } else { /* test prevents confusing immunity messages.... */ if (! m_immunityp(m,NORMAL_DAMAGE)) { mprint("Vzzzzmmm!"); m_damage(m,20,NORMAL_DAMAGE); } if ((m->hp>0) && (! m_immunityp(m,FLAME))) { mprint("Zzzzap!"); m_damage(m,20,FLAME); } } }
void weapon_defend(int dmgmod, pob o, pmt m) { if ((Player.alignment < 0) && (o->blessing > 0)) { mprint("The Holy Defender screams in your hands...."); mprint("You stagger before the sound of its rage...."); p_damage(50,UNSTOPPABLE,"a pissed-off Holy Defender"); mprint("The weapon finally quiets. It seems less holy now."); o->truename = o->cursestr; Player.status[PROTECTION] -= (o->hit); o->plus = 0-abs(o->plus); o->blessing = -1; } if ((o->blessing > 0) && ((m->specialf == M_SP_DEMON) || (m->meleef == M_MELEE_SPIRIT))) { mprint("Your opponent shies back before your holy weapon!"); m->hit = 0; m->speed *=2; } weapon_normal_hit(dmgmod,o,m); }
/* Drops all portcullises in 5 moves */ void l_portcullis_trap(void) { int i,j,slam=FALSE; print3("Click."); morewait(); for (i=max(Player.x-5,0);i<min(Player.x+6,Level->level_width);i++) for(j=max(Player.y-5,0);j<min(Player.y+6,Level->level_length);j++) { if ((Level->site[i][j].p_locf == L_PORTCULLIS) && (Level->site[i][j].locchar != PORTCULLIS)) { Level->site[i][j].locchar = PORTCULLIS; lset(i, j, CHANGED); putspot(i,j,PORTCULLIS); if ((i==Player.x)&&(j==Player.y)) { print3("Smash! You've been hit by a falling portcullis!"); morewait(); p_damage(random_range(1000),NORMAL_DAMAGE,"a portcullis"); } slam = TRUE; } } if (slam) print3("You hear heavy walls slamming down!"); }
void l_sorcerors(void) { char action; int done=FALSE,fee; long total; print1("The Circle of Sorcerors."); if (Player.rank[CIRCLE] == -1) { print2("Fool! Didn't we tell you to go away?"); Player.mana = 0; dataprint(); } else while (! done) { if ((Player.rank[CIRCLE]==HIGHSORCEROR) && (Player.level > Primelevel) && find_and_remove_item(CORPSEID,LAWBRINGER)) { print2("You obtained the Crown of the Lawgiver!"); morewait(); print1("The Crown is ritually sacrificed to the Lords of Chaos."); print2("You are now the Prime Sorceror of the Inner Circle!"); strcpy(Prime,Player.name); Primelevel = Player.level; morewait(); Primebehavior = fixnpc(4); save_hiscore_npc(10); clearmsg(); print1("You learn the Spell of Disintegration!"); morewait(); clearmsg(); Spells[S_DISINTEGRATE].known = TRUE; Player.rank[CIRCLE] = PRIME; Player.maxpow += 10; Player.pow += 10; } menuclear(); menuprint("May we help you?\n\n"); menuprint("a: Become an Initiate of the Circle.\n"); menuprint("b: Raise your rank in the Circle.\n"); menuprint("c: Restore mana points\n"); menuprint("ESCAPE: Leave these Chambers of Power.\n"); showmenu(); action = mgetc(); if (action == ESCAPE) done = TRUE; else if (action == 'a') { if (Player.rank[CIRCLE] > 0) print2("You are already an initiate!"); else if (Player.alignment > 0) print2("You may not join -- you reek of Law!"); else if (Player.rank[COLLEGE] > 0) print2("Foolish Mage! You don't have the right attitude to Power!"); #ifdef INCLUDE_MONKS else if (Player.rank[MONKS] > 0) print2("Stupid monk. Go Meditate on this!"); #endif else { fee = 3000; fee += Player.alignment*100; fee += fee*(12 - Player.pow)/9; fee = max(100,fee); clearmsg(); mprint("For you, there is an initiation fee of"); mnumprint(fee); mprint(" Au."); print2("Pay it? [yn] "); if (ynq2() =='y') { if (Player.cash < fee) print3("Try again when you have the cash!"); else { print1("Prime Sorceror "); nprint1(Prime); print2("conducts your initiation into the circle of novices."); morewait(); clearmsg(); print1("You learn the Spell of Magic Missiles."); Spells[S_MISSILE].known = TRUE; Player.cash -= fee; dataprint(); Player.rank[CIRCLE] = INITIATE; Player.guildxp[CIRCLE] = 1; Player.maxpow++; Player.pow++; } } } } else if (action == 'b') { if (Player.rank[CIRCLE] == 0) print2("You have not even been initiated, yet!"); else if (Player.alignment > -1) { print1("Ahh! You have grown too lawful!!!"); print2("You are hereby blackballed from the Circle!"); Player.rank[CIRCLE] = -1; morewait(); clearmsg(); print1("A pox upon thee!"); if (! Player.immunity[INFECTION]) Player.status[DISEASED]+=100; print2("And a curse on your possessions!"); morewait(); clearmsg(); acquire(-1); clearmsg(); enchant(-1); bless(-1); print3("Die, false sorceror!"); p_damage(25,UNSTOPPABLE,"a sorceror's curse"); done = TRUE; } else if (Player.rank[CIRCLE]==PRIME) print2("You are at the pinnacle of mastery in the Circle."); else if (Player.rank[CIRCLE]==HIGHSORCEROR) { if (Player.level <= Primelevel) print2("You are not experienced enough to advance."); else print2("You must return with the Crown of the LawBringer!"); } else if (Player.rank[CIRCLE]==SORCEROR) { if (Player.guildxp[CIRCLE] < 4000) print2("You are not experienced enough to advance."); else { print1("You are now a High Sorceror of the Inner Circle!"); print2("You learn the Spell of Disruption!"); morewait(); clearmsg(); print1("To advance you must return with the LawBringer's Crown!"); print2("The LawBringer resides on Star Peak."); Spells[S_DISRUPT].known = TRUE; Player.rank[CIRCLE] = HIGHSORCEROR; Player.maxpow += 5; Player.pow += 5; } } else if (Player.rank[CIRCLE]==ENCHANTER) { if (Player.guildxp[CIRCLE] < 1500) print2("You are not experienced enough to advance."); else { print1("You are now a member of the Circle of Sorcerors!"); print2("You learn the Spell of Ball Lightning!"); Spells[S_LBALL].known = TRUE; Player.rank[CIRCLE] = SORCEROR; Player.maxpow += 2; Player.pow+=2; } } else if (Player.rank[CIRCLE]==INITIATE) { if (Player.guildxp[CIRCLE] < 400) print2("You are not experienced enough to advance."); else { print1("You are now a member of the Circle of Enchanters!"); print2("You learn the Spell of Firebolts."); Spells[S_FIREBOLT].known = TRUE; Player.rank[CIRCLE] = ENCHANTER; Player.maxpow+=2; Player.pow+=2; } } } else if (action == 'c') { done = TRUE; fee = Player.level*100; if (Player.rank[CIRCLE]) fee = fee / 2; clearmsg(); print1("That will be: "); mnumprint(fee); nprint1("Au. Pay it? [yn] "); if (ynq1()=='y') { if (Player.cash < fee) print2("Begone, deadbeat, or face the wrath of the Circle!"); else { Player.cash -= fee; total = calcmana(); while (Player.mana < total) { Player.mana++; dataprint(); } print2("Have a sorcerous day, now!"); } } else print2("Be seeing you!"); } } xredraw(); }
void l_abyss(void) { int i; if (Current_Environment != Current_Dungeon) { print1("You fall through a dimensional portal!"); morewait(); strategic_teleport(-1); } else { print1("You enter the infinite abyss!"); morewait(); if (random_range(100)==13) { print1("As you fall you see before you what seems like"); print2("an infinite congerie of iridescent bubbles."); print3("You have met Yog Sothoth!!!"); morewait(); clearmsg(); if (Player.alignment > -10) p_death("the Eater of Souls"); else { print1("The All-In-One must have taken pity on you."); print2("A transdimensional portal appears..."); morewait(); change_level(Level->depth,Level->depth+1,FALSE); gain_experience(2000); Player.alignment -= 50; } } else { i = 0; print1("You fall..."); while(random_range(3)!=2) { if (i%6 == 0) print2("and fall... "); else nprint2("and fall... "); i++; morewait(); } i++; print1("Finally,you emerge through an interdimensional interstice..."); morewait(); if (Level->depth+i>MaxDungeonLevels) { print2("You emerge high above the ground!!!!"); print3("Yaaaaaaaah........"); morewait(); change_environment(E_COUNTRYSIDE); do { setPlayerXY( random_range(COUNTRY_WIDTH), random_range(COUNTRY_LENGTH)); } while(Country[Player.x][Player.y].base_terrain_type == CHAOS_SEA); p_damage(i*50,NORMAL_DAMAGE,"a fall from a great height"); } else { print2("You built up some velocity during your fall, though...."); morewait(); p_damage(i*5,NORMAL_DAMAGE,"a fall through the abyss"); change_level(Level->depth,Level->depth+i,FALSE); gain_experience(i*i*50); } } } }
void l_lift(void) { char response; int levelnum; int distance; int too_far = 0; Level->site[Player.x][Player.y].locchar = FLOOR; Level->site[Player.x][Player.y].p_locf = L_NO_OP; lset(Player.x, Player.y, CHANGED); print1("You walk onto a shimmering disk...."); print2("The disk vanishes, and a glow surrounds you."); print3("You feel weightless.... You feel ghostly...."); morewait(); clearmsg(); print1("Go up, down, or neither [u,d,ESCAPE] "); do response = (char) mcigetc(); while ((response != 'u') && (response != 'd') && (response != ESCAPE)); if (response != ESCAPE) { print1("How many levels?"); levelnum = (int) parsenum(""); if (levelnum > 6) { too_far = 1; levelnum = 6; } if (response == 'u' && Level->depth - levelnum < 1) { distance = levelnum - Level->depth; change_environment(E_COUNTRYSIDE); /* "you return to the countryside." */ if (distance > 0) { nprint1(".."); print2("...and keep going up! You hang in mid air..."); morewait(); print3("\"What goes up...\""); morewait(); print3("Yaaaaaaaah........"); p_damage(distance*10,NORMAL_DAMAGE,"a fall from a great height"); } return; } else if (response == 'd' && Level->depth + levelnum > MaxDungeonLevels) { too_far = 1; levelnum = MaxDungeonLevels - Level->depth; } if (levelnum == 0) { print1("Nothing happens."); return; } if (too_far) { print1("The lift gives out partway..."); print2("You rematerialize....."); } else print1("You rematerialize....."); change_level(Level->depth, (response=='d' ? Level->depth+levelnum : Level->depth-levelnum), FALSE); roomcheck(); } }
/* from f to t */ void ball(int fx, int fy, int tx, int ty, int dmg, int dtype) { int xx,yy,ex,ey,i; Monster *target; Symbol expchar=('@' | CLR(LIGHT_PURPLE)); xx = fx; yy = fy; switch(dtype) { case FLAME: expchar=('*' | CLR(LIGHT_RED)); break; case COLD: expchar=('o' | CLR(WHITE)); break; case ELECTRICITY: expchar=('^' | CLR(LIGHT_BLUE)); break; } do_los(expchar,&xx,&yy,tx,ty); draw_explosion(expchar,xx,yy); for(i=0; i<9; i++) { ex = xx + Dirs[0][i]; ey = yy + Dirs[1][i]; if ((ex == Player.x) && (ey == Player.y)) { switch(dtype) { case FLAME: mprint("You were blasted by a fireball!"); p_damage(random_range(dmg),FLAME,"a fireball"); break; case COLD: mprint("You were blasted by a snowball!"); p_damage(random_range(dmg),COLD,"a snowball"); break; case ELECTRICITY: mprint("You were blasted by ball lightning!"); p_damage(random_range(dmg),ELECTRICITY,"ball lightning"); break; case UNSTOPPABLE: mprint("Oh No! Manastorm!"); p_damage(random_range(dmg),UNSTOPPABLE,"a manastorm!"); break; } } if (NULL != (target = Level->site[ex][ey].creature)) { if (los_p(Player.x,Player.y,target->x,target->y)) { if (target->uniqueness == COMMON) { strcpy(Str1,"The "); strcat(Str1,target->name); } else strcpy(Str1,target->name); switch(dtype) { case FLAME: strcat(Str1," was zorched by a fireball!"); break; case COLD: strcat(Str1," was blasted by a snowball!"); break; case ELECTRICITY: strcat(Str1," was zapped by ball lightning!"); break; case UNSTOPPABLE: strcat(Str1," was nuked by a manastorm!"); break; } mprint(Str1); } m_status_set(target,HOSTILE); target->m_damage(random_range(dmg),dtype); } if (Level->site[ex][ey].locchar == HEDGE) if (Level->site[ex][ey].p_locf != L_TRIFID) { if ((dtype == FLAME)||(dtype == ELECTRICITY)) { mprint("The hedge is blasted away!"); Level->site[ex][ey].p_locf = L_NO_OP; Level->site[ex][ey].locchar = FLOOR; plotspot(ex,ey,true); lset(ex, ey, CHANGED); } else mprint("The hedge is unaffected."); } else mprint("The trifid absorbs the energy and laughs!"); else if (Level->site[ex][ey].locchar == WATER) if (dtype == FLAME) { mprint("The water is vaporised!"); Level->site[ex][ey].p_locf = L_NO_OP; Level->site[ex][ey].locchar = FLOOR; plotspot(ex,ey,true); lset(ex, ey, CHANGED); } } }
/* from f to t */ void bolt(int fx, int fy, int tx, int ty, int hit, int dmg, int dtype) { int xx,yy; Monster *target; Symbol boltchar = '?'; xx = fx; yy = fy; switch(dtype) { case FLAME: boltchar=('*' | CLR(LIGHT_RED)); break; case ELECTRICITY: boltchar = ('^' | CLR(LIGHT_BLUE)); break; case NORMAL_DAMAGE: boltchar = ('!' | CLR(BROWN)); break; case COLD: boltchar=('o' | CLR(WHITE)); break; default: assert(false); /* this should never happen, right? WDT */ } clearmsg(); do_los(boltchar,&xx,&yy,tx,ty); if ((xx == Player.x) && (yy == Player.y)) { if (Player.status[DEFLECTION] > 0) mprint("The bolt just missed you!"); else { switch (dtype) { case FLAME: mprint("You were blasted by a firebolt!"); p_damage(random_range(dmg),dtype,"a firebolt"); break; case ELECTRICITY: mprint("You were zapped by lightning!"); p_damage(random_range(dmg),dtype,"a bolt of lightning"); break; case NORMAL_DAMAGE: mprint("You were hit by a missile!"); p_damage(random_range(dmg),dtype,"a missile"); break; case COLD: mprint("You were hit by an icicle!"); p_damage(random_range(dmg),dtype,"an icicle"); break; } } } else if (NULL != (target = Level->site[xx][yy].creature)) { if (hitp(hit,target->ac)) { if (target->uniqueness == COMMON) { strcpy(Str1,"The "); strcat(Str1,target->name); } else strcpy(Str1,target->name); switch (dtype) { /* WDT: these sentances really ought to be livened up. Especially * in full verbose mode. */ case FLAME: strcat(Str1," was blasted by a firebolt!"); break; case ELECTRICITY: strcat(Str1," was zapped by lightning!"); break; case NORMAL_DAMAGE: strcat(Str1," was hit by a missile!"); break; case COLD: strcat(Str1," was hit by an icicle!"); break; } mprint(Str1); m_status_set(target,HOSTILE); target->m_damage(random_range(dmg),dtype); } else { if (target->uniqueness == COMMON) { strcpy(Str1,"The "); strcat(Str1,target->name); } else strcpy(Str1,target->name); switch (dtype) { case FLAME: strcat(Str1," was missed by a firebolt!"); break; case ELECTRICITY: strcat(Str1," was missed by lightning!"); break; case NORMAL_DAMAGE: strcat(Str1," was missed by a missile!"); break; case COLD: strcat(Str1," was missed by a flying icicle!"); break; } mprint(Str1); } } else if (Level->site[xx][yy].locchar == HEDGE) if (Level->site[xx][yy].p_locf != L_TRIFID) { if ((dtype == FLAME)||(dtype == ELECTRICITY)) { mprint("The hedge is blasted away!"); Level->site[xx][yy].p_locf = L_NO_OP; Level->site[xx][yy].locchar = FLOOR; plotspot(xx, yy, true); lset(xx, yy, CHANGED); } else mprint("The hedge is unaffected."); } else mprint("The trifid absorbs the energy and laughs!"); else if (Level->site[xx][yy].locchar == WATER) if (dtype == FLAME) { mprint("The water is vaporised!"); Level->site[xx][yy].p_locf = L_NO_OP; Level->site[xx][yy].locchar = FLOOR; lset(xx, yy, CHANGED); } }
/* 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); } } } } }
/* effects of hitting */ void p_hit (struct monster *m,int dmg,int dtype) { int dmult = 0; /* chance for critical hit..., 3/10 */ switch (random_range(10)) { case 0: if (random_range(100) < (Player.level #ifdef INCLUDE_MONKS + Player.rank[MONKS] #endif )) { strcpy(Str3,"You annihilate "); dmult = 1000; } else { strcpy(Str3,"You blast "); dmult=5; } break; case 1: case 2: strcpy(Str3,"You smash "); dmult=2; break; default: dmult=1; if (random_range(10)) strcpy(Str3,"You hit "); #ifdef NEW_QUOTES else switch(random_range(12)) { #else else switch(random_range(4)) { #endif case 0: strcpy(Str3,"You damage "); break; case 1: strcpy(Str3,"You inflict bodily harm on "); break; case 2: strcpy(Str3,"You injure "); break; case 3: strcpy(Str3,"You molest "); break; case 4: strcpy(Str3,"You tweak "); break; case 5: strcpy(Str3,"You smush "); break; case 6: strcpy(Str3,"You smurf "); break; case 7: strcpy(Str3,"You grind "); break; case 8: strcpy(Str3,"You hurt "); break; case 9: strcpy(Str3,"You bring pain to "); break; case 10: strcpy(Str3,"You recite nasty poetry at "); break; case 11: strcpy(Str3,"You smack "); break; } break; } if (Lunarity == 1) dmult = dmult * 2; else if (Lunarity == -1) dmult = dmult / 2; if (m->uniqueness == COMMON) strcat(Str3,"the "); strcat(Str3,m->monstring); strcat(Str3,". "); if (Verbosity != TERSE) mprint(Str3); else mprint("You hit it."); #ifdef INCLUDE_MONKS if (Player.possessions[O_WEAPON_HAND] == NULL) { /*barehanded*/ if (Player.rank[MONKS] > MONK_MASTER_SIGHS) { /* high level monks do unstoppable hand damage */ dtype = UNSTOPPABLE; } } #endif m_damage(m,dmult * random_range(dmg),dtype); if ((Verbosity != TERSE) && (random_range(10)==3) && (m->hp > 0)) mprint("It laughs at the injury and fights on!"); } /* and effects of missing */ void player_miss(struct monster *m,int dtype) { if (random_range(30)==1) /* fumble 1 in 30 */ p_fumble(dtype); else { if (Verbosity != TERSE) { if (random_range(10)) strcpy(Str3,"You miss "); else switch(random_range(4)) { case 0: strcpy(Str3,"You flail lamely at "); break; case 1: strcpy(Str3,"You only amuse "); break; case 2: strcpy(Str3,"You fail to even come close to "); break; case 3: strcpy(Str3,"You totally avoid contact with "); break; } if (m->uniqueness == COMMON) strcat(Str3,"the "); strcat(Str3,m->monstring); strcat(Str3,". "); mprint(Str3); } else mprint("You missed it."); } } /* oh nooooo, a fumble.... */ void p_fumble(int dtype) { mprint("Ooops! You fumbled...."); switch(random_range(10)) { case 0: case 1: case 2: case 3: case 4: case 5: drop_weapon(); break; case 6: case 7: case 8: break_weapon(); break; case 9: mprint("Oh No! You hit yourself!"); p_damage(Player.dmg,dtype,"stupidity"); break; } }
/* A value over 1000 indicates a permanent effect */ void minute_status_check(void) { int i; if (Player.status[HASTED]>0) { if (Player.status[HASTED] < 1000) { Player.status[HASTED]--; if (Player.status[HASTED]==0) { mprint("The world speeds up."); calc_melee(); } } } if (Player.status[POISONED]>0) { Player.status[POISONED]--; p_damage(3,POISON,"poison"); if (Player.status[POISONED] == 0) { showflags(); mprint("You feel better now."); } } if (Player.immunity[UNSTOPPABLE]>0) { for(i=0;i<NUMIMMUNITIES;i++) Player.immunity[i]--; if (Player.immunity[UNSTOPPABLE]==1) mprint("You feel vincible again."); } if (Player.status[IMMOBILE]>0) { Player.status[IMMOBILE]--; if (Player.status[IMMOBILE] == 0) mprint("You can move again."); } if (Player.status[SLEPT]>0) { Player.status[SLEPT]--; if (Player.status[SLEPT] == 0) { mprint("You woke up."); } } if (Player.status[REGENERATING]>0) { if ((Player.hp < Player.maxhp) && (Player.mana > 0)){ Player.hp++; Player.mana--; dataprint(); } if (Player.status[REGENERATING] < 1000) { Player.status[REGENERATING]--; if (Player.status[REGENERATING] == 0) { mprint("You feel less homeostatic."); } } } if (Player.status[SLOWED]>0) { if (Player.status[SLOWED] < 1000) { Player.status[SLOWED]--; if (Player.status[SLOWED] == 0) { mprint("You feel quicker now."); calc_melee(); } } } if (Player.status[RETURNING]>0) { Player.status[RETURNING]--; if (Player.status[RETURNING] == 10) mprint("Your return spell slowly hums towards activation..."); else if (Player.status[RETURNING] == 8) mprint("There is an electric tension in the air!"); else if (Player.status[RETURNING] == 5) mprint("A vortex of mana begins to form around you!"); else if (Player.status[RETURNING] == 1) mprint("Your surroundings start to warp and fade!"); if (Player.status[RETURNING] == 0) level_return(); } if (Player.status[AFRAID]>0) { if (Player.status[AFRAID] < 1000) { Player.status[AFRAID]--; if (Player.status[AFRAID] == 0) { mprint("You feel bolder now."); } } } }
void l_castle(void) { Object* o; int x, y; if (Player.level < 3) { print1("You can't possibly enter the castle, you nobody!"); print2("Come back when you are famous."); } else { print1("You are ushered into the castle."); if (Player.rank[NOBILITY]<DUKE) { print2("His Grace, "); nprint2(Duke); nprint2("-- Duke of Rampart! <fanfare>"); morewait(); clearmsg(); } if (Player.rank[NOBILITY]==0) { print1("Well, sirrah, wouldst embark on a quest? [yn] "); if (ynq1() == 'y') { print2("Splendid. Bring me the head of the Goblin King."); Player.rank[NOBILITY]=COMMONER; } else { print1("You scoundrel! Guards! Take this blackguard away!"); morewait(); p_damage(Player.maxhp / 2, UNSTOPPABLE, "castle guards for lese majeste"); send_to_jail(); } } else if (Player.rank[NOBILITY]==COMMONER) { if (find_and_remove_item(CORPSEID,GOBLIN_KING)) { print1("Good job, sirrah! I promote you to the rank of esquire."); Player.rank[NOBILITY]=ESQUIRE; gain_experience(100); print2("Now that you have proved yourself true, another quest!"); morewait(); print1("Bring to me a Holy Defender!"); print2("One is said to be in the possession of the Great Wyrm"); morewait(); clearmsg(); print1("in the depths of the sewers below the city."); } else print2("Do not return until you achieve the quest, caitiff!"); } else if (Player.rank[NOBILITY]==ESQUIRE) { if (find_and_remove_item(OB_DEFENDER,-1)) { print1("My thanks, squire. In return, I dub thee knight!"); Player.rank[NOBILITY]=KNIGHT; gain_experience(1000); print2("If thou wouldst please me further..."); morewait(); print1("Bring me a suit of dragonscale armor."); print2("You might have to kill a dragon to get one...."); } else print2("Greetings, squire. My sword? What, you don't have it?"); } else if (Player.rank[NOBILITY]==KNIGHT) { if (find_and_remove_item(OB_DRAGONSCALE,-1)) { print1("Thanks, good sir knight."); print2("Here are letters patent to a peerage!"); Player.rank[NOBILITY]=LORD; gain_experience(10000); morewait(); print1("If you would do me a final service..."); print2("I require the Orb of Mastery. If you would be so kind..."); morewait(); print1("By the way, you might find the Orb in the possession"); print2("Of the Elemental Master on the Astral Plane"); } else print2("Your quest is not yet complete, sir knight."); } else if (Player.rank[NOBILITY]==LORD) { if (find_item(&o,OB_ORB_MASTERY,-1)) { print1("My sincerest thanks, my lord."); print2("You have proved yourself a true paragon of chivalry"); morewait(); print1("I abdicate the Duchy in your favor...."); print2("Oh, you can keep the Orb, by the way...."); Player.rank[NOBILITY]=DUKE; gain_experience(10000); strcpy(Duke,Player.name); morewait(); Dukebehavior = fixnpc(4); save_hiscore_npc(12); for (y = 52; y < 63; y++) for (x = 2; x < 52; x++) { if (Level->site[x][y].p_locf == L_TRAP_SIREN) { Level->site[x][y].p_locf = L_NO_OP; lset(x, y, CHANGED); } if (x >= 12 && loc_statusp(x, y, SECRET)) { lreset(x, y, SECRET); lset(x, y, CHANGED); } if (x >= 20 && x <= 23 && y == 56) { Level->site[x][y].locchar = FLOOR; lset(x, y, CHANGED); } } } else print2("I didn't really think you were up to the task...."); } } }
/* 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); } } } } }
int check_sacrilege(int deity) { int i; int sacrilege = FALSE; if((Player.patron != deity) && (Player.patron > 0)) { sacrilege = TRUE; --Player.pow; --Player.maxpow; switch(Player.patron) { case ODIN: print1("Odin notices your lack of faith!"); morewait(); if(deity == ATHENA) { print2("However, Athena intercedes on your behalf."); sacrilege = FALSE; } else { print2("You are struck by a thunderbolt!"); p_damage(Player.level * 5, UNSTOPPABLE, "Odin's wrath"); if(Player.hp > 0) { morewait(); print2("The bolt warps your feeble frame..."); Player.maxcon = Player.maxcon / 2; Player.con = min(Player.con, Player.maxcon); Player.maxstr = Player.maxstr / 2; Player.con = min(Player.str, Player.maxstr); } } morewait(); break; case SET: print1("Set notices you lack of faith1"); morewait(); if(deity == HECATE) { print1("But since you pray to a friendly deity,"); print2("Set decided not to punish you."); sacrilege = FALSE; } else { print2("You are blasted by a shaft of black fire!"); p_damage(Player.level * 5, UNSTOPPABLE, "Set's anger"); if(Player.hp > 0) { morewait(); print1("You are wreathed in clouds of smoke."); for(i = 0; i < MAXITEMS; ++i) { if((Player.possessions[i] != NULL) && (Player.possessions[i]->blessing > -1)) { conform_lost_object(Player.possessions[i]); } } morewait(); print2("You feel Set's Black Hand on your heart..."); Player.maxcon = Player.maxcon / 4; Player.con = Player.maxcon; } } morewait(); break; case HECATE: print1("Hecate notices your lack of faith!"); morewait(); if(deity == SET) { print1("But ignores the affront since she likes Set."); sacrilege = FALSE; } else { print1("You are zapped by dark moonbeams!"); p_damage(Player.level * 5, UNSTOPPABLE, "Hecate's malice"); if(Player.hp > 0) { print2("The beams leach you of magical power!"); Player.maxpow = Player.maxpow / 5; Player.pow = min(Player.pow, Player.maxpow); for(i = 0; i < NUMSPELLS; ++i) { Spells[i].known = FALSE; } } } morewait(); break; case ATHENA: print1("Athena notices your lack of faith!"); morewait(); if(deity == ODIN) { print2("But lets you off this time since Odin is also Lawful."); sacrilege = FALSE; } else { print2("You are zorched by godsfire!"); if(Player.hp > 0) { morewait(); print1("the fire burns away your worldly experience!"); Player.level = 0; Player.xp = 0; Player.hp = Player.con; Player.maxhp = Player.hp; print2("Your power is reduced by the blast!!!"); Player.maxpow = Player.maxpow / 3; Player.pow = Player.maxpow; Player.mana = min(Player.mana, calcmana()); } } morewait(); break; case DESTINY: print2("The Lords of Destiny ignore your lack of faith."); sacrilege = FALSE; morewait(); break; case DRUID: print2("your treachery to the Archdruid has been noted."); if(random_range(2) == 1) { Player.alignment += 40; } else { Player.alignment -= 40; } morewait(); break; } if(sacrilege) { Player.patron = 0; Player.rank[PRIESTHOOD] = 0; } } return sacrilege; }
void sanctify(int blessing) { if (blessing > -1) { if (Level->environment == E_TEMPLE) mprint("Odd, the spell has no effect. I wonder why."); else if (Level->site[Player.x][Player.y].locchar == ALTAR) mprint("This site can't get any holier!"); else if (Player.patron == 0) { mprint("The gods are angered!"); Level->site[Player.x][Player.y].locchar = LAVA; Level->site[Player.x][Player.y].p_locf = L_LAVA; lset(Player.x, Player.y, CHANGED); p_movefunction(L_LAVA); } else { Level->site[Player.x][Player.y].locchar = ALTAR; Level->site[Player.x][Player.y].aux = Player.patron; Level->site[Player.x][Player.y].p_locf = L_ALTAR; lset(Player.x, Player.y, CHANGED); mprint("You are standing on sacred ground!"); } } else { if (Level->site[Player.x][Player.y].locchar == ALTAR) { mprint("The altar crumbles before your unholy blast...."); Level->site[Player.x][Player.y].locchar = FLOOR; Level->site[Player.x][Player.y].p_locf = L_NO_OP; lset(Player.x, Player.y, CHANGED); if (Level->site[Player.x][Player.y].aux == Player.patron) { mprint("Your deity is not amused...."); p_damage(Player.hp-1,UNSTOPPABLE,"Divine Wrath"); } else if ((Player.patron == ATHENA) || (Player.patron == ODIN)) { if ((Level->site[Player.x][Player.y].aux == SET) || (Level->site[Player.x][Player.y].aux == HECATE)) { mprint("Your deity applauds the eradication of Chaos' taint"); gain_experience(1000); } else { mprint("Your deity approves of your action."); gain_experience(100); } } else if ((Player.patron == SET) || (Player.patron == HECATE)) { if ((Level->site[Player.x][Player.y].aux == ODIN) || (Level->site[Player.x][Player.y].aux == ATHENA)) { mprint("Your deity applauds the obliteration of Law"); gain_experience(1000); } else { mprint("Your deity approves of your action."); gain_experience(100); } } else if (Player.patron == DRUID) { mprint("Your attempt to maintain the Balance is applauded...."); gain_experience(250); } else mprint("Nothing much happens"); } else mprint("You feel an aura of unholiness arising from this spot...."); } }
void l_safe(void) { char response; pob newitem; int attempt = 0; response = cinema_interact("pfqi", "You have discovered a safe!", "Pick the lock [p], Force the door [f], or ignore [ESCAPE]", NULL); if (response == 'p') attempt = (2*Player.dex + Player.rank[THIEVES]*10 - random_range(100))/10; else if (response == 'f') attempt = (Player.dmg - random_range(100))/10; if (attempt > 0) { Player.alignment -= 4; gain_experience(50); print2("The door springs open!"); Level->site[Player.x][Player.y].locchar = FLOOR; Level->site[Player.x][Player.y].p_locf = L_NO_OP; lset(Player.x, Player.y, CHANGED); if (random_range(2) == 1) { print1("You find:"); do { newitem = create_object(difficulty()); print2(itemid(newitem)); morewait(); gain_item(newitem); } while (random_range(3) == 1); } else print2("The safe was empty (awwwww....)"); } else { print3("Your attempt at burglary failed!"); if (attempt == -1) { print1("A siren goes off! You see flashing red lights everywhere!"); morewait(); if (Last_Environment == E_CITY) { print2("The city guard shows up! They collar you in no time flat!"); change_environment(E_CITY); morewait(); send_to_jail(); } } else if (attempt == -2) { print1("There is a sudden flash!"); p_damage(random_range(25),FLAME,"a safe"); print2("The safe has self-destructed."); Level->site[Player.x][Player.y].locchar = RUBBLE; Level->site[Player.x][Player.y].p_locf = L_RUBBLE; lset(Player.x, Player.y, CHANGED); } else if (attempt == -3) { print1("The safe jolts you with electricity!"); lball(Player.x,Player.y,Player.x,Player.y,30); } else if (attempt < -3) { print1("You are hit by an acid spray!"); if (Player.possessions[O_CLOAK] != NULL) { print2("Your cloak is destroyed!"); conform_lost_object(Player.possessions[O_CLOAK]); p_damage(10,ACID,"a safe"); } else if (Player.possessions[O_ARMOR] != NULL) { print2("Your armor corrodes!"); Player.possessions[O_ARMOR]->dmg-=3; Player.possessions[O_ARMOR]->hit-=3; Player.possessions[O_ARMOR]->aux-=3; p_damage(10,ACID,"a safe"); } else { print2("The acid hits your bare flesh!"); p_damage(random_range(100),ACID,"a safe"); } } } }