-+-+-+-+-+-+-+-+ START OF PART 67 -+-+-+-+-+-+-+-+ X`09 end X`09else X`09 msg_print('But you are not carrying anything.'); X end; $ CALL UNPACK POTIONS.INC;1 726440863 $ create 'f' X`09`7B Pray like HELL...`09`09`09`09`09-RAK-`09`7D X`5Bpsect(misc2$code)`5D procedure pray; X var X`09`09i2,dir`09`09`09`09: integer; X`09`09i1,item_ptr`09`09`09: treas_ptr; X`09`09choice,chance`09`09`09: integer; X`09`09dumy,y_dumy,x_dumy`09`09: integer; X`09`09redraw`09`09`09`09: boolean; X`09`09ident`09`09`09`09: boolean; X`09`09bs`09`09`09`09: vtype; X begin X`09reset_flag := true; X`09if (py.flags.blind > 0) then X`09 msg_print('You can''t see to read your prayer!') X`09else if (no_light) then X`09 msg_print('You have no light to read by.') X`09else if (py.flags.confused > 0) then X`09 msg_print('You are too confused...') X`09else if (class`5Bpy.misc.pclass`5D.pspell) then X`09 if (inven_ctr > 0) then X`09 begin X`09 if (find_range(`5BPrayer_Book`5D,false,i1,i2)) then X`09 begin X`09`09 redraw := false; X`09`09 if (get_item(item_ptr,'Use which Holy Book?', X`09`09`09`09`09redraw,i2,trash_char,false)) then X`09`09 begin X`09`09 if (cast_spell('Recite which prayer?',item_ptr, X`09`09`09`09`09`09choice,chance,redraw)) then X`09`09`09with magic_spell`5Bpy.misc.pclass,choice`5D do X`09`09`09 begin X`09`09`09 reset_flag := false; X`09`09`09 if (randint(100) < chance) then X`09`09`09 msg_print('You lost your concentration!') X`09`09`09 else X`09`09`09 begin X`09`09`09`09y_dumy := char_row; X`09`09`09`09x_dumy := char_col; X`09`7B Prayers...`09`09`09`09`09`7D X`09case choice of X`7B Detect Evil `7D X`09 1 :`09detect_creatures(c_evil); X`7B Cure Light Wounds `7D X`09 2 :`09hp_player(damroll('3d3'),'a prayer.'); X`7B Bless `7D X`09 3 :`09bless(randint(12)+12); X`7B Remove Fear `7D X`09 4 :`09cure_me(py.flags.afraid); X`7B Call Light `7D X`09 5 :`09light_area(char_row,char_col); X`7B Find Traps `7D X`09 6 :`09detect_trap; X`7B Detect Doors/Stairs `7D X`09 7 :`09detect_sdoor; X`7B Slow Poison `7D X`09 8 :`09slow_poison; X`7B Blind Creature `7D X`09 9 :`09if (get_dir('Which direction?',dir,dumy,y_dumy,x_dumy)) then X`09`09 zap_monster(dir,char_row,char_col,0,c_confuse); X`7B Portal `7D X`09 10 :`09teleport(py.misc.lev*3); X`7B Cure Medium Wounds `7D X`09 11 :`09hp_player(damroll('4d4'),'a prayer.'); X`7B Ray of Sanctification `7D X`09 12 : if (get_dir('Which direction?',dir,dumy,y_dumy,x_dumy)) then X`09`09fire_bolt(c_good,dir,char_row,char_col,damroll('2d6'), X`09`09`09'Purple Ray'); X`7B Heroism `7D X`09 13 : py.flags.hero := py.flags.hero + randint(24) + 48; X`7B Sanctuary `7D X`09 14 :`09sleep_monsters1(char_row,char_col); X`7B Remove Curse `7D X`09 15 :`09for i2 := Equipment_min to equip_max-1 do X`09`09 with equipment`5Bi2`5D do X`09`09 flags := uand(flags,%X'7FFFFFFF'); X`7B Resist Heat and Cold `7D X`09 16 :`09with py.flags do X`09`09 begin X`09`09 resist_heat := resist_heat + randint(10) + 10; X`09`09 resist_cold := resist_cold + randint(10) + 10; X`09`09 end; X`7B Silence `7D X`09 17 : py.flags.temp_stealth := py.flags.temp_stealth + (randint(20) + 15 V); X`7B Resist Petrification `7D X`09 18 : py.flags.resist_petri := py.flags.resist_petri + (randint(15) + 10 V); X`7B Neutralize Poison `7D X`09 19 :`09cure_me(py.flags.poisoned); X`7B Cure Serious Wounds `7D X`09 20 :`09hp_player(damroll('9d4'),'a prayer.'); X`7B Chant `7D X`09 21 : bless(24+randint(48)); X`7B Sense Invisible `7D X`09 22 :`09detect_inv2(randint(24)+24); X`7B Protection from Evil `7D X`09 23 :`09protect_evil; X`7B Earthquake `7D X`09 24 :`09earthquake; X`7B Create food `7D X`09 25 : create_food(3,2,1,0,0); X`7B Sense Surroundings `7D X`09 26 :`09map_area; X`7B Orb of Draining `7D X`09 27 :`09if (get_dir('Which direction?',dir,dumy,y_dumy,x_dumy)) then X`09`09 fire_ball(c_good,dir,char_row,char_col, X`09`09`09`09damroll('3d6')+py.misc.lev,'Black Sphere'); X`7B Cure Critical Wounds `7D X`09 28 :`09hp_player(damroll('20d4'),'a prayer.'); X`7B Turn Undead `7D X`09 29 :`09zap_area(0,0,c_turn); X`7B Prayer `7D X`09 30 :`09py.flags.shero := 24 + randint(48); X`7B Dispell Undead `7D X`09 31 :`09zap_area(%X'0008',3*py.misc.lev,c_hp); X`7B Resist Paralysis `7D X`09 32 : py.flags.free_time := py.flags.free_time + (randint(20) + 15); X`7B Blade Barrier `7D X`09 33 : py.flags.blade_ring := py.flags.blade_ring+3+randint(3); X`7B Dispell Evil `7D X`09 34 :`09zap_area(%X'0004',3*py.misc.lev,c_hp); X`7B Heal `7D X`09 35 :`09hp_player(200,'a prayer.'); X`7B Resist Magic `7D X`09 36 : py.flags.magic_prot := py.flags.magic_prot + 40 + randint(40); X`7B Holy Thunder `7D X`09 37 : begin X`09`09msg_print('KABOOM!'); X`09`09zap_area(%X'0004',4+randint(4),c_thunder); X`09 end; X`7B Glyph of Warding `7D X`09 38 :`09warding_glyph; X`7B Hero's Feast `7D X`09 39 :`09begin X`09`09 msg_print('You have a marvelous meal!'); X`09`09 py.flags.food := player_food_full+4000; X`09`09 prt_hunger; X`09`09 hp_player(200,'a prayer.'); X`09`09 create_food(6,4,3,2,1); X`09`09 py.flags.status := uand(%X'FFFFFFFC',py.flags.status); X`09`09 prt_hunger; X`09`09 msg_print('You are full.'); X`09`09end; X`7B Holy Word `7D X`09 40 :`09begin X`09`09 zap_area(%X'0004',6*py.misc.lev,c_holy_word); X`09`09 cure_me(py.flags.afraid); X`09`09 cure_me(py.flags.poisoned); X`09`09 hp_player(1000,'a prayer.'); X`09`09end; X`09 otherwise ; X`09end; X`09`7B End of prayers...`09`09`09`09`7D X`09`09`09 if (not(reset_flag)) then X`09`09`09 with py.misc do X`09`09`09 begin X`09`09`09 exp := exp + sexp; X`09`09`09 prt_experience; X`09`09`09`09 sexp := 0; X`09`09`09 end X`09`09`09 end; X`09`09`09 with py.misc do X`09`09`09 if (not(reset_flag)) then X`09`09`09`09begin X`09`09`09`09 if (smana > cmana) then X`09`09`09`09 begin X`09`09`09`09 msg_print('You faint from fatigue!'); X`09`09`09`09 py.flags.paralysis :=`20 X`09`09`09`09`09randint(5*trunc(smana-cmana)); X`09`09`09`09 cmana := 0; X`09`09`09`09 if (randint(3) = 1) then X`09`09`7Bdoes not check for sustain`7D X`09`09 `09`09lower_stat(cn,'You have damaged your health!'); X`09`09`09`09 end X`09`09`09`09 else X`09`09`09`09 cmana := cmana - smana; X`09`09`09`09 prt_mana; X`09`09`09 end X`09`09`09 end X`09`09 end X`09`09 else X`09`09 if (redraw) then draw_cave; X`09 end X`09 else X`09 msg_print('But you are not carrying any Holy Books!'); X`09 end X`09 else X`09 msg_print('But you are not carrying any Holy Books!') X`09else X`09 msg_print('Pray hard enough and your prayers may be answered.'); X end; $ CALL UNPACK PRAYER.INC;1 1211810541 $ create 'f' X`09; PUTQIO - contains two related functions, PUT_BUFFER and PUT_QIO. X`09;`09 PUT_BUFFER accepts an (row,col) cursor address, and a X`09;`09 string. Cursor positioning characters are added into X`09;`09 the buffer in front of the string. Buffer dumps if it X`09;`09 becomes too full. X`09;`09 PUT_QIO performs the buffer dump operation. It can be X`09;`09 called externally, or by PUT_BUFFER. X`09; X`09; X`09;`09Globals used:`09(Declared in MORIA pascal code) X`09;`09`09cursor_r:`09array of 24 strings (6 bytes) X`09;`09`09curlen_r:`09length of each row string X`09;`09`09cursor_c:`09array of 80 strings (6 bytes) X`09;`09`09curlen_c:`09length of each col string X`09;`09`09cursor_l:`09Total length of row and col X`09;`09`09row_first:`09Boolean (1,0) X`09;`09`09`09`091 - Row,Col format X`09;`09`09`09`090 - Col,Row format X`09; X`09;`09Registers: X`09;`09`09R0`09Used by MOVC X`09;`09`09R1`09Used by MOVC X`09;`09`09R2`09Used by MOVC X`09;`09`09R3`09Used by MOVC X`09;`09`09R4`09Used by MOVC X`09;`09`09R5`09Used by MOVC X`09; X`09;`09This IO routine does no index checking. X`09`09`09`09`09; X`09.title`09PUT_QIO`09`09Build and dump IO buffer\ X`09.ident`09/put_qio/ X`09.psect`09IOBUF$DATA X`09`09`09`09`09; X`09IO$_WRITEVBLK:`09.long`0948`09; See STARLET ($IODEF) X`09out_buf:`09.blkb`091024`09; Size in bytes of buffer X`09out_len:`09.long`090`09; Current length of buffer X`09`09`09`09`09; X`09`09`09`09`09; X`09.psect`09IO$CODE,pic,con,rel,lcl,shr,exe,rd,nowrt,2 X`09.entry`09PUT_BUFFER,`5EM X`09`09`09`09`09; X`09movab`09out_buf,r3`09`09; Address of output buffer. X`09addl2`09out_len,r3`09`09; Buffer may be partially full. X`09cmpl`09row_first,#0`09`09; Test for row first X`09bgtr`091$`09`09`09; Branch to row,col format X`09`09`09`09`09; Col,Row format X`09mull3`09#12,12(ap),r1`09`09; (8 bytes * index) for col. X`09movab`09cursor_c-10`5Br1`5D,r1`09; Address of needed col coord. X`09movc3`09curlen_c,(r1),(r3)`09; Move col cursor characters. X`09mull3`09#12,8(ap),r1`09`09; (8 bytes * index) for row. X`09movab`09cursor_r-10`5Br1`5D,r1`09; Address of needed row coord. X`09movc3`09curlen_r,(r1),(r3)`09; Move row cursor characters. X`09brb`092$`09`09`09; Branch to copy string X1$:`09`09`09`09`09; Row,Col format X`09mull3`09#12,8(ap),r1`09`09; (8 bytes * index) for row. X`09movab`09cursor_r-10`5Br1`5D,r1`09; Address of needed row coord. X`09movc3`09curlen_r,(r1),(r3)`09; Move row cursor characters. X`09mull3`09#12,12(ap),r1`09`09; (8 bytes * index) for col. X`09movab`09cursor_c-10`5Br1`5D,r1`09; Address of needed col coord. X`09movc3`09curlen_c,(r1),(r3)`09; Move col cursor characters. X2$:`09`09`09`09`09; Copy String X`09tstw`09@4(ap)`09`09`09; No string? X`09beql`093$`09`09`09; No move needed. X`09movl`094(ap),r1`09`09; Move address of string arg. X`09movc3`09@4(ap),2(r1),(r3)`09; Move string arg into output buff. X3$: X`09addw3`09cursor_l,@4(ap),r1`09; Total length of new output X`09addw2`09r1,out_len`09`09; Total length of saved output X`09cmpw`09out_len,#900`09`09; Buffer getting full? X`09bgtr`09DUMP_QIO`09`09; Output the buffer... X`09ret`09`09`09`09; return from PUT_BUFFER X`09`09`09`09`09; X`09`09`09`09`09; PUT_QIO entry point XPUT_QIO:: X`09.word`090 X`09`09`09`09`09; XDUMP_QIO: X`09$QIOW_S`09EFN=#6, -`09`09; Unique event flag X`09`09CHAN=channel, -`09`09; Output the buffer X`09`09FUNC=IO$_WRITEVBLK, -`09; Write virtual block X`09`09P1=out_buf, -`09`09; Address of buffer X`09`09P2=out_len`09`09; Buffers current length X`09`09`09`09`09; X`09movw`09#0,out_len`09`09; Clear buffer; X`09ret`09`09`09`09; Return from PUT_QIO X`09`09`09`09`09; X`09.end $ CALL UNPACK PUTQIO.MAR;1 2019791587 $ create 'f' X`5Binherit('moria.env')`5D module quest; X`20 X`5Bglobal,psect(quest$code)`5D procedure enter_fortress; X X`7B Xprocedure change_money; X var X amount : integer; X Xbegin X amount := abs(py.misc.money`5Btotal$`5D - gld)*gold$value; X if (gld > py.misc.money`5Btotal$`5D) then add_money(amount) X else subtract_money(amount,true); Xend; X Xprocedure display_gold; X var X out_val : vtype; X`20 Xbegin X writev(out_val, 'gold remaining : ',gld:1); X prt( out_val, 19, 22) Xend; X`7D Xprocedure reward_quest; X X`09var X`09 reward`09`09: integer; X X`09begin X `09 reward := c_list`5Bpy.misc.cur_quest`5D.mexp * (randint(3)+5) + X`09 py.misc.lev * (randint(2)* 100) + X`09 (randint(100) + py.stat.c`5B5`5D) * 2 + X`09 py.stat.c`5B1`5D * randint(50) + 200; X`09 msg_print('Ah... '+py.misc.name+', I was expecting you.'); X`09 msg_print('I see you''ve killed the '+c_list`5Bpy.misc.cur_quest`5D.nam Ve+'. That''s good.'); X`09 msg_print('I''ve sent your reward with a page to the bank.'); X`09 msg_print('He deposited '+itos(reward)+' gold pieces under your name.') V; X`09 py.misc.account := py.misc.account + reward; X`09 msg_print('Have a good day. Perhaps you should rest a night at the inn V.'); X msg_print(' '); X`09 py.misc.rep := py.misc.rep + randint(5) + 2; X`09 if (py.misc.rep > 50) then py.misc.rep := 50; X py.misc.cur_quest := 0; X`09 py.flags.quested := false; X`09 turn_counter := quest_delay; X`09 prt_quested; X clear(1,1); X draw_cave; X`09end; Xfunction select_quest : integer;`20 X`09var`20 X`09 count`09`09: integer; X`09 exit_flag`09: boolean; X`09 tmp_select`09: integer; X X`09begin X`09 exit_flag := false; X`09 count := 0; X`09 repeat X`09 count := count + 1; X`09 if (c_list`5Bcount`5D.level > py.misc.lev) then X`09 begin X`09`09exit_flag := true; X`09`09repeat X`09`09 tmp_select := count + randint(80); X`09 until (uand(c_list`5Btmp_select`5D.cmove,%X'00008000') = 0);`20 X`09 if (tmp_select>max_creatures) then tmp_select:=max_creatures-1; X`09 end; X`09 if (count = max_creatures) then X`09 begin X`09`09tmp_select := max_creatures - 1; X`09`09exit_flag := true; X`09 end; X`09 until exit_flag; X`09 select_quest := tmp_select; X`09end; X Xprocedure draw_fortress (enter_flag : boolean); X var X shop_owner `09`09: vtype; X count,count2,count3`09`09: integer; X exit_flag`09`09`09: boolean; X Xbegin X if (not enter_flag) then X begin X for count := 1 to num_quests do X begin X count3 := 0; X exit_flag := true; X repeat X count3 := count3 + 1; `20 X quest`5Bcount`5D := select_quest; X for count2 := 1 to count-1 do X`09 if (quest`5Bcount`5D = quest`5Bcount2`5D) then exit_flag := false; X if (count3 > 100) then exit_flag := true; X until exit_flag; X end; X end; X clear(1,1); X shop_owner := 'Leckin (Arch-Mage) Quests'; X prt(shop_owner, 4, 10); X for count := 1 to num_quests do X prt(chr(count+96) + ')' + ' ' + c_list`5Bquest`5Bcount`5D`5D.name ,5 V+count,20); X `7B display_gold;`7D X prt('You may:',21,1); X prt(' p) Pick a quest. i) Info on a quest.',22,2); X prt('`5EZ) Exit from building. `5ER) Redraw the screen.' ,23,2); Xend; X Xfunction completed_quest : boolean; Xvar out_val : vtype; Xbegin Xif (not py.flags.quested) and (py.misc.cur_quest<>0) X then begin X`09 completed_quest := true;`09`09 `7B return value `7D X`09 py.flags.quested := false;`09`09 `7B not under quest `7D X`09 py.misc.quests := py.misc.quests + 1; `7B one more is now complete `7 VD X`09 end X else completed_quest := false; Xend; X Xfunction evaluate_char : boolean; Xbegin X if (py.flags.quested) or (py.misc.lev > py.misc.quests) then X evaluate_char := true X else`20 +-+-+-+-+-+-+-+- END OF PART 67 +-+-+-+-+-+-+-+-