-+-+-+-+-+-+-+-+ START OF PART 5 -+-+-+-+-+-+-+-+ Xmon_ptr->health -= damage_done; Xif ( mon_ptr->health <= 0) `7B X sprintf(killed,"%s %s.",mon_names`5Bmon_ptr->n_num`5D,deaths`5Brandom( 5)` V5D); X prt_msg(killed); X experience += BONUS*level/10; X if ( weapon == MINE `7C`7C weapon == PIT) experience -= BONUS*level/20; X kills++; X prt_exp(); X prt_kills(); X monkilled++; X mon_ptr->dead = TRUE; X if ( weapon == MINE `7C`7C weapon == PIT) return; X if ( monkilled == MAXMONSTERS*level) `7B`09 X map`5Bmon_ptr->posy`5D`5Bmon_ptr->posx`5D.mapchar = KEY; X map`5Bmon_ptr->posy`5D`5Bmon_ptr->posx`5D.number = 1; X sprintf(dropped,"%s drops the key as it writhes in agony and dies.", X`09`09 `09`09`09`09mon_names`5Bmon_ptr->n_num`5D); X prt_msg(dropped); X `7D X else `7B X if ( mon_ptr->underchar == SPACE) `7B X map`5Bmon_ptr->posy`5D`5Bmon_ptr->posx`5D.mapchar = CASH; X map`5Bmon_ptr->posy`5D`5Bmon_ptr->posx`5D.number = 1; X `7D X else `7B X sprintf(dropped,"%s's gold was lost when he died.", X`09`09`09`09`09`09 mon_names`5Bmon_ptr->n_num`5D); X prt_msg(dropped); X map`5Bmon_ptr->posy`5D`5Bmon_ptr->posx`5D.mapchar = mon_ptr->underchar V; X map`5Bmon_ptr->posy`5D`5Bmon_ptr->posx`5D.number = 1; X `7D X `7D X if ( mon_ptr->number == rival_num && in_arena) `7B X can_exit = TRUE; X map`5Bmon_ptr->posy`5D`5Bmon_ptr->posx`5D.mapchar = HAXE; X map`5Bmon_ptr->posy`5D`5Bmon_ptr->posx`5D.number = 1; X map`5Ba_posy`5D`5Ba_posx`5D.mapchar = BONES; X prt_char( map`5Ba_posy`5D`5Ba_posx`5D.mapchar, a_posy, a_posx);`20 X `7D X prt_char(map`5Bmon_ptr->posy`5D`5Bmon_ptr->posx`5D.mapchar,mon_ptr->posy, X`09`09`09`09`09`09 `09`09 mon_ptr->posx); X`7D /* End IF */ X`7D $ CALL UNPACK MONSTERS.C;1 742421411 $ create 'f' X/* monsters are: X`7Bquantity, name#, attack#, mon_char, damage, health, follow, mvspeed, fire Vchnce, X moverange, reschance, monfire#, dead, fly, magic, healspeed`7D XNecessary end of comment marker ==> **/ X4 0 0 a 1 5 3 3 0 30 50 0 0 0 0 15 X2 1 1 b 2 15 12 2 35 40 2 0 0 0 0 20 X5 2 2 c 4 8 1 16 20 99 1 0 0 0 0 8 X1 3 3 d 10 20 8 4 60 20 2 2 0 0 1 25 X3 4 4 e 5 12 10 6 5 15 1 3 0 0 0 20 X2 5 5 f 4 10 5 4 30 50 2 0 0 0 1 14 X1 6 6 g 3 9 6 5 15 40 1 4 0 1 0 25 X1 7 7 h 5 20 5 3 20 50 10 4 0 0 0 30 X2 8 8 i 1 8 13 2 0 20 15 0 0 1 0 16 X6 9 9 J 10 20 2 9 10 30 7 3 0 0 1 6 X1 10 10 U 11 30 7 5 20 25 1 5 0 1 0 27 X1 11 11 v 9 20 10 3 10 20 8 1 0 0 1 16 X1 12 12 w 7 20 6 3 5 30 12 0 0 0 0 16 X2 13 13 x 3 20 8 2 10 15 6 2 0 0 0 10 X1 14 14 m 5 30 3 4 8 50 50 2 0 0 0 10 X2 15 15 z 8 30 12 2 20 30 15 1 0 0 1 15 X3 16 16 t 15 30 15 7 5 17 3 5 0 0 0 17 X2 17 17 B 2 30 6 2 20 30 15 0 0 1 0 5 X1 18 18 V 1 30 5 3 5 30 2 2 0 0 0 8 X1 19 19 S 4 30 2 2 0 25 20 5 0 0 1 9 X1 20 20 j 3 40 5 4 10 40 12 2 0 0 0 12 X1 21 21 D 1 50 1 5 40 40 25 5 0 0 0 5 X1 22 22 N 2 35 3 4 20 30 10 6 0 0 0 5 X3 23 23 r 15 40 15 6 8 50 15 3 0 0 0 27 X1 24 24 A 999 99 1 2 5 50 2 7 0 0 1 1 $ CALL UNPACK MONSTERS.DAT;1 827597384 $ create 'f' Xsys$share:vaxcrtl/share $ CALL UNPACK O.OPT;1 728066217 $ create 'f' X#include stdio X#include descrip X#include ctype X#include math X#include "aralu.h" X X Xshort parse_keystroke( keyhit) Xchar keyhit; X`7B Xint dummy, diff_num, d; Xshort ret = 0; X/* figure out which key was hit and stuff like that */ X Xswitch( keyhit) `7B X X`09case 'q': drink_potion(); break; X`09case 'Q': prt_msg("Saving game..."); X`09`09 ret = E_SAVED; X`09 break; X case 'S': prt_msg("Choose another speed."); X`09`09 smg$erase_display(&dsp_status); X`09`09 prt_difficulty(dsp_status); X`09`09 diff_num = getkey(); X`09`09 switch( diff_num) `7B X`09`09 case '1': DIFFICULTY = 0.2; break; X`09`09 case '2': DIFFICULTY = 0.05; break; X`09`09 case '3': DIFFICULTY = 0.01; break; X`09`09 case '4': DIFFICULTY = 0.40; break; X`09`09 default: DIFFICULTY = 0.1; X`09`09 `7D`09 X`09`09 smg$erase_display(&dsp_status); X`09`09 prt_status(); X`09`09 break; X`09case UP : X`09case LEFT :`20 X`09case DOWN :`20 X`09case RIGHT: move( keyhit); break; X`09case ' ': fire_item( ARROW); break; X`09case 'u': choose_spell(); break; X`09case 's': smg$erase_display(&dsp_status);`20 X`09`09 smg$paste_virtual_display(&dsp_status,&pb,&2,&43); X prt_status(); `20 X `09`09 break; X`09case 't': get_time(); break; X`09case 'b': prt_inven(); break; X`09case 'c': change_viewport( ppos.y, ppos.x); X`09`09 dely = 0; delx = 0; X`09`09 break; X `09case 'e': if ( underchar != DOOR && underchar != STORE) X`09`09 prt_msg("There is no door here to enter."); X`09`09 else if ( underchar == STORE) `7B X prt_msg("You walk into the store."); X`09`09 map`5Bppos.y`5D`5Bppos.x`5D.number = 1; X`09`09 enter_store(); X`09`09 `7D X`09`09 else if ( !KEYPOSESS) X`09`09 prt_msg("You don't have a key to open this door."); X`09`09 else `7B X`09 `09 GAINLEVEL = TRUE; X`09`09 underchar = SPACE; X`09`09 `7D X`09`09 break; X`09case 23: if ( operator) `7B X `09 operator = FALSE; X`09`09 prt_msg("Wizard mode off."); X`09`09 `7D X else if ( strcmp( username, SUPERUSER) == 0) `7B X `09 `09 operator = TRUE; X`09 `09 prt_msg("Wizard mode on."); X`09`09 `7D X`09`09 else prt_msg("Press '?' for help."); X`09 `09 break; X`09case 26: prt_msg("Quit/no save? `5B'y' to confirm`5D"); X`09`09 if ( toupper( getkey()) == 'Y') ret = E_ENDGAME;`09 X`09`09 break; X`09case 12: smg$repaint_screen( &pb); break; X case 2: prt_msg("Zoom!"); sys$setpri(0,0,4,0); break; X/*`09case 18: recall_messages(); break; */ X `09case 'x': exchange_weap(); break; X`09case 'w': wear_wield(); break; X `09case 'd': drop(); break; X`09case 'r': read_scroll(); break; X`09case 'v': view(); break; X `09case 'h': do_heal(); break; X`09case '?': help(); break; X/* Operator commands */ X`09case 11: if (!operator) prt_msg("Press '?' for help."); X `09 `09 else kill_mon(); X`09`09 break; X`09case 13: if (!operator) prt_msg("Press '?' for help."); X `09 `09 else where(); X`09`09 break; X`09case 14: if (!operator) prt_msg("Press '?' for help."); X `09 `09 else `7B X`09`09 if ( stop_monst) stop_monst = FALSE; X`09 `09 else stop_monst = TRUE; X`09`09 `7D X`09`09 break; X`09case 16: if (!operator) prt_msg("Press '?' for help."); X`09`09 else create_object(); X`09`09 break; X`09case 1: if (!operator) prt_msg("Press '?' for help."); X`09`09 else cure_all(); X`09`09 break; X`09case 4: if (!operator) prt_msg("Press '?' for help."); X`09`09 else delete_object(); X`09`09 break; X`09case 5: if (!operator) prt_msg("Press '?' for help."); X`09`09 else set_stats(); X`09`09 break; X`09case 6: if (!operator) prt_msg("Press '?' for help."); X`09`09 else fly(); X`09`09 break; X`09case 7: if (!operator) prt_msg("Press '?' for help."); X`09`09 else goto_level();`20 X`09`09 break; X`09case 8: if (!operator) prt_msg("Press '?' for help."); X`09`09 else `7B health = MAXHEALTH; prt_health(); `7D X`09`09 break; X `09default: prt_msg("Press '?' for help."); X`7D /* End switch */ Xif ( dead) ret = E_ENDGAME; Xelse if (GAINLEVEL) ret = E_GAINLEVEL; Xreturn( ret); X`7D X X Xrecall_messages() X`7B Xint r_c; V `20 X$DESCRIPTOR( return_d,"Press any key to return to game."); X Xprt_msg("");`09`09/* line advance */ Xsmg$begin_pasteboard_update(&pb); Xsmg$unpaste_virtual_display(&dsp_main,&pb); Xsmg$unpaste_virtual_display(&dsp_status,&pb); Xsmg$unpaste_virtual_display(&dsp_inven,&pb); Xsmg$end_pasteboard_update(&pb); Xsmg$put_chars(&dsp_command,&return_d,&22,&23,&1,&2); Xsmg$read_keystroke(&kboard,&r_c); Xprt_msg("");`09`09/* line advance */ Xsmg$begin_pasteboard_update(&pb); Xsmg$paste_virtual_display(&dsp_main,&pb,&2,&2); Xsmg$paste_virtual_display(&dsp_status,&pb,&2,&43); Xsmg$end_pasteboard_update(&pb); X`7D X X Xmove( direction) Xint direction; X`7B Xint number, dx, dy, rnd; Xchar testchar; X X/* If player is confused, change the direction randomly */ Xif ( flags`5BCONFUSE`5D.valid) `7B X if ( (rnd = random(4)) < 1) direction = UP; X else if ( rnd < 2) direction = DOWN; X else if ( rnd < 3) direction = LEFT; X else direction = RIGHT; X`7D Xswitch( direction) `7B X case UP: dx = 0; dy = -1; break; X case DOWN: dx = 0; dy = 1; break; X case LEFT: dx = -1; dy = 0; break; X case RIGHT: dx = 1; dy = 0; break; X`7D /* End switch */ X Xtestchar = map`5Bppos.y+dy`5D`5Bppos.x+dx`5D.mapchar; Xnumber = map`5Bppos.y+dy`5D`5Bppos.x+dx`5D.number; Xif ( !obstacle(testchar)) `7B do_move( direction); underchar = testchar;`7D Xelse if (isamonster( testchar)) do_attack( number, WIELD, SWORD, direction); Xelse check_object( testchar, number, direction); X`7D X X Xread_scroll()`09`09`09`09/* read a scroll */ X`7B Xint bp_num, item_num, PREWEIGHT, rnd_scr; Xchar read`5B80`5D; X Xif ( (bp_num = check_inven( SCROLL)) != FALSE) `7B X item_num = identify( SCROLL); X if ( (--BACKPACK`5Bbp_num`5D.quantity) == 0) `7B X BACKPACK`5Bbp_num`5D.invenchar = SPACE; X compress_inven(); X `7D X PREWEIGHT = CURWEIGHT; X CURWEIGHT -= ITEM_PROPS`5Bitem_num`5D`5BWEIGHT`5D;`20 X if ( (PREWEIGHT >= MAXWEIGHT) && (CURWEIGHT < MAXWEIGHT)) `7B X change_speed( 2.0); X prt_msg("The burden of the pack is lifted."); X prt_speed(); X `7D X prt_wgt(); X if ( (rnd_scr = random( 100)) < 85) `7B X if ( in_arena) `7B X prt_msg("You cannot teleport out of the arena."); X prt_msg("The scroll vanishes."); X return; X `7D X prt_msg("This is a teleport scroll."); X map`5Bppos.y`5D`5Bppos.x`5D.mapchar = SPACE; X map`5Bppos.y`5D`5Bppos.x`5D.number = 1; X prt_char( map`5Bppos.y`5D`5Bppos.x`5D.mapchar, ppos.y, ppos.x); X do `7B X ppos.y = random( MAXROWS);`20 X ppos.x = random( MAXCOLS); X `7D while( map`5Bppos.y`5D`5Bppos.x`5D.mapchar != SPACE); X map`5Bppos.y`5D`5Bppos.x`5D.mapchar = '@'; X map`5Bppos.y`5D`5Bppos.x`5D.number = 1; X underchar = SPACE; X prt_char( map`5Bppos.y`5D`5Bppos.x`5D.mapchar, ppos.y, ppos.x); X change_viewport( ppos.y, ppos.x); X dely = delx = 0; X prt_msg("Poof!"); X `7D X else `7B X prt_msg("This is an Enchant Item scroll."); X enchant(); X `7D X`7D Xelse prt_msg("You have no scrolls to read."); X`7D X X Xenchant() X`7B Xint echar, item_num, bp_num; X Xprt_msg("Enchant which item? `5B* for list`5D"); Xechar = getkey(); Xechar -= MAGIC_NUMBER; Xif ( echar+MAGIC_NUMBER == '*') `7B prt_inven(); enchant(); `7D Xelse if ( echar < 1 `7C`7C echar > MAXINVEN-1) `7B`20 X prt_msg("You cannot enchant that!");`20 X prt_msg("The scroll vanishes into dust."); X return;`20 X`7D Xelse if ( BACKPACK`5Bechar`5D.invenchar != SPACE) `7B`09 /* you have it */ X item_num = identify( BACKPACK`5Bechar`5D.invenchar); X if ( ITEM_PROPS`5Bitem_num`5D`5BWEARABLE`5D == TRUE) `7B X`09 if ( ITEM_PROPS`5Bitem_num`5D`5BITEMCHAR`5D == ARMOR) X `09 prt_msg("Your armor glows brightly for a moment."); X else if ( ITEM_PROPS`5Bitem_num`5D`5BITEMCHAR`5D == ORB) X`09 prt_msg("The Orb pulsates with a bright green glow."); X else`20 X`09 prt_msg("Your weapon glows brightly for a moment."); X X`09 BACKPACK`5Bechar`5D.condition++; X `7D X else `7B X`09 prt_msg("You cannot enchant that!"); X`09 prt_msg("The scroll vanishes into dust."); X `7D X`7D X`7D X X X Xview()`09`09`09`09`09/* look in a given direction */ X`7B Xint dx, dy, ax, ay; Xint item_num, i, j, mon_health, sight_dist; Xint distance = 0;`09`09`09/* cur viewing distance */ Xchar viewchar`5B80`5D; Xchar mon_health_msg`5B80`5D; Xchar dir; X Xprt_msg("View which direction?"); Xdir = getkey(); X/* smg$read_keystroke( &kboard,&dir); */ Xswitch( dir) `7B X`09case UP: dx = 0; dy = -1; sight_dist = MAXVIEWDIST/2; break; X`09case RIGHT: dx = 1; dy = 0; sight_dist = MAXVIEWDIST; break; X`09case LEFT: dx = -1; dy = 0; sight_dist = MAXVIEWDIST; break; X`09case DOWN: dx = 0; dy = 1; sight_dist = MAXVIEWDIST/2; break; X default: prt_msg("Invalid direction."); return; X`7D /* End switch */ X X ax = ppos.x+dx; ay = ppos.y+dy; X while( ++distance < sight_dist) `7B X if ( isamonster( map`5Bay`5D`5Bax`5D.mapchar)) `7B X mon_health = monsters`5Bmap`5Bay`5D`5Bax`5D.number`5D.health; X if ( mon_health > 7+(level*5)) strcpy( mon_health_msg,"which is in V perfect health"); X else if ( mon_health > 4+(level*5)) strcpy( mon_health_msg,"which h Vas some minor wounds"); X`09 else if ( mon_health > (level*5)) strcpy( mon_health_msg,"and it is hurt Ving badly now"); X`09 else strcpy( mon_health_msg,"which is very near death"); X X sprintf(viewchar,"You see %s, %s.", X`09`09mon_names`5Bmonsters`5Bmap`5Bay`5D`5Bax`5D.number`5D.n_num`5D, mon_hea Vlth_msg); X prt_msg(viewchar); X `7D X else if ( map`5Bay`5D`5Bax`5D.mapchar == WALL) `7B X prt_msg("You see a stone wall."); X break; X `7D X else if ( map`5Bay`5D`5Bax`5D.mapchar != SPACE) `7B`20 X if ( (item_num = identify( map`5Bay`5D`5Bax`5D.mapchar)) == MAGIC_N VUMBER) X sprintf(viewchar,"You see a %s.", X object_names`5Bget_name( map`5Bay`5D`5Bax` V5D.mapchar)`5D); X else if ( combinable( item_num)) `7B X`09 if ( map`5Bay`5D`5Bax`5D.number <= 1) `20 X sprintf(viewchar,"You see a %s.", X object_names`5Bget_name( map`5Bay`5D`5Bax` V5D.mapchar)`5D); X else`20 X sprintf(viewchar,"You see %d %ss.",map`5Bay`5D`5Bax`5D.number, X object_names`5Bget_name( map`5Bay`5D`5Bax` V5D.mapchar)`5D); X `7D X else `7B +-+-+-+-+-+-+-+- END OF PART 5 +-+-+-+-+-+-+-+-