-+-+-+-+-+-+-+-+ START OF PART 50 -+-+-+-+-+-+-+-+ X /* Add this back later if the correct throwing device. -CJS- */ X if (inventory`5BINVEN_WIELD`5D.tval != TV_NOTHING) X *tpth -= inventory`5BINVEN_WIELD`5D.tohit; X X *tdis = (((py.stats.use_stat`5BA_STR`5D+20)*10)/tmp_weight); X if (*tdis > 10) *tdis = 10; X X /* multiply damage bonuses instead of adding, when have proper X missile/weapon combo, this makes them much more useful */ X X /* Using Bows, slings, or crossbows`09*/ X if (inventory`5BINVEN_WIELD`5D.tval == TV_BOW) X switch(inventory`5BINVEN_WIELD`5D.p1) X `7B X case 1: X`09if (i_ptr->tval == TV_SLING_AMMO) /* Sling and ammo */ X`09 `7B X`09 *tbth = py.misc.bthb; X`09 *tpth += 2 * inventory`5BINVEN_WIELD`5D.tohit; X`09 *tdam += inventory`5BINVEN_WIELD`5D.todam; X`09 *tdam = *tdam * 2; X`09 *tdis = 20; X`09 `7D X`09break; X case 2: X`09if (i_ptr->tval == TV_ARROW) /* Short Bow and Arrow`09*/ X`09 `7B X`09 *tbth = py.misc.bthb; X`09 *tpth += 2 * inventory`5BINVEN_WIELD`5D.tohit; X`09 *tdam += inventory`5BINVEN_WIELD`5D.todam; X`09 *tdam = *tdam * 2; X`09 *tdis = 25; X`09 `7D X`09break; X case 3: X`09if (i_ptr->tval == TV_ARROW) /* Long Bow and Arrow`09*/ X`09 `7B X`09 *tbth = py.misc.bthb; X`09 *tpth += 2 * inventory`5BINVEN_WIELD`5D.tohit; X`09 *tdam += inventory`5BINVEN_WIELD`5D.todam; X`09 *tdam = *tdam * 3; X`09 *tdis = 30; X`09 `7D X`09break; X case 4: X`09if (i_ptr->tval == TV_ARROW) /* Composite Bow and Arrow*/ X`09 `7B X`09 *tbth = py.misc.bthb; X`09 *tpth += 2 * inventory`5BINVEN_WIELD`5D.tohit; X`09 *tdam += inventory`5BINVEN_WIELD`5D.todam; X`09 *tdam = *tdam * 4; X`09 *tdis = 35; X`09 `7D X`09break; X case 5: X`09if (i_ptr->tval == TV_BOLT) /* Light Crossbow and Bolt*/ X`09 `7B X`09 *tbth = py.misc.bthb; X`09 *tpth += 2 * inventory`5BINVEN_WIELD`5D.tohit; X`09 *tdam += inventory`5BINVEN_WIELD`5D.todam; X`09 *tdam = *tdam * 3; X`09 *tdis = 25; X`09 `7D X`09break; X case 6: X`09if (i_ptr->tval == TV_BOLT) /* Heavy Crossbow and Bolt*/ X`09 `7B X`09 *tbth = py.misc.bthb; X`09 *tpth += 2 * inventory`5BINVEN_WIELD`5D.tohit; X`09 *tdam += inventory`5BINVEN_WIELD`5D.todam; X`09 *tdam = *tdam * 4; X`09 *tdis = 35; X`09 `7D X`09break; X `7D X`7D X X Xstatic void drop_throw(y, x, t_ptr) Xint y, x; Xinven_type *t_ptr; X`7B X register int i, j, k; X int flag, cur_pos; X bigvtype out_val, tmp_str; X register cave_type *c_ptr; X X flag = FALSE; X i = y; X j = x; X k = 0; X if (randint(10) > 1) X `7B X do X`09`7B X`09 if (in_bounds(i, j)) X`09 `7B X`09 c_ptr = &cave`5Bi`5D`5Bj`5D; X`09 if (c_ptr->fval <= MAX_OPEN_SPACE && c_ptr->tptr == 0) X`09`09flag = TRUE; X`09 `7D X`09 if (!flag) X`09 `7B X`09 i = y + randint(3) - 2; X`09 j = x + randint(3) - 2; X`09 k++; X`09 `7D X`09`7D X while ((!flag) && (k <= 9)); X `7D X if (flag) X `7B X cur_pos = popt(); X cave`5Bi`5D`5Bj`5D.tptr = cur_pos; X t_list`5Bcur_pos`5D = *t_ptr; X lite_spot(i, j); X `7D X else X `7B X objdes(tmp_str, t_ptr, FALSE); X (void) sprintf(out_val, "The %s disappears.", tmp_str); X msg_print(out_val); X `7D X`7D X X/* Throw an object across the dungeon.`09`09-RAK-`09*/ X/* Note: Flasks of oil do fire damage`09`09`09`09 */ X/* Note: Extra damage and chance of hitting when missiles are used*/ X/*`09 with correct weapon. I.E. wield bow and throw arrow.`09 */ Xvoid throw_object() X`7B X int item_val, tbth, tpth, tdam, tdis; X int y, x, oldy, oldx, cur_dis, dir; X int flag, visible; X bigvtype out_val, tmp_str; X inven_type throw_obj; X register cave_type *c_ptr; X register monster_type *m_ptr; X register int i; X char tchar; X X if (inven_ctr == 0) X `7B X msg_print("But you are not carrying anything."); X free_turn_flag = TRUE; X `7D X else if (get_item(&item_val, "Fire/Throw which one?", 0, inven_ctr-1, CNIL V, X`09`09 CNIL)) X `7B X if (get_dir(CNIL, &dir)) X`09`7B X`09 desc_remain(item_val); X`09 if (py.flags.confused > 0) X`09 `7B X`09 msg_print("You are confused."); X`09 do X`09`09`7B X`09`09 dir = randint(9); X`09`09`7D X`09 while (dir == 5); X`09 `7D X`09 inven_throw(item_val, &throw_obj); X`09 facts(&throw_obj, &tbth, &tpth, &tdam, &tdis); X`09 tchar = throw_obj.tchar; X`09 flag = FALSE; X`09 y = char_row; X`09 x = char_col; X`09 oldy = char_row; X`09 oldx = char_col; X`09 cur_dis = 0; X`09 do X`09 `7B X`09 (void) mmove(dir, &y, &x); X`09 cur_dis++; X`09 lite_spot(oldy, oldx); X`09 if (cur_dis > tdis) flag = TRUE; X`09 c_ptr = &cave`5By`5D`5Bx`5D; X`09 if ((c_ptr->fval <= MAX_OPEN_SPACE) && (!flag)) X`09`09`7B X`09`09 if (c_ptr->cptr > 1) X`09`09 `7B X`09`09 flag = TRUE; X`09`09 m_ptr = &m_list`5Bc_ptr->cptr`5D; X`09`09 tbth = tbth - cur_dis; X`09`09 /* if monster not lit, make it much more difficult to X`09`09`09 hit, subtract off most bonuses, and reduce bthb X`09`09`09 depending on distance */ X`09`09 if (!m_ptr->ml) X`09`09`09tbth = (tbth / (cur_dis+2)) X`09`09`09 - (py.misc.lev * X`09`09`09 class_level_adj`5Bpy.misc.pclass`5D`5BCLA_BTHB`5D / 2) X`09`09`09 - (tpth * (BTH_PLUS_ADJ-1)); X`09`09 if (test_hit(tbth, (int)py.misc.lev, tpth, X`09`09`09`09 (int)c_list`5Bm_ptr->mptr`5D.ac, CLA_BTHB)) X`09`09`09`7B X`09`09`09 i = m_ptr->mptr; X`09`09`09 objdes(tmp_str, &throw_obj, FALSE); X`09`09`09 /* Does the player know what he's fighting?`09 */ X`09`09`09 if (!m_ptr->ml) X`09`09`09 `7B X`09`09`09 (void) sprintf(out_val, X`09`09`09 "You hear a cry as the %s finds a mark.", tmp_str); X`09`09`09 visible = FALSE; X`09`09`09 `7D X`09`09`09 else X`09`09`09 `7B X`09`09`09 (void) sprintf(out_val, "The %s hits the %s.", X`09`09`09`09`09 tmp_str, c_list`5Bi`5D.name); X`09`09`09 visible = TRUE; X`09`09`09 `7D X`09`09`09 msg_print(out_val); X`09`09`09 tdam = tot_dam(&throw_obj, tdam, i); X`09`09`09 tdam = critical_blow((int)throw_obj.weight, X`09`09`09`09`09 tpth, tdam, CLA_BTHB); X`09`09`09 if (tdam < 0) tdam = 0; X`09`09`09 i = mon_take_hit((int)c_ptr->cptr, tdam); X`09`09`09 if (i >= 0) X`09`09`09 `7B X`09`09`09 if (!visible) X`09`09`09`09msg_print("You have killed something!"); X`09`09`09 else X`09`09`09`09`7B X`09`09`09 (void) sprintf(out_val,"You have killed the %s.", X`09`09`09`09`09`09 c_list`5Bi`5D.name); X`09`09`09`09 msg_print(out_val); X`09`09`09`09`7D X`09`09`09 prt_experience(); X`09`09`09 `7D X`09`09`09`7D X`09`09 else X`09`09`09drop_throw(oldy, oldx, &throw_obj); X`09`09 `7D X`09`09 else X`09`09 `7B`09/* do not test c_ptr->fm here */ X`09`09 if (panel_contains(y, x) && (py.flags.blind < 1) X`09`09`09 && (c_ptr->tl `7C`7C c_ptr->pl)) X`09`09`09`7B X`09`09`09 print(tchar, y, x); X`09`09`09 put_qio(); /* show object moving */ X`09`09`09`7D X`09`09 `7D X`09`09`7D X`09 else X`09`09`7B X`09`09 flag = TRUE; X`09`09 drop_throw(oldy, oldx, &throw_obj); X`09`09`7D X`09 oldy = y; X`09 oldx = x; X`09 `7D X`09 while (!flag); X`09`7D X `7D X`7D X X X/* Make a bash attack on someone.`09`09`09`09-CJS- X Used to be part of bash above. */ Xstatic void py_bash(y, x) Xint y, x; X`7B X int monster, k, avg_max_hp, base_tohit; X register creature_type *c_ptr; X register monster_type *m_ptr; X vtype m_name, out_val; X X monster = cave`5By`5D`5Bx`5D.cptr; X m_ptr = &m_list`5Bmonster`5D; X c_ptr = &c_list`5Bm_ptr->mptr`5D; X m_ptr->csleep = 0; X /* Does the player know what he's fighting?`09 */ X if (!m_ptr->ml) X (void) strcpy(m_name, "it"); X else X (void) sprintf(m_name, "the %s", c_ptr->name); X base_tohit = py.stats.use_stat`5BA_STR`5D + inventory`5BINVEN_ARM`5D.weigh Vt/2 X + py.misc.wt/10; X if (!m_ptr->ml) X base_tohit = (base_tohit / 2) X - (py.stats.use_stat`5BA_DEX`5D*(BTH_PLUS_ADJ-1)) X`09- (py.misc.lev * class_level_adj`5Bpy.misc.pclass`5D`5BCLA_BTH`5D / 2); X X if (test_hit(base_tohit, (int)py.misc.lev, X`09 (int)py.stats.use_stat`5BA_DEX`5D, (int)c_ptr->ac, CLA_BTH)) X `7B X (void) sprintf(out_val, "You hit %s.", m_name); X msg_print(out_val); X k = pdamroll(inventory`5BINVEN_ARM`5D.damage); X k = critical_blow((int)(inventory`5BINVEN_ARM`5D.weight / 4 X`09`09`09 + py.stats.use_stat`5BA_STR`5D), 0, k, CLA_BTH); X k += py.misc.wt/60 + 3; X if (k < 0) k = 0; X X /* See if we done it in.`09`09`09`09 */ X if (mon_take_hit(monster, k) >= 0) X`09`7B X`09 (void) sprintf(out_val, "You have slain %s.", m_name); X`09 msg_print(out_val); X`09 prt_experience(); X`09`7D X else X`09`7B X`09 m_name`5B0`5D = toupper((int)m_name`5B0`5D); /* Capitalize */ X`09 /* Can not stun Balrog */ X`09 avg_max_hp = (c_ptr->cdefense & CD_MAX_HP ? X`09`09`09c_ptr->hd`5B0`5D * c_ptr->hd`5B1`5D : X`09`09`09(c_ptr->hd`5B0`5D * (c_ptr->hd`5B1`5D + 1)) >> 1); X`09 if ((100 + randint(400) + randint(400)) X`09 > (m_ptr->hp + avg_max_hp)) X`09 `7B X`09 m_ptr->stunned += randint(3) + 1; X`09 if (m_ptr->stunned > 24)`09m_ptr->stunned = 24; X`09 (void) sprintf(out_val, "%s appears stunned!", m_name); X`09 `7D X`09 else X`09 (void) sprintf(out_val, "%s ignores your bash!", m_name); X`09 msg_print(out_val); X`09`7D X `7D X else X `7B X (void) sprintf(out_val, "You miss %s.", m_name); X msg_print(out_val); X `7D X if (randint(150) > py.stats.use_stat`5BA_DEX`5D) X `7B X msg_print("You are off balance."); X py.flags.paralysis = 1 + randint(2); X `7D X`7D X X X/* Bash open a door or chest`09`09`09`09-RAK-`09*/ X/* Note: Affected by strength and weight of character X X For a closed door, p1 is positive if locked; negative if X stuck. A disarm spell unlocks and unjams doors! X X For an open door, p1 is positive for a broken door. X X A closed door can be opened - harder if locked. Any door might X be bashed open (and thereby broken). Bashing a door is X (potentially) faster! You move into the door way. To open a X stuck door, it must be bashed. A closed door can be jammed X (which makes it stuck if previously locked). X X Creatures can also open doors. A creature with open door X ability will (if not in the line of sight) move though a X closed or secret door with no changes. If in the line of X sight, closed door are openned, & secret door revealed. X Whether in the line of sight or not, such a creature may X unlock or unstick a door. X X A creature with no such ability will attempt to bash a X non-secret door. */ Xvoid bash() X`7B X int y, x, dir, tmp; X register cave_type *c_ptr; X register inven_type *t_ptr; X X y = char_row; X x = char_col; X if (get_dir(CNIL, &dir)) X `7B X if (py.flags.confused > 0) X`09`7B X`09 msg_print("You are confused."); X`09 do X`09 `7B X`09 dir = randint(9); X`09 `7D X`09 while (dir == 5); X`09`7D X (void) mmove(dir, &y, &x); X c_ptr = &cave`5By`5D`5Bx`5D; X if (c_ptr->cptr > 1) X`09`7B X`09 if (py.flags.afraid > 0) X`09 msg_print("You are afraid!"); X`09 else X`09 py_bash(y, x); X`09`7D X else if (c_ptr->tptr != 0) X`09`7B X`09 t_ptr = &t_list`5Bc_ptr->tptr`5D; X`09 if (t_ptr->tval == TV_CLOSED_DOOR) X`09 `7B X`09 count_msg_print("You smash into the door!"); X`09 tmp = py.stats.use_stat`5BA_STR`5D + py.misc.wt / 2; X`09 /* Use (roughly) similar method as for monsters. */ X`09 if (randint(tmp*(20+abs(t_ptr->p1))) < 10*(tmp-abs(t_ptr->p1))) X`09`09`7B X`09`09 msg_print("The door crashes open!"); X`09`09 invcopy(&t_list`5Bc_ptr->tptr`5D, OBJ_OPEN_DOOR); X`09`09 t_ptr->p1 = 1 - randint(2); /* 50% chance of breaking door */ X`09`09 c_ptr->fval = CORR_FLOOR; X`09`09 if (py.flags.confused == 0) X`09`09 move_char(dir, FALSE); X`09`09 else X`09`09 lite_spot(y, x); X`09`09`7D X`09 else if (randint(150) > py.stats.use_stat`5BA_DEX`5D) X`09`09`7B X`09`09 msg_print("You are off-balance."); X`09`09 py.flags.paralysis = 1 + randint(2); X`09`09`7D X`09 else if (command_count == 0) X`09`09msg_print("The door holds firm."); X`09 `7D X`09 else if (t_ptr->tval == TV_CHEST) X`09 `7B X`09 if (randint(10) == 1) X`09`09`7B X`09`09 msg_print("You have destroyed the chest."); X`09`09 msg_print("and its contents!"); X`09`09 t_ptr->index = OBJ_RUINED_CHEST; X`09`09 t_ptr->flags = 0; X`09`09`7D X`09 else if ((CH_LOCKED & t_ptr->flags) && (randint(10) == 1)) X`09`09`7B X`09`09 msg_print("The lock breaks open!"); X`09`09 t_ptr->flags &= `7ECH_LOCKED; X`09`09`7D X`09 else X`09`09count_msg_print("The chest holds firm."); X`09 `7D X`09 else`20 X`09 /* Can't give free turn, or else player could try directions X`09 until he found invisible creature */ X`09 msg_print("You bash it, but nothing interesting happens."); X`09`7D X else X`09`7B X`09 if (c_ptr->fval < MIN_CAVE_WALL) X`09 msg_print("You bash at empty space."); X`09 else X`09 /* same message for wall as for secret door */ X`09 msg_print("You bash it, but nothing interesting happens."); X`09`7D X `7D X`7D $ CALL UNPACK MORIA4.C;1 773275357 $ create 'f' X ********************* X ** Umoria 5.5 ** X ********************* X Copyright (c) 1985 Robert Alan Koeneke X Copyright (c) 1989-92 James E. Wilson X XProgrammers : Robert Alan Koeneke / University of Oklahoma X Jimmey Wayne Todd / University of Oklahoma XUNIX Port : James E. Wilson / Cygnus Support XVersion 5.5 : David J. Grabiner / Harvard University X XPlease send bug reports to grabiner@math.harvard.edu or to the USENET Xnewsgroup rec.games.moria. X XPlease read the file doc/FEATURES.NEW. In particular, note the new commands X'G' for learning spells, and '=' for setting options. Also, to attack Xinvisible creatures in walls, you must tunnel. $ CALL UNPACK NEWS.;1 1215788260 $ create 'f' +-+-+-+-+-+-+-+- END OF PART 50 +-+-+-+-+-+-+-+-