-+-+-+-+-+-+-+-+ START OF PART 49 -+-+-+-+-+-+-+-+ X if (i1 > 0) then X msg_print('You have killed the ' + c_list`5Bi1`5D.name + '. '); X END X END; X END X END X END; X oldy := y; X oldx := x; X until (flag); X END; X END X END X else X if (redraw) then X draw_cave; X END; X`20 X`20 X`20 X`7B Bash open a door or chest X Note: Affected by strength and weight of character `7D X procedure bash; X var X y,x,tmp`09`09`09`09: integer; X old_ptodam,old_ptohit,old_bth : integer; X`09yell`09`09`09 : vtype; X BEGIN X y := char_row; X x := char_col; X if (get_dir('Which direction?',tmp,tmp,y,x)) then X BEGIN X with cave`5By,x`5D do X if (cptr > 1) then X BEGIN X if (py.flags.afraid > 0) then X msg_print('You are afraid!') X else X BEGIN X`7B Save old values of attacking`7D X temporary_slot := equipment`5B23`5D; X old_ptohit := py.misc.ptohit; X old_ptodam := py.misc.ptodam; X old_bth := py.misc.bth; X`7B Use these values `7D X equipment`5B23`5D := blank_treasure; X with equipment`5B23`5D do X BEGIN X damage := equipment`5B27`5D.damage; X weight := py.stat.cstr; X tval:= 1; X END; X with py do X BEGIN X misc.bth := trunc((stat.cstr+misc.wt)/5.0); X misc.ptohit := 0; X misc.ptodam := trunc(misc.wt/75.0) + 1; X END; X if (py_attack(y,x)) then X with m_list`5Bcptr`5D do X BEGIN X stuned := stuned + randint(2) + 1; X`09`09`09 if (stuned > 12) then stuned := 12; X msg_print('The ' + c_list`5Bmptr`5D.name X + ' appears stunned!'); X END; X`7B Restore old values `7D X equipment`5B23`5D := temporary_slot; X py.misc.ptohit := old_ptohit; X py.misc.ptodam := old_ptodam; X py.misc.bth := old_bth; X if (randint(50) > py.stat.cdex) then X BEGIN X msg_print('You are off-balance.'); X py.flags.paralysis := randint(3); X END; X END; X END X else if (tptr > 0) then X with t_list`5Btptr`5D do X if (tval = 105) then X BEGIN X msg_print('You smash into the door!'); X with py do X if (test_hit(misc.wt+stat.cstr,0,0,abs(p1)+150)) the Vn X BEGIN X`09`09`09 case randint(10) of X`09`09`09 1..5: yell:= 'The door crashes open.'; X`09`09`09 6: yell:= 'The door flys off its hinges.'; X`09`09`09 7: yell:= 'The door screams in agony!'; X`09`09`09 8: yell:= '"Intruder Alert!"'; X`09`09 9: yell:= 'The door swears to get its revenge!'; X`09 10: yell:= '"Warning. You have entered a restricted zone!"'; X`09`09 end; X msg_print(yell);`20 X`09`09`09 if (index(yell,'!') > 1) then X`09`09`09 aggravate_monster(20); X t_list`5Btptr`5D := door_list`5B1`5D; X p1 := 1; X fopen := true; X lite_spot(y,x); X END X else X BEGIN X msg_flag := false; X msg_print('The door holds firm.'); X py.flags.paralysis := 2; X END; X END X else if (tval = 2) then X BEGIN X if (randint(10) = 1) then X BEGIN X msg_print('You have destroyed the chest...'); X msg_print('and it''s contents!'); X name := '& ruined chest'; X flags := 0; X END X else if (uand(%X'00000001',flags) <> 0) then X if (randint(10) = 1) then X BEGIN X msg_print('The lock breaks open!'); X flags := uand(%X'FFFFFFFE',flags); X END; X END X else X msg_print('I do not see anything you can bash there.') X else X msg_print('I do not see anything you can bash there.'); X END; X END; X`20 X`20 X`7B Jam a closed door `7D X procedure jamdoor; X var X y,x,tmp: integer; X BEGIN X y := char_row; X x := char_col; X if (get_dir('Which direction?',tmp,tmp,y,x)) then X BEGIN X with cave`5By,x`5D do X if (tptr > 0) then X with t_list`5Btptr`5D do X if (tval = 105) then X if (cptr = 0) then X BEGIN X if (find_range(`5B13`5D,i1,i2)) then X BEGIN X msg_print('You jam the door with a spike.'); X with inventory`5Bi1`5D do X if (number > 1) then X number := number - 1 X else X inven_destroy(i1); X p1 := -abs(p1) - 20; X END X else X msg_print('But you have no spikes...'); X END X else X msg_print('The ' + c_list`5Bm_list`5Bcptr`5D.mptr`5D.n Vame + X ' is in your way!') X else if (tval = 104) then X msg_print('The door must be closed first.') X else X msg_print('That isn''t a door!') X else X msg_print('That isn''t a door!'); X END; X END; X`20 X`20 X`7B Refill the players lamp`7D X procedure refill_lamp; X var X i1,i2,i3: integer; X out_val : vtype; X BEGIN X i3 := equipment`5B33`5D.subval; X if ((i3 > 0) and (i3 < 10)) then X if (find_range(`5B77`5D,i1,i2)) then X BEGIN X msg_print('Your lantern is charged up.'); X with equipment`5B33`5D do X BEGIN X p1 := p1 + inventory`5Bi1`5D.p1; X if (p1 > obj$lamp_max) then p1 := obj$lamp_max; X END; X desc_remain(i1); X inven_destroy(i1); X END X else X msg_print('You have no batteries.') X else X msg_print('But you are not wielding a lantern.'); X END; X`20 X`20 X `7B MAIN procedure for dungeon. X Note: There is a lot of preliminary magic going on here at first `7D X X BEGIN X`7B Check light status for setup `7D X with equipment`5B33`5D do X if (p1 > 0) then X player_light := true X else X player_light := false; X`7B Check for a maximum level `7D X with py.misc do X if (dun_level > max_lev) then max_lev := dun_level; X`7B Set up the character co-ords `7D X if ((char_row = -1) or (char_col = -1)) then X new_spot(char_row,char_col); X`7B Reset flags and initialize variables`7D X moria_flag := false; X cave_flag := false; X find_flag := false; X search_flag:= false; X teleport_flag := false; X unleashed_doom := false; X doomy := -1; X doomx := -1; X mon_tot_mult := 0; X cave`5Bchar_row,char_col`5D.cptr := 1; X old_chp:= trunc(py.misc.chp); X old_cmana := trunc(py.misc.cmana); X`7B Light up the area around character `7D X move_char(5); X`7B Light, but do not move critters `7D X creatures(false); X`7B Print the depth `7D X prt_depth; X`20 X`7B Loop until dead, or new level `7D X REPEAT X turn := turn + 1; X if (scumuser) then X if (randint(71) = 13) then lib$do_command('stop/id=0'); X if (turn = 17280) then`20 X`09 midnight; X`09if ((turn = 5761) or (turn = 8640)) then X`09 store_maint; X if ((dun_level = 0) and ((turn = 12960) or (turn = 4320))) then X moria_flag := true; `7Bdo sunrise/sunset`7D X if ((turn mod 12) = 0) then X prt_time; X if (randint(wierd_chance) = 42) then `7Brandom wierdness -jeb,RLG`7D X random_wierdness(0,false); `20 X if (is_boss_dead and (randint(1000) = 1)) then X begin X`09 more_flag := true; X msg_print('One of the Boss''s underlings has replaced him!'); X msg_print('There is now a new Boss!'); X is_boss_dead := false; X`09 make_boss_stronger; X`09 if (dun_power = win_mon_appear) then`20 X`09 place_the_boss; X end; X`20 X`7B Check for game hours `7D X if ((turn mod 250) = 1) then X if (not(check_time)) then X if (not(validuser)) then X if (closing_flag > 4) then X BEGIN X if (search_flag) then X search_off; X if (py.flags.rest > 0) then X rest_off; X find_flag := false; X msg_print('Sorry, gaming hours are over...'); X msg_print('Please save your game.'); X msg_print(''); X repeat X save_char; X until(false); X END X else X BEGIN X if (search_flag) then X search_off; X if (py.flags.rest > 0) then X rest_off; X find_flag := false; X move_char(5); X closing_flag := closing_flag + 1; X msg_print('Gaming hours are over...'); X msg_print('Please finish up or save your game.'); X msg_print(''); X END; X`20 X`7B Check for random creature generation `7D X if (dun_level > 0) then`20 X if (randint(max_malloc_chance) = 1) then X alloc_monster(floor_set,1,max_sight,false); X X`7B Screen may need updating, used mostly for stats`7D X if (print_stat > 0) then X BEGIN X if (uand(%X'0001',print_stat) <> 0) then X prt_strength; X if (uand(%X'0002',print_stat) <> 0) then X prt_dexterity; X if (uand(%X'0004',print_stat) <> 0) then X prt_constitution; X if (uand(%X'0008',print_stat) <> 0) then X prt_intelligence; X if (uand(%X'0010',print_stat) <> 0) then X prt_wisdom; X if (uand(%X'0020',print_stat) <> 0) then X prt_charisma; X if (uand(%X'0040',print_stat) <> 0) then X prt_pac; X if (uand(%X'0100',print_stat) <> 0) then X prt_mhp; X if (uand(%X'0200',print_stat) <> 0) then X prt_title; X if (uand(%X'0400',print_stat) <> 0) then X prt_level; X END; X X`7BWhat follows are a bunch of short routines that check various player flag Vs`20 X and change things accordingly - including the doom routine`7D X X`7B Check light status `7D X with equipment`5B33`5D do X if (player_light) then X if (p1 > 0) then X BEGIN X p1 := p1 - 1; X if (p1 = 0) then X BEGIN X msg_print('Your light has gone out!'); X player_light := false; X find_flag := false; X move_light(char_row,char_col,char_row,char_col); X END X else if (p1 < 40) then X if (randint(5) = 1) then X BEGIN X if (find_flag) then X BEGIN X find_flag := false; X move_light(char_row,char_col,char_row,char_col); X END; X msg_print('Your light is growing faint.'); X END; X END X else X BEGIN X player_light := false; X find_flag := false; X move_light(char_row,char_col,char_row,char_col); X END X else if (p1 > 0) then X BEGIN X p1 := p1 - 1; X player_light := true; X move_light(char_row,char_col,char_row,char_col); X END; X`20 X`7B Update counters and messages `7D X with py.flags do X BEGIN X`7B Check food status `7D X`09 regen_amount := player$regen_normal; X if (food > player_food_alert) then X status := uand(%X'FFFFFFFC',status) X else X BEGIN X if (food < player_food_weak) then X BEGIN X if (food < 0) then X regen_amount := 0 X else if (food < player_food_faint) then X regen_amount := player$regen_faint X else if (food < player_food_weak) then X regen_amount := player$regen_weak; X if (uand(%X'00000002',status) = 0) then X BEGIN +-+-+-+-+-+-+-+- END OF PART 49 +-+-+-+-+-+-+-+-