-+-+-+-+-+-+-+-+ START OF PART 18 -+-+-+-+-+-+-+-+ X`09`09`09 end; X`09`09 10 : begin X`09`09`09 msg_print('There is a religious service in progress here.'); X`09`09`09 case react(8) of X`09`09`09`090`09: call_guards('High Priest'); X`09`09`09`091..5`09: kicked_out; X`09`09`09`09otherwise worship; X`09`09`09 end; X`09`09`09 end; X`09`09 11 : begin X`09`09`09 case randint(3) of X`09`09`09`091:msg_print('This is the house of a wealthy shopkeeper.'); X`09`09`09`092:msg_print('This is the mansion of a affluent noble.'); X`09`09`09`093:msg_print('This is the estate of an rich guildsman.'); X`09`09`09 end; X`09`09`09 case react(2) of X`09`09`09`090`09: call_guards('master of the house'); X`09`09`09`091..3`09: kicked_out; X`09`09`09`094..9`09: invite_for_meal; X`09`09`09`0910`09: spend_the_night('master of the house'); X`09`09`09 end; X`09`09`09 end; X`09`09 12 : begin X`09`09`09 msg_print('This is the home of a powerful mage.'); X`09`09`09 case react(5) of X`09`09`09`090`09: call_wizards; X`09`09`09`091..3`09: call_guards('mage'); X`09`09`09`094..9`09: kicked_out; X`09`09`09`0910`09: invite_for_meal; X`09`09`09 end; X`09`09`09 end; X`09`09 end; X`09`09 t_list`5Btptr`5D.p1 := 1; X`09`09 prt_time; X`09`09 prt_stat_block; X`09`09 end; X`09`09otherwise`09msg_print('Unknown trap value'); X`09 end X`09 end X end; X X X`09`7B AC gets worse `09`09`09`09`09-RAK-`09`7D X`09`7B Note: This routine affects magical AC bonuse so that stores `7D X`09`7B can detect the damage. `7D X `5Bglobal,psect(moria$code)`5D function minus_ac(typ_dam : integer) : bo Volean; X var X`09i1,i2 : integer; X`09tmp : array `5B1..8`5D of integer; X begin X`09i1 := 0; X`09if (equipment`5BEquipment_armor`5D.tval > 0) then X`09 begin X`09 i1 := i1 + 1; X`09 tmp`5Bi1`5D := Equipment_armor; X`09 end; X`09if (equipment`5BEquipment_shield`5D.tval > 0) then X`09 begin X`09 i1 := i1 + 1; X`09 tmp`5Bi1`5D := Equipment_shield; X`09 end; X`09if (equipment`5BEquipment_cloak`5D.tval > 0) then X`09 begin X`09 i1 := i1 + 1; X`09 tmp`5Bi1`5D := Equipment_cloak; X`09 end; X`09if (equipment`5BEquipment_gloves`5D.tval > 0) then X`09 begin X`09 i1 := i1 + 1; X`09 tmp`5Bi1`5D := Equipment_gloves; X`09 end; X`09if (equipment`5BEquipment_helm`5D.tval > 0) then X`09 begin X`09 i1 := i1 + 1; X`09 tmp`5Bi1`5D := Equipment_helm; X`09 end; X`09if (equipment`5BEquipment_boots`5D.tval > 0) then X`09 begin X`09 i1 := i1 + 1; X`09 tmp`5Bi1`5D := Equipment_boots; X`09 end; X`09if (equipment`5BEquipment_belt`5D.tval > 0) then X`09 begin X`09 i1 := i1 + 1; X`09 tmp`5Bi1`5D := Equipment_belt; X`09 end; X`09if (equipment`5BEquipment_bracers`5D.tval > 0) then X`09 begin X`09 i1 := i1 + 1; X`09 tmp`5Bi1`5D := Equipment_bracers; X`09 end; X`09minus_ac := false; X`09if (i1 > 0) then X`09 begin X`09 i2 := tmp`5Brandint(i1)`5D; X`09 inven_temp`5E.data := equipment`5Bi2`5D; X`09 with equipment`5Bi2`5D do X`09 if (uand(flags,typ_dam) <> 0) then X`09`09begin X`09`09 objdes(out_val,inven_temp,false); X`09`09 msg_print('Your ' + out_val + ' resists damage!'); X`09`09 minus_ac := true; X`09`09end X`09 else if ((ac+toac) > 0) then X`09`09begin X`09`09 objdes(out_val,inven_temp,false); X`09`09 msg_print('Your ' + out_val + ' is damaged!'); X`09`09 toac := toac - 1; X`09`09 py_bonuses(blank_treasure,0); X`09`09 minus_ac := true; X`09`09end X`09 end X end; X X X`09`7B Corrode the unsuspecting person's armor -RAK- `7D X `5Bglobal,psect(moria$code)`5D procedure corrode_gas(kb_str : vtype); X begin X`09if (not (minus_ac(resist_acid_worn_bit))) then X`09 take_hit(randint(8),kb_str); X`09print_stat := uor(%X'0040',print_stat); X`09if (inven_damage(`5Bsword,dagger,helm,gem_helm,shield,hard_armor,wand`5D, V5) > 0) X`09then X`09 begin X`09 msg_print('There is an acrid smell coming from your pack.'); X`09 prt_weight; X`09 end ; X end; X X X`09`7B Poison gas the idiot...`09`09`09`09-RAK-`09`7D X `5Bglobal,psect(moria$code)`5D procedure poison_gas(dam : integer; kb_st Vr : vtype); X begin X`09take_hit(dam,kb_str); X`09print_stat := uor(%X'0040',print_stat); X`09py.flags.poisoned := py.flags.poisoned + 12 + randint(dam); X end; X X X`09`7B Burn the fool up...`09`09`09`09`09-RAK-`09`7D X `5Bglobal,psect(moria$code)`5D procedure fire_dam(dam : integer; kb_str V : vtype); X begin X`09if (py.flags.fire_resist)then X`09 dam := dam div 3; X`09if (py.flags.resist_heat > 0) then X`09 dam := dam div 3; X`09take_hit(dam,kb_str); X`09print_stat := uor(%X'0080',print_stat); X`09if (inven_damage(`5Barrow,bow_crossbow_or_sling,hafted_weapon,pole_arm, X`09`09`09 maul,boots,gloves_and_gauntlets,Cloak,soft_armor, X`09`09`09 staff,scroll1,scroll2`5D,3) > 0) then X`09 begin X`09 msg_print('There is smoke coming from your pack!'); X`09 prt_weight ; X`09 end ; X end; X X X`09`7B Throw acid on the hapless victim`09`09`09-RAK-`09`7D X `5Bglobal,psect(moria$code)`5D procedure acid_dam(dam : integer; kb_str V : vtype); X var X`09`09flag : integer; X begin X`09flag := 0; X`09if (minus_ac(resist_acid_worn_bit)) then X`09 flag := 1; X`09if (py.flags.acid_resist) then X`09 flag := flag + 2; X`09case flag of X`09 0 : take_hit(dam,kb_str); X`09 1 : take_hit((dam div 2),kb_str); X`09 2 : take_hit((dam div 3),kb_str); X`09 3 : take_hit((dam div 4),kb_str); X`09end; X`09print_stat := uor(%X'00C0',print_stat); X`09if (inven_damage(`5BMiscellaneous_object,chest,bolt,arrow,hafted_weapon, X`09`09`09 bow_crossbow_or_sling,pole_arm,boots, X`09`09`09 gloves_and_gauntlets,Cloak,soft_armor`5D,3) > 0) then X`09 begin X`09 msg_print('There is an acrid smell coming from your pack!'); X`09 prt_weight ; X`09 end ; X end; X X X`09`7B Freeze him to death...`09`09`09`09-RAK-`09`7D X `5Bglobal,psect(moria$code)`5D procedure cold_dam(dam : integer; kb_str V : vtype); X begin X`09if (py.flags.cold_resist)then X`09 dam := dam div 3; X`09if (py.flags.resist_cold > 0) then X`09 dam := dam div 3; X`09take_hit(dam,kb_str); X`09print_stat := uor(%X'0080',print_stat); X`09if (inven_damage(`5Bpotion1,potion2`5D,5) > 0) then X`09 begin X`09 msg_print('Something shatters inside your pack!'); X`09 prt_weight ; X`09 end ; X end; X X X`09`7B Lightning bolt the sucker away...`09`09`09-RAK-`09`7D X `5Bglobal,psect(moria$code)`5D procedure light_dam(dam : integer; kb_str V : vtype); X begin X`09if (py.flags.lght_resist) then X`09 dam := dam div 3; X`09if (py.flags.resist_lght > 0) then X`09 dam := dam div 3; X`09take_hit(dam,kb_str); X`09print_stat := uor(%X'0080',print_stat); X end; X X X`09`7B Allocates objects upon a creatures death`09`09-RAK-`09`7D X`09`7B Oh well, another creature bites the dust... Reward the victor`7D X`09`7B based on flags set in the main creature record `7D X `5Bglobal,psect(moria$code)`5D procedure monster_death(y,x : integer; flag Vs : unsigned); X var X`09i1 : integer; X begin X i1 := INT(uand(flags,%X'03000000') div (%X'01000000')); X if (uand(flags,%X'04000000') <> 0) then X`09if (randint(100) < 60) then X`09 summon_object(y,x,1,i1); X if (uand(flags,%X'08000000') <> 0) then X`09if (randint(100) < 90) then X`09 summon_object(y,x,1,i1); X if (uand(flags,%X'10000000') <> 0) then X`09summon_object(y,x,randint(2),i1); X if (uand(flags,%X'20000000') <> 0) then X`09summon_object(y,x,damroll('2d2'),i1); X if (uand(flags,%X'40000000') <> 0) then X`09summon_object(y,x,damroll('4d3'),i1); X if (uand(flags,%X'80000000') <> 0) then X`09begin X`09 total_winner := true; X`09 prt_winner; X`09 msg_print('*** CONGRATULATIONS *** You have won the game...'); X`09 msg_print('Use -Y when you are ready to quit.'); X`09end; X end; X X X`09`7B Decreases monsters hit points and deletes monster if needed.`09`7D X`09`7B (Picking on my babies...) -RAK- `7D X `5Bglobal,psect(moria$code)`5D function mon_take_hit(monptr,dam : integ Ver) : integer; X var X`09acc_tmp : real; X begin X`09with m_list`5Bmonptr`5D do X`09 begin X`09 hp := hp - dam; X`09 csleep := 0; X`09 if (hp < 0) then X`09 begin X`09`09monster_death(fy,fx,c_list`5Bmptr`5D.cmove); X`09`09if ((mptr = py.misc.cur_quest) and (py.flags.quested)) then X`09`09 begin X`09`09 py.flags.quested := false; X`09`09 prt_quested; X`09`09 msg_print('*** QUEST COMPLETED ***'); X`09`09 msg_print('Return to the surface and report to the Arch-Wizard.'); X`09`09 end; X`09`09with c_list`5Bmptr`5D do X`09`09 with py.misc do X`09`09 begin X`09`09 if (uand(cmove,%X'00004000') = 0) and (mexp > 0) then X`09`09 begin X`09`09 acc_tmp := mexp*((level+0.1)/lev); X`09`09 i1 := trunc(acc_tmp); X`09`09 acc_exp := acc_exp + (acc_tmp - i1); X`09`09 if (acc_exp > 1) then X`09`09`09 begin X`09`09`09 i1 := i1 + 1; X`09`09`09 acc_exp := acc_exp - 1.0; X`09`09`09 end; X`09`09 exp := exp + i1; X`09`09 end X`09`09 else if (mexp > 0) then X`09`09`09begin X`09`09`09 change_rep(-mexp); X`09`09`09 if (py.misc.rep > -250) then X`09`09`09 begin X`09`09`09 msg_print('The townspeople look at you sadly.'); X`09`09`09 msg_print('They shake their heads at the needless violence.') V; X`09`09`09 end X`09`09`09 else if (py.misc.rep > -1000) then X`09`09`09 begin X`09`09`09 monster_summon_by_name(char_row,char_col,'Town Guard',true,fa Vlse); X`09`09`09 msg_print('The townspeople call for the guards!'); X`09`09`09 end X`09`09`09 else if (py.misc.rep > -2500) then X`09`09`09 begin X`09`09`09 monster_summon_by_name(char_row,char_col,'Town Wizard',true,f Valse); X`09`09`09 msg_print('A Town Wizard appears!'); X`09`09`09 end X`09`09`09 else X`09`09`09 begin X`09`09`09 msg_print('Your god disapproves of your recent town killing s Vpree.'); X`09`09`09 msg_print('Unlike the townspeople, he can do something about V it.'); X`09`09`09 msg_print(' '); X`09`09`09 died_from := 'The Wrath of God'; X`09`09`09 upon_death; X`09`09`09 end; X`09`09`09end; X`09`09 end; X`09`09mon_take_hit := mptr; X`09`09delete_monster(monptr); X`09`09if (i1 > 0) then prt_experience; X`09 end X`09 else X`09 mon_take_hit := 0; X`09 end X end; X X X`09`7B Special damage due to magical abilities of object`09-RAK-`09`7D X `5Bglobal,psect(moria$code)`5D function tot_dam( X`09`09item`09: treasure_type; X`09`09tdam`09: integer; X`09`09monster`09: creature_type) : integer; X begin X`09with item do X`09 if (tval in `5Bsling_ammo,bolt,arrow,bow_crossbow_or_sling, X`09`09hafted_weapon,pole_arm,sword,dagger,maul,flask_of_oil, X`09`09lamp_or_torch`5D) then X`09 with monster do X`09 begin X`09`09`7B Slay Dragon `7D X`09`09if ((uand(cdefense,%X'0001') <> 0) and X`09`09 (uand(flags,slay_dragon_worn_bit) <> 0)) then X`09`09 tdam := tdam*4 X`09`09`7B Slay Undead `7D X`09`09else if ((uand(cdefense,%X'0008') <> 0) and X`09`09`09 (uand(flags,slay_undead_worn_bit) <> 0)) then X`09`09 tdam := tdam*3 X`09`09`7B Demon Bane`09`7D X`09`09else if ((uand(cdefense,%X'0400') <> 0) and X`09`09`09 (uand(flags2,slay_demon_worn_bit) <> 0)) then X`09`09 tdam := tdam*3 X`09`09`7B Slay Monster `7D X`09`09else if ((uand(cdefense,%X'0002') <> 0) and X`09`09`09 (uand(flags,slay_monster_worn_bit) <> 0)) then X`09`09 tdam := tdam*2 X`09`09`7B Slay Regenerative `7D X`09`09else if ((uand(cdefense,%X'8000') <> 0) and X`09`09`09 (uand(flags2,slay_regen_worn_bit) <> 0)) then X`09`09 tdam := tdam*3 X`09`09`7B Slay Evil `7D X`09`09else if ((uand(cdefense,%X'0004') <> 0) and X`09`09`09 (uand(flags,slay_evil_worn_bit) <> 0)) then X`09`09 tdam := tdam*2 X`09`09`7B Frost `7D X`09`09else if ((uand(cdefense,%X'0010') <> 0) and X`09`09`09 (uand(flags,cold_brand_worn_bit) <> 0)) then X`09`09 tdam := trunc(tdam*1.5) X`09`09`7B Fire `7D X`09`09else if ((uand(cdefense,%X'0020') <> 0) and X`09`09`09 (uand(flags,flame_brand_worn_bit) <> 0)) then X`09`09 tdam := trunc(tdam*1.5) X`09`09`7B Soul Sword`09`7D X`09`09else if ((not(uand(cdefense,%X'0008') <> 0)) and X`09`09`09 (uand(flags2,soul_sword_worn_bit) <> 0)) then X`09`09 tdam := tdam*2; X`09 end; X`09tot_dam := tdam; X end; X X X`09`7B Player attacks a (poor, defenseless) creature `09-RAK-`09`7D X `5Bglobal,psect(moria$code)`5D function py_attack(y,x : integer) : boole Van; X var X`09a_cptr,a_mptr,i3,blows,tot_tohit,py_crit,crit_mult `09: integer; X`09m_name,out_val `09`09: vtype; X`09mean_jerk_flag,is_sharp`09`09`09`09: boolean; X`09backstab_flag`09`09`09`09`09: boolean; X begin X`09py_attack := false; X`09a_cptr := cave`5By,x`5D.cptr; X`09a_mptr := m_list`5Ba_cptr`5D.mptr; X`09if (py.misc.pclass = 4) and (m_list`5Ba_cptr`5D.csleep <> 0) then X`09 backstab_flag := true X`09else backstab_flag := false; X`09m_list`5Ba_cptr`5D.csleep := 0; X`09find_monster_name(m_name,a_cptr,false) ; X`09if (equipment`5BEquipment_primary`5D.tval > 0) then `7B Proper weap Von `7D X`09 blows := attack_blows(equipment`5BEquipment_primary`5D.weight,tot_tohit V) X`09else `7B Bare hands? `7D X`09 if (py.misc.pclass = 10) then X`09 begin X`09 blows := attack_blows(12000,tot_tohit) + 1; X`09 tot_tohit := 0; X`09 end X`09 else X`09 begin X`09 blows := 2; X`09 tot_tohit := -3 X`09 end; X`09if backstab_flag then tot_tohit := tot_tohit + (py.misc.lev div 4); X X `7B Adjust weapons for class `7D X`09if ((py.misc.pclass = 2) and (equipment`5BEquipment_primary`5D.tval in`20 X`09`09`09`5Bsword,hafted_weapon,maul,pole_arm`5D)) then X`09`09tot_tohit := tot_tohit - 5 X`09else if (py.misc.pclass = 1) then X`09`09 tot_tohit := tot_tohit + 1 + (py.misc.lev div 2) X`09else if ((py.misc.pclass = 3) and (equipment`5BEquipment_primary`5D.tval X `09`09`09in `5Bsword,hafted_weapon,dagger,pole_arm`5D)) then X`09`09tot_tohit := tot_tohit - 4 X`09else if ((py.misc.pclass = 7) and (equipment`5BEquipment_primary`5D.tval V in +-+-+-+-+-+-+-+- END OF PART 18 +-+-+-+-+-+-+-+-