-+-+-+-+-+-+-+-+ START OF PART 17 -+-+-+-+-+-+-+-+ X`09else if (ans > 10) then ans := 10; X`09react := ans; X end; X X `5Bglobal,psect(moria$code)`5D procedure change_rep(amt : integer); X var cost,left : integer; X begin X`09with py.misc do X`09 if ((amt<0) or (rep+amt<=0)) then`09`7Bbad deed or make up for sins`7D X`09 rep := rep + amt X`09 else`09`7B good deed that puts char into positive reputation `7D X`7B good characters progress slowly -- past 0 it costs 2, past 20 costs 3... V`7D X`09 begin X`09 if (rep < 0) then`09`7B go from bad to good `7D X`09`09begin X`09`09 amt := amt + rep; X`09`09 rep := 0; X`09`09end; `7Bincrease goodness`7D X`09 rep := trunc(sqrt((20+rep)*(20+rep)+40*amt)-20); X`09 end; X end; X X`09`7B Check to see if a store is open, message when closed`09-DMF-`09`7D X `5Bglobal,psect(moria$code)`5D function check_store_hours(st,sh : intege Vr) : boolean; X var X`09name,prop`09: string; X`09ope`09`09: char; X`09flag`09`09: boolean; X begin X`09if (sh <> 0) then X`09 with store`5Bsh`5D.store_open do X`09 with py.misc do X`09 flag := ((cur_age.year > year) or`20 X`09 ((cur_age.year = year) and X`09 ((cur_age.month > month) or X`09`09 ((cur_age.month = month) and X`09`09 ((cur_age.day > day) or X`09`09 ((cur_age.day = day) and X`09`09 ((cur_age.hour > hour) or X`09`09 ((cur_age.hour = hour) and X`09`09 ((cur_age.secs > secs)))))))))) X`09else X`09 flag := true; X`09if (flag) then X`09 begin X`09 name := store_door`5Bst`5D.name; X`09 insert_str(name,'the entrance to the ',''); X`09 ope := store_hours`5Bst,py.misc.cur_age.day mod 7 + 1, X`09`09`09`09 py.misc.cur_age.hour div 2 + 1`5D; X`09 case ope of X`09 ' ' : check_store_hours := true; X`09 'N', X`09 'W', X`09 'D' : begin X`09`09 case ope of X`09`09 'N' : prop := 'night.'; X`09`09 'W' : prop := 'weekend.'; X`09`09 'D' : prop := 'day.'; X`09`09 end; X`09`09 if (wizard2) then X`09`09 begin X`09`09 msg_print('Being a wizard, you break into the shop.'); X`09`09 msg_print(''); X`09`09 check_store_hours := true; X`09`09 end X`09`09 else X`09`09 begin X`09`09 msg_print('Sorry, the '+name+' is closed for the '+prop); X`09`09 check_store_hours := false; X`09`09 end; X`09`09 end; X`09 'B' : begin X`09`09 writev(prop,'Do you wish to pay ',store_bribe`5Bst`5D:1, X`09`09`09`09 ' gold to bribe the owner?'); X`09`09 if (get_yes_no(prop)) then X`09`09 if (py.misc.money`5Btotal$`5D >= store_bribe`5Bst`5D) then X`09`09 begin X`09`09`09 check_store_hours := true; X`09`09`09 subtract_money(store_bribe`5Bst`5D*gold$value,false); X`09`09`09 msg_print('The owner reluctantly lets you in.'); X`09`09`09 msg_print(''); X`09`09 end X`09`09 else X`09`09 begin X`09`09`09 check_store_hours := false; X`09`09`09 msg_print('You haven''t the money to bribe the owner!'); X`09`09 end X`09`09 else X`09`09 begin X`09`09 check_store_hours := false; X`09`09 msg_print('The owner complains bitterly about being woken up V for no reason.'); X`09`09 end; X`09`09 end; X`09 otherwise check_store_hours := false; `20 X`09 end; X`09 end X`09else X`09 msg_print('The doors are locked.'); X end; X X X`09`7B Player hit a trap...`09(Chuckle)`09`09 `09-RAK-`09`7D X `5Bglobal,psect(moria$code)`5D procedure hit_trap(var y,x : integer); X var X`09`09i1,i2,ty,tx : integer; X`09`09dam : integer; X`09`09ident `09`09`09: boolean; X X X begin X`09change_trap(y,x); X`09lite_spot(char_row,char_col); X`09find_flag := false; X`09with cave`5By,x`5D do X`09with py.misc do X`09 begin X`09 dam := damroll(t_list`5Btptr`5D.damage); X`09 case t_list`5Btptr`5D.subval of X`7B Open pit`7D 1 : begin X`09`09 msg_print('You fell into a pit!'); X`09`09 if (py.flags.ffall) then X`09`09 msg_print('You gently float down.') X`09`09 else X`09`09 take_hit(dam,'an open pit.'); X`09`09 end; X`7B Arrow trap`7D 2 : begin X`09`09 if (test_hit(125,0,0,pac+ptoac)) then X`09`09 begin X`09`09`09take_hit(dam,'an arrow trap.'); X`09`09`09msg_print('An arrow hits you.'); X`09`09 end X`09`09 else X`09`09 msg_print('An arrow barely misses you.'); X`09`09 end; X`7B Covered pit`7D3 : begin X`09`09 msg_print('You fell into a covered pit.'); X`09`09 if (py.flags.ffall) then X`09`09 msg_print('You gently float down.') X`09`09 else X`09`09 take_hit(dam,'a covered pit.'); X`09`09 place_trap(y,x,2,1); X`09`09 end; X`7B Trap door`7D 4 : begin X`09`09 msg_print('You fell through a trap door!'); X`09`09 msg_print(' '); X`09`09 moria_flag := true; X`09`09 dun_level := dun_level + 1; X`09`09 if (py.flags.ffall) then X`09`09 msg_print('You gently float down.') X`09`09 else X`09`09 take_hit(dam,'a trap door.'); X`09`09 end; X`7B Sleep gas`7D 5 : if (py.flags.paralysis = 0) then X`09`09 begin X`09`09 msg_print('A strange white mist surrounds you!'); X`09`09 if (py.flags.free_act) then X`09`09`09msg_print('You are unaffected.') X`09`09 else X`09`09`09begin X`09`09`09 msg_print('You fall asleep.'); X`09`09`09 py.flags.paralysis := py.flags.paralysis + X`09`09`09`09`09`09`09randint(10) + 4; X`09`09`09end X`09`09 end; X`7B Hid Obj`7D 6 : begin X`09`09 fm := false; X`09`09 pusht(tptr); X`09`09 place_object(y,x); X`09`09 msg_print('Hmmm, there was something under this rock.'); X`09`09 end; X `7B STR Dart`7D 7 : begin X`09`09 if (test_hit(125,0,0,pac+ptoac)) then X`09`09 if lose_stat(sr,'','A small dart hits you.') then X`09`09`09begin X`09`09`09 take_hit(dam,'a dart trap.'); X`09`09 `09 print_stat := uor(%X'0001',print_stat); X`09`09`09 msg_print('A small dart weakens you!'); X`09`09`09end X`09`09 else X`09`09 msg_print('A small dart barely misses you.'); X`09`09 end; X`7B Teleport`7D 8 : begin X`09`09 teleport_flag := true; X`09`09 msg_print('You hit a teleport trap!'); X`09`09 end; X`7B Rockfall`7D 9 : begin X`09`09 take_hit(dam,'falling rock.'); X`09`09 pusht(tptr); X`09`09 place_rubble(y,x); X`09`09 msg_print('You are hit by falling rock'); X`09`09 end; X`7B Corrode gas`7D10: begin X`09`09 corrode_gas('corrosion gas.'); X`09`09 msg_print('A strange red gas surrounds you.'); X`09`09 end; X`7B Summon mon`7D 11: begin X`09`09 fm := false; `7B Rune disappears... `7D X`09`09 pusht(tptr); X`09`09 tptr := 0; X`09`09 for i1 := 1 to (2+randint(3)) do X`09`09 begin X`09`09`09ty := char_row; X`09`09`09tx := char_col; X`09`09`09if cave`5Bty,tx`5D.fval in water_set then X`09`09`09 summon_water_monster(ty,tx,false) X`09`09`09else X`09`09`09 summon_land_monster(ty,tx,false); X`09`09 end; X`09`09 end; X`7B Fire trap`7D 12: begin X`09`09 fire_dam(dam,'a fire trap.'); X`09`09 msg_print('You are enveloped in flames!'); X`09`09 end; X`7B Acid trap`7D 13: begin X`09`09 acid_dam(dam,'an acid trap.'); X`09`09 msg_print('You are splashed with acid!'); X`09`09 end; X`7B Poison gas`7D 14: begin X`09`09 poison_gas(dam,'a poison gas trap.'); X`09`09 msg_print('A pungent green gas surrounds you!'); X`09`09 end; X`7B Blind Gas `7D 15: begin X`09`09 msg_print('A black gas surrounds you!'); X`09`09 with py.flags do X`09`09 blind := blind + randint(50) + 50; X`09`09 end; X`7B Confuse Gas`7D16: with py.flags do X`09`09 begin X`09 msg_print('A gas of scintillating colors surrounds you!'); X`09`09 confused := confused + randint(15) + 15; X`09`09 end; X`7B Slow Dart`7D 17: begin X`09`09 if (test_hit(125,0,0,pac+ptoac)) then X`09`09 begin X`09`09`09take_hit(dam,'a dart trap.'); X`09`09`09msg_print('A small dart hits you!'); X`09`09`09with py.flags do X`09`09`09 slow := slow + randint(20) + 10; X`09`09 end X`09`09 else X`09`09 msg_print('A small dart barely misses you.'); X`09`09 end; X`7B CON Dart`7D 18: begin X`09`09 if (test_hit(125,0,0,pac+ptoac)) then X`09`09 if lose_stat(cn,'','A small dart hits you.') then X`09`09`09begin X`09`09`09 take_hit(dam,'a dart trap.'); X`09`09`09 print_stat := uor(%X'0004',print_stat); X`09`09`09 msg_print('A small dart weakens you!'); X`09`09`09end X`09`09 else X`09`09 msg_print('A small dart barely misses you.'); X`09`09 end; X`7BSecret Door`7D 19: ; X`7B Chute`7D 20: begin X`09`09 msg_print('You fell down a chute!'); X`09`09 msg_print(' '); X`09`09 moria_flag := true; X`09`09 dun_level := dun_level + randint(6); X`09`09 if (py.flags.ffall) then X`09`09 msg_print('You gently slide down.') X`09`09 else X`09`09 take_hit(dam,'chute landing.'); X`09`09 end; X`7B Scare Mon`7D 99: ; X `20 X`09`09`09`7B Town level traps are special, the stores...`09`7D X`7B General `7D101: if (check_store_hours(1,1)) then enter_store(1); X`7B Armory `7D102: if (check_store_hours(2,2)) then enter_store(2); X`7B Weaponsmith`7D103: if (check_store_hours(3,3)) then enter_store(3); X`7B Temple `7D104: if (check_store_hours(4,4)) then enter_store(4); X`7B Alchemy `7D105: if (check_store_hours(5,5)) then enter_store(5); X`7B Magic-User `7D106: if (check_store_hours(6,6)) then enter_store(6); X`7B Inn`09 `7D107: if (check_store_hours(7,7)) then enter_store(7); X`7B Trade Post `7D108: if (check_store_hours(8,0)) then enter_trading_post; X`7B Library `7D109: if (check_store_hours(9,8)) then enter_store(8); X`7B Music Shop `7D110: if (check_store_hours(10,9)) then enter_store(9); X`7B Insurance `7D111: if (check_store_hours(12,0)) then msg_print( X`09`09'Moved...to the bank.'); X`7B Bank `7D112: if (check_store_hours(13,0)) then enter_bank; X`7B Gem Shop `7D113: if (check_store_hours(11,10)) then enter_store(10); X`7B $ Changer `7D114: if (check_store_hours(14,0)) then msg_print( X`09`09'Oh, just go to the bloody bank!'); X`7B Casino `7D115: if (check_store_hours(15,0)) then enter_casino; X`7B Deli `7D116: if (check_store_hours(16,11)) then enter_store(11); X`7B Fortress `7D117: enter_fortress; X`7B Whirlpool`7D 123: begin X`09`09 msg_print('You are swept into a whirlpool!'); X`09`09 msg_print(' '); X`09`09 moria_flag := true; X`09`09 repeat X`09`09 dun_level := dun_level + 1; X`09`09 if not (py.flags.ffall) then `7BXXX...swimming_worn`7D X`09`09 begin X`09`09`09msg_print('You are drowning!'); X`09`09`09take_hit(dam,'drowning.'); X`09`09 end; X`09`09 until (randint(2) = 1); X`09`09 end; X`7B House `7D120,121,122: begin X`09`09 case t_list`5Btptr`5D.p1 of X`09`09 1 : begin X`09`09`09 msg_print('The building is empty.'); X`09`09`09 if (react(10)=0) then X`09`09`09`09begin X`09`09`09`09 msg_print('The building is being guarded!'); X`09`09`09`09 call_guards('Magic Mouth spell'); X`09`09`09`09end; X`09`09`09 end; X`09`09 2 : begin X`09`09`09 msg_print('There is a Thieves'' Guild meeting here.'); X`09`09`09 case react(6) of X`09`09`09`090`09: call_guards('Guildmaster'); X`09`09`09`091..7 : kicked_out; X`09`09`09`098..10 : thief_games; X`09`09`09 end; X`09`09`09 end; X`09`09 3 : begin X`09`09`09 msg_print('This is a town brothel. Some young prostitutes are V here.'); X`09`09`09 case react(10) of X`09`09`09`090 : call_guards('prostitutes'); X`09`09`09`091..6 : kicked_out; X`09`09`09`09otherwise begin X`09`09`09`09`09 if (py.misc.sex='Male') then X`09`09`09`09`09 begin X`09`09msg_print('The girls invite you to prove your abilities.'); X`09`09battle_game(spell_adj(ca),'some playful prostitutes'); X`09`09`09`09`09 end X`09`09`09`09`09 else X`09`09`09`09`09 begin X`09`09msg_print('The girls invite you to work with them.'); X`09`09`09`09`09`09brothel_game; X`09`09`09`09`09 end; X`09`09`09 `09`09 end; X`09`09`09 end; X`09`09`09 end; X`09 `09 4 : begin X`09`09`09`09msg_print('Some drunken fighters are telling tales here.'); X`09`09`09 case react(8) of X`09`09`09`09 0`09: call_guards('group of fighters'); X`09`09`09`09 1..6 : kicked_out; X`09`09`09`09 otherwise`20 X`09`09`09`09 begin X`09`09`09`09 msg_print('They ask you to demonstrate your fighting skill V.'); X`09`09`09`09 battle_game(py.misc.ptohit,'some drunken fighters'); X`09`09`09`09 end; X`09`09`09`09end; X`09`09`09 end; X`09`09 5 : begin X`09`09`09 msg_print('There is a party in progress here.'); X`09`09`09 case react(8) of X`09`09`09`090`09: call_guards('party''s host'); X`09`09`09`091..5`09: kicked_out; X`09`09`09`09otherwise party; X`09`09`09 end; X`09`09`09 end; X`09`09 6 : begin X`09`09`09 case randint(2) of X`09`09`09`091:msg_print('The building is a poorhouse.'); X`09`09`09`092:msg_print('This is an orphanage.'); X`09`09`09 end; X`09`09`09 case react(12) of X`09`09`09`090 `09: call_guards('beggars'); X`09`09`09`091..4 `09: kicked_out; X`09`09`09`09otherwise case(2) of X`09`09`09`09 1 : beg_food; X`09`09`09`09 2 : beg_money; X`09`09`09`09end; X`09`09`09 end; X`09`09`09 end; X`09`09 7,8 : begin X`09`09`09 case randint(3) of X`09`09`09`091 :msg_print('This is the home of a peasant family.'); X`09`09`09`092 :msg_print('These are the quarters of a humble laborer.'); X`09`09`09`093 :msg_print(' This is the home of several poor families.'); X`09`09`09 end; X`09`09`09 case react(8) of X`09`09`09`090`09: call_guards('peasant(s)'); X`09`09`09`091..3 `09: kicked_out; X`09`09`09`094..7`09: invite_for_meal; X`09`09`09`098..10`09: spend_the_night('peasant(s)'); X`09`09`09 end; X`09`09`09 end; X`09`09 9 : begin X`09`09`09 case randint(3) of X`09`09`091,2 : msg_print('This is the home of a merchant.'); X`09`09`093 : msg_print('This is the house of an accomplished craftsman.'); X`09`09`09 end; X`09`09`09 case react(5) of X`09`09`09`090`09: call_guards('owner'); X`09`09`09`091..4`09: kicked_out; X`09`09`09`095..9`09: invite_for_meal; X`09`09`09`0910`09: spend_the_night('gentleman'); X`09`09`09 end; +-+-+-+-+-+-+-+- END OF PART 17 +-+-+-+-+-+-+-+-