-+-+-+-+-+-+-+-+ START OF PART 12 -+-+-+-+-+-+-+-+ X sitem.cost := sitem.cost + 5000*r5 X END; X 22 : BEGIN `20 X add_p1_rods(36,24,12,indx,r5); X sitem.cost := sitem.cost + 5000*r5 X END; X 23 : BEGIN `20 X add_p1_rods(12,8,4,indx,r5); X sitem.cost := sitem.cost + 5000*r5 X END; X 24 : BEGIN `20 X add_p1_rods(16,10,6,indx,r5); X sitem.cost := sitem.cost + 5000*r5 X END; X otherwise ; `20 X END; X otherwise ; X END; X scost := -sitem.cost; X insert_num(sitem.name,'%P1',sitem.p1,true); X insert_num(sitem.name,'%P2',sitem.tohit,true); X insert_num(sitem.name,'%P3',sitem.todam,true); X insert_num(sitem.name,'%P4',sitem.toac,true); X insert_num(sitem.name,'%P5',sitem.p1,false); X insert_num(sitem.name,'%P6',sitem.ac,false); X END; XEND; `20 X X`5Bpsect(store$code)`5D procedure store_carry( store_num : integer; X var ipos : integer); forward; X X`7BAdd Black Market items to the inventory`7D X`5Bpsect(store$code)`5D Xprocedure do_black_market; Xvar X indx,iptr,inven_num : integer; XBEGIN X inven_num := 0; X store`5B7`5D.store_ctr := 0; X while (inven_num < store_inven_max) do X inven_num := 5 + randint(store_inven_max); X if (inven_num > store_inven_max) then inven_num := store_inven_max; X for indx := 1 to inven_num do X with store`5B7`5D.store_inven`5Bindx`5D do X BEGIN X iptr := randint(blk_mkt_max); `20 X sitem := blk_mkt_init`5Biptr`5D; X soup_up_black_market(indx); X inventory`5Binven_max`5D := sitem; X store_carry(7,iptr); X END; X for indx := inven_num to store_inven_max do X with store`5B7`5D.store_inven`5Bindx`5D do X sitem := blank_treasure; X store`5B7`5D.store_ctr := store`5B7`5D.store_ctr - 1; XEND; X `20 Xprocedure Opusii_vomit(percentage:integer); XBEGIN Xif (randint(100) < percentage) then X with py.flags do X BEGIN X food := food - 500; X paralysis := 4; X msg_print('You feel your insides heave!'); X END XEND; $ CALL UNPACK [.SOURCE.INCLUDE]BLACK_MARKET.INC;1 1714219935 $ create 'f' Xconst X`7BNote to the Wizard: X Tweaking these constants can *GREATLY* change the game. X Two years of constant tuning have generated these values. X Minor adjustments are encouraged, but you must be very X careful not to unbalance the game. Moria was meant to be X challenging, not a give away. Many adjustments can cause X cause the game to act strangely, or even cause errors. X`20 XCurrent version number of Moria `7D X cur_version = 5.0; X`20 X`7B QIOW constants, see $IODEF in STARLET.MLB `7D X IO$_WRITEVBLK = %B'0000000000110000'; `7B 48D, 0030H `7D X IO$_TTYREADALL= %B'0000000000111010'; `7B 58D, 003AH `7D X IO$M_NOECHO = %B'0000000001000000'; `7B 64D, 0040H `7D X IO$M_NOWAIT = %B'0000000010000000'; `7B 128D, 0080H `7D X IO$M_PURGE = %B'0000100000000000'; `7B2048D, 0800H `7D X IO$MOR_OUTPUT = IO$_WRITEVBLK; X IO$MOR_INPUT = IO$_TTYREADALL + IO$M_NOECHO; X IO$MOR_DELAY = IO$MOR_INPUT + IO$M_NOWAIT; X IO$MOR_IPURGE = IO$MOR_DELAY + IO$M_PURGE; X`20 X`7B IO bug exists at high baud rates (baud >= 9600). This bug X is believed to be in the device driver. It can be avoided by X hibernating the process a small amount of time before perform- X ing a QIOW read operation. `7D X IO$MOR_IOPAUSE= 5; `7B x/100 secs of sleep before inkey X`20 X ENCRYPTION CONSTANTS `20 X NOTE: These numbers were pulled from the air, and can be `20 X changed. If changed, characters produced from other `20 X versions will fail to restore.`7D X X X encrypt_seed1 = 342342; X encrypt_seed2 = 342944081; X`20 X`7B DUNGEON SIZE PARAMETERS `7D X max_height = 66; `7B Multiple of 11; >= 22 `7D X max_width = 198; `7B Multiple of 33; >= 66 `7D X screen_height = 22; X screen_width = 66; X`20 X`7B OUTPUT DUNGEON SECTION SIZES `7D X outpage_height= 44;`7B 44 lines of dungeon/section `7D X outpage_width = 99;`7B 100 columns of dungeon/section `7D X`20 X`7B DUNGEON GENERATION VALUES X NOTE: The entire design of dungeon can be changed by only X slight adjustments here. `7D X dun_tun_rnd = 36; `7B Rand dir (4 is min) `7D X dun_tun_chg = 70; `7B Chance of changing dir (99 max) `7D X dun_tun_fnd = 12; `7B Distance for auto find to kick in `7D X dun_tun_con = 15; `7B Chance of extra tunneling `7D X dun_roo_mea = 32; `7B Mean of # of rooms, std dev=2 `7D X dun_tun_pen = 25; `7B % chance of room doors `7D X dun_tun_jct = 15; `7B % chance of doors at tunnel junctons `7D X dun_str_den = 5; `7B Density of streamers `7D X dun_str_rng = 2; `7B Width of streamers `7D X dun_str_mag = 3; `7B # of magma streamers `7D X dun_str_mc = 95; `7B 1/x chance of treasure/magma `7D X dun_str_qua = 2; `7B # of quartz streamers `7D X dun_str_qc = 55; `7B 1/x chance of treasure/quartz `7D X dun_unusual = 300;`7B Level/x chance of unusual room `7D X `20 X`7B STORE CONSTANTS `7D X max_owners = 21; `7B # of owners to choose from `7D X max_stores = 7; `7B # of different stores `7D X store_inven_max = 24;`7B Max # of discrete objs in inven `7D X store$choices = 26; `7B # of items to choose stock from `7D X store$max_inven = 20;`7B Max diff objs in stock before auto sell`7D X store$min_inven = 14;`7B Min diff objs in stock before auto buy`7D X store$turn_around = 3;`7B Amt of buying and selling normally `7D X bmstore$turn_around = 20;`7B Amt of buying and selling normally `7D X inven_init_max = 106;`7B Size of store init array `7D X blk_mkt_max = 176;`7B Size of black mkt store array `7D X cost_adj = 1.00; `7B Adjust prices for buying and selling `7D X`20 X`7B TREASURE CONSTANTS `7D X inven_max = 35; `7B Size of inventory array(DO NOT CHANGE)`7D X max_obj_level = 50; `7B Max level of magic in dungeon `7D X obj_great = 14; `7B 1/n Chance of item being a Great Item `7D X max_objects = 351; `7B # of objects for universe `7D X max_gold = 18; `7B # of different types of gold `7D X max_talloc = 225; `7B Max objects/level `7D X treas_room_alloc = 8;`7B Amt of objects for rooms `7D X treas_any_alloc = 2;`7B Amt of objects for corridors `7D X treas_gold_alloc = 2;`7B Amt of gold (and gems) `7D X`20 X`7B MAGIC TREASURE GENERATION CONSTANTS X NOTE: Number of special objects, and degree of enchantments X can be adjusted here. `7D X obj_std_adj = 1.25; `7B Adjust STD/level `7D X obj_std_min = 7; `7B Minimum STD `7D X obj_town_level = 5; `7B Town object generation level `7D X obj_base_magic = 20;`7B Base amt of magic `7D X obj_base_max = 70; `7B Max amt of magic `7D X obj_div_special = 7;`7B magic_chance/# = special magic `7D X obj_div_cursed = 1.3;`7B magic_chance/# = cursed items `7D X`20 X`7B CONSTANTS DESCRIBING LIMITS OF CERTAIN OBJECTS `7D X obj$lamp_max = 15000; `7B Max amt that lamp can be filled`7D X obj$bolt_range = 18; `7B Max range of bolts and balls `7D X`20 X`7B CREATURE CONTANTS `7D X`7B max_creatures = 278; `7B # of creatures defined for univ `7D X max_malloc = 100 + 1;`7B Max that can be allocated `7D X max_malloc_chance = 170; `7B 1/x chance of new monster each round `7 VD X max_mons_level = 40; `7B Max level of creatures `7D X max_sight = 20; `7B Max dist a creature can be seen `7D X max_spell_dis = 20; `7B Max dist creat. spell can be cast `7D X max_mon_mult = 80; `7B Max reproductions on a level `7D X mon_mult_adj = 7; `7B High value slows multiplication `7D X mon_nasty = 50; `7B Dun_level/x chance of high level creature `7D X min_malloc_level = 20; `7B Min # of monsters/level `7D X min_malloc_td = 4; `7B # of people on town level (day) `7D X min_malloc_tn = 8; `7B # of people on town level (night)`7D X win_mon_tot = 1; `7B Total number of "win" creatures `7D X win_mon_appear = 70; `7B Level where winning creatures begin `7D X mon$summon_adj = 2; `7B Adjust level of summoned creatures `7D X mon$drain_life = 2; `7B % of player exp drained/hit `7D X`20 X`7B TRAP CONSTANTS `7D X max_trapa = 19; `7B # of defined traps `7D X max_trapb = 20; `7B Includes secret doors `7D X`20 X`7B DESCRIPTIVE CONSTANTS `7D X max_colors = 67; `7B Used with potions `7D X max_mush = 29; `7B Used with mushrooms `7D X max_woods = 41; `7B Used with staves `7D X max_metals = 31; `7B Used with wands `7D X max_rocks = 52; `7B Used with rings `7D X max_amulets = 39;`7B Used with amulets `7D X max_syllables = 153; `7B Used with scrolls `7D X`20 X`7B PLAYER CONSTANTS `7D X max_player_level = 46; `7B Max possible char level `7D X max_races = 8; `7B # of defined races `7D X max_class = 8; `7B # of defined classes `7D X use_device = 3;`7B x> Harder devices x< Easier devices `7D X max_background = 128; `7B # of types of histories for univ `7D X player_food_full = 7500;`7B Getting full `7D X player_food_max = 12500;`7B Max food value, beyond is wasted `7D X player_food_faint = 180; `7B Char begins fainting `7D X player_food_weak = 650; `7B Warn player that he is getting very low` V7D X player_food_alert = 1100; `7B Warn player that he is getting low `7D X player$regen_faint = 0.002; `7B Regen factor fainting `7D X player$regen_weak = 0.004; `7B Regen factor weak `7D X player$regen_normal = 0.006; `7B Regen factor full `7D X player$regen_hpbase = 0.025; `7B Min amt hp regen `7D X player$regen_mnbase = 0.075; `7B Min amt mana regen `7D X player_weight_cap = 130; `7B 100*(1/10 pounds)/strength pt `7D X player_exit_pause = 5; `7B Pause time before player can re-roll `7D X`20 X`7B BASE TO HIT CONSTANTS `7D X bth_lev_adj = 3; `7B Adjust BTH/level `7D X bth_plus_adj = 3; `7B Adjust BTH/plus-to-hit `7D X bth_hit = 12; `7B Automatic hit; 1/bth_hit `7D X`20 X`7B MISC `7D X null = chr(0); X `20 $ CALL UNPACK [.SOURCE.INCLUDE]CONSTANTS.INC;1 1984443335 $ create 'f' X`5Bpsect(create$code)`5D procedure create_character; X`20 X`20 X`7B Generates character's stats `7D X function get_stat : integer; X var X i,j : integer; X begin X i := randint(4) + randint(4) + randint(3) + 6; X get_stat := i X end; X`20 X`20 X`7B Changes stats by given amount `7D X function change_stat(cur_stat,amount : integer) : integer; X var X i : integer; X begin X if (amount < 0) then X for i := -1 downto amount do X cur_stat := de_statp(cur_stat) X else X for i := 1 to amount do X cur_stat := in_statp(cur_stat); X change_stat := cur_stat; X end; X X`7BGet stats - mwk`7D Xfunction roll_stats(i2:integer):boolean; Xbegin X roll_stats:=true; X with py do X with race`5Bi2`5D do X begin X with stat do X BEGIN X str := get_stat; X int := get_stat; X wis := get_stat; X dex := get_stat; X con := get_stat; X chr := get_stat; X str := change_stat(stat.str,str_adj); X int := change_stat(stat.int,int_adj); X wis := change_stat(stat.wis,wis_adj); X dex := change_stat(stat.dex,dex_adj); X con := change_stat(stat.con,con_adj); X chr := change_stat(stat.chr,chr_adj); X cstr := stat.str; X cint := stat.int; X cwis := stat.wis; X cdex := stat.dex; X ccon := stat.con; X cchr := stat.chr; X srh := srh; X END; X with misc do X BEGIN X bth := bth; X bthb := bthb; X fos := fos; X stl := stl; X save := bsav; X hitdie := bhitdie; X lev := 1; X ptodam := todam_adj; X ptohit := tohit_adj; X ptoac := 0; X pac := toac_adj; X expfact:= b_exp; X END; X flags.see_infra := infra X end Xend;`7Broll_stats`7D X`20 X `20 X`7B Allows player to select a race `7D X function choose_race : boolean; X var X i2,i3,i4,i5 : integer; X s : char; X exit_flag : boolean; X begin X i2 := 1; X i3 := 1; X i4 := 3; X i5 := 22; X clear(21,1); X prt('Choose a race (? for Help):',21,3); X repeat X put_buffer (chr(i3+96)+') '+race`5Bi2`5D.trace,i5,i4); X i3 := i3 + 1; X i4 := i4 + 15; X if (i4 > 70) then X begin X i4 := 3; X i5 := i5 + 1 X end; X i2 := i2 + 1 X until (i2 > max_races); X py.misc.race := ''; X put_buffer('',21,30); X exit_flag := false; X repeat X inkey_flush(s); X i2 := index('abcdefghijklmnopqrstuvwxyz',s); X if ((i2 <= max_races) and (i2 >= 1)) then X with py do X with race`5Bi2`5D do X begin X misc.prace := i2; X misc.race := trace; X roll_stats(i2); X exit_flag := true; X choose_race := true; X put_buffer(py.misc.race,4,11); X end X else if (s = '?') then X begin +-+-+-+-+-+-+-+- END OF PART 12 +-+-+-+-+-+-+-+-