-+-+-+-+-+-+-+-+ START OF PART 62 -+-+-+-+-+-+-+-+ X ident = TRUE; X identify(&item_val); X i_ptr = &inventory`5Bitem_val`5D; X known2(i_ptr); X objdes(tmp_str, i_ptr, TRUE); X if (item_val >= INVEN_WIELD) X`09`7B X`09 calc_bonuses(); X`09 (void) sprintf (out_val, "%s: %s", describe_use(item_val), tmp_str); X`09`7D X else X`09(void) sprintf(out_val, "%c %s", item_val+97, tmp_str); X msg_print(out_val); X `7D X return(ident); X`7D X X X/* Get all the monsters on the level pissed off.`09-RAK-`09*/ Xint aggravate_monster (dis_affect) Xint dis_affect; X`7B X register int i, aggravate; X register monster_type *m_ptr; X X aggravate = FALSE; X for (i = mfptr - 1; i >= MIN_MONIX; i--) X `7B X m_ptr = &m_list`5Bi`5D; X m_ptr->csleep = 0; X if ((m_ptr->cdis <= dis_affect) && (m_ptr->cspeed < 2)) X`09`7B X`09 m_ptr->cspeed++; X`09 aggravate = TRUE; X`09`7D X `7D X if (aggravate) X msg_print ("You hear a sudden stirring in the distance!"); X return(aggravate); X`7D X X X/* Surround the fool with traps (chuckle)`09`09-RAK-`09*/ Xint trap_creation() X`7B X register int i, j, trap; X register cave_type *c_ptr; X X trap = TRUE; X for (i = char_row-1; i <= char_row+1; i++) X for (j = char_col-1; j <= char_col+1; j++) X `7B X`09/* Don't put a trap under the player, since this can lead to X`09 strange situations, e.g. falling through a trap door while X`09 trying to rest, setting off a falling rock trap and ending X`09 up under the rock. */ X`09if (i == char_row && j == char_col) X`09 continue; X`09c_ptr = &cave`5Bi`5D`5Bj`5D; X`09if (c_ptr->fval <= MAX_CAVE_FLOOR) X`09 `7B X`09 if (c_ptr->tptr != 0) X`09 (void) delete_object(i, j); X`09 place_trap(i, j, randint(MAX_TRAP)-1); X`09 /* don't let player gain exp from the newly created traps */ X`09 t_list`5Bc_ptr->tptr`5D.p1 = 0; X`09 /* open pits are immediately visible, so call lite_spot */ X`09 lite_spot(i, j); X`09 `7D X `7D X return(trap); X`7D X X X/* Surround the player with doors.`09`09`09-RAK-`09*/ Xint door_creation() X`7B X register int i, j, door; X int k; X register cave_type *c_ptr; X X door = FALSE; X for (i = char_row-1; i <= char_row+1; i++) X for (j = char_col-1; j <= char_col+1; j++) X if ((i != char_row) `7C`7C (j != char_col)) X`09`7B X`09 c_ptr = &cave`5Bi`5D`5Bj`5D; X`09 if (c_ptr->fval <= MAX_CAVE_FLOOR) X`09 `7B X`09 door = TRUE; X`09 if (c_ptr->tptr != 0) X`09`09(void) delete_object(i, j); X`09 k = popt(); X`09 c_ptr->fval = BLOCKED_FLOOR; X`09 c_ptr->tptr = k; X`09 invcopy(&t_list`5Bk`5D, OBJ_CLOSED_DOOR); X`09 lite_spot(i, j); X`09 `7D X`09`7D X return(door); X`7D X X X/* Destroys any adjacent door(s)/trap(s)`09`09-RAK-`09*/ Xint td_destroy() X`7B X register int i, j, destroy; X register cave_type *c_ptr; X X destroy = FALSE; X for (i = char_row-1; i <= char_row+1; i++) X for (j = char_col-1; j <= char_col+1; j++) X `7B X`09c_ptr = &cave`5Bi`5D`5Bj`5D; X`09if (c_ptr->tptr != 0) X`09 `7B X`09 if (((t_list`5Bc_ptr->tptr`5D.tval >= TV_INVIS_TRAP) && X`09`09 (t_list`5Bc_ptr->tptr`5D.tval <= TV_CLOSED_DOOR) && X`09`09 (t_list`5Bc_ptr->tptr`5D.tval != TV_RUBBLE)) `7C`7C X`09`09(t_list`5Bc_ptr->tptr`5D.tval == TV_SECRET_DOOR)) X`09 `7B X`09`09if (delete_object(i, j)) X`09`09 destroy = TRUE; X`09 `7D X`09 else if (t_list`5Bc_ptr->tptr`5D.tval == TV_CHEST) X`09 `7B X`09`09/* destroy traps on chest and unlock */ X`09`09t_list`5Bc_ptr->tptr`5D.flags &= `7E(CH_TRAPPED`7CCH_LOCKED); X`09`09t_list`5Bc_ptr->tptr`5D.name2 = SN_UNLOCKED; X`09`09msg_print ("You have disarmed the chest."); X`09`09known2(&t_list`5Bc_ptr->tptr`5D); X`09`09destroy = TRUE; X`09 `7D X`09 `7D X `7D X return(destroy); X`7D X X X/* Display all creatures on the current panel`09`09-RAK-`09*/ Xint detect_monsters() X`7B X register int i, detect; X register monster_type *m_ptr; X#ifdef ATARIST_MWC X int32u holder; X#endif X X detect = FALSE; X for (i = mfptr - 1; i >= MIN_MONIX; i--) X `7B X m_ptr = &m_list`5Bi`5D; X if (panel_contains((int)m_ptr->fy, (int)m_ptr->fx) && X#ifdef ATARIST_MWC X`09 (((holder = CM_INVISIBLE) & c_list`5Bm_ptr->mptr`5D.cmove) == 0)) X#else X`09 ((CM_INVISIBLE & c_list`5Bm_ptr->mptr`5D.cmove) == 0)) X#endif X`09`7B X`09 m_ptr->ml = TRUE; X`09 /* works correctly even if hallucinating */ X`09 print((char)c_list`5Bm_ptr->mptr`5D.cchar, (int)m_ptr->fy, X`09`09(int)m_ptr->fx); X`09 detect = TRUE; X`09`7D X `7D X if (detect) X `7B X msg_print("You sense the presence of monsters!"); X msg_print(CNIL); X /* must unlight every monster just lighted */ X creatures(FALSE); X `7D X return(detect); X`7D X X X/* Leave a line of light in given dir, blue light can sometimes`09*/ X/* hurt creatures.`09`09`09`09 -RAK- */ Xvoid light_line(dir, y, x) Xint dir, y, x; X`7B X register int i; X register cave_type *c_ptr; X register monster_type *m_ptr; X register creature_type *r_ptr; X int dist, flag; X vtype out_val, m_name; X X dist = -1; X flag = FALSE; X do X `7B X /* put mmove at end because want to light up current spot */ X dist++; X c_ptr = &cave`5By`5D`5Bx`5D; X if ((dist > OBJ_BOLT_RANGE) `7C`7C c_ptr->fval >= MIN_CLOSED_SPACE) X`09flag = TRUE; X else X`09`7B X`09 if (!c_ptr->pl && !c_ptr->tl) X`09 `7B X`09 /* set pl so that lite_spot will work */ X`09 c_ptr->pl = TRUE; X`09 if (c_ptr->fval == LIGHT_FLOOR) X`09`09`7B X`09`09 if (panel_contains(y, x)) X`09`09 light_room(y, x); X`09`09`7D X`09 else X`09`09lite_spot(y, x); X`09 `7D X`09 /* set pl in case tl was true above */ X`09 c_ptr->pl = TRUE; X`09 if (c_ptr->cptr > 1) X`09 `7B X`09 m_ptr = &m_list`5Bc_ptr->cptr`5D; X`09 r_ptr = &c_list`5Bm_ptr->mptr`5D; X`09 /* light up and draw monster */ X`09 update_mon ((int)c_ptr->cptr); X`09 monster_name (m_name, m_ptr, r_ptr); X`09 if (CD_LIGHT & r_ptr->cdefense) X`09`09`7B X`09`09 if (m_ptr->ml) X`09`09 c_recall`5Bm_ptr->mptr`5D.r_cdefense `7C= CD_LIGHT; X`09`09 i = mon_take_hit((int)c_ptr->cptr, damroll(2, 8)); X`09`09 if (i >= 0) X`09`09 `7B X`09`09 (void) sprintf(out_val, X`09`09`09 "%s shrivels away in the light!", m_name); X`09`09 msg_print(out_val); X`09`09 prt_experience(); X`09`09 `7D X`09`09 else X`09`09 `7B X`09`09 (void) sprintf(out_val, "%s cringes from the light!", X`09`09`09`09 m_name); X`09`09 msg_print (out_val); X`09`09 `7D X`09`09`7D X`09 `7D X`09`7D X (void) mmove(dir, &y, &x); X `7D X while (!flag); X`7D X X X/* Light line in all directions`09`09`09`09-RAK-`09*/ Xvoid starlite(y, x) Xregister int y, x; X`7B X register int i; X X if (py.flags.blind < 1) X msg_print("The end of the staff bursts into a blue shimmering light."); X for (i = 1; i <= 9; i++) X if (i != 5) X light_line(i, y, x); X`7D X X X/* Disarms all traps/chests in a given direction`09-RAK-`09*/ Xint disarm_all(dir, y, x) Xint dir, y, x; X`7B X register cave_type *c_ptr; X register inven_type *t_ptr; X register int disarm, dist; X X disarm = FALSE; X dist = -1; X do X `7B X /* put mmove at end, in case standing on a trap */ X dist++; X c_ptr = &cave`5By`5D`5Bx`5D; X /* note, must continue upto and including the first non open space, X`09 because secret doors have fval greater than MAX_OPEN_SPACE */ X 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_INVIS_TRAP) `7C`7C (t_ptr->tval == TV_VIS_TRAP)) X`09 `7B X`09 if (delete_object(y, x)) X`09`09disarm = TRUE; X`09 `7D X`09 else if (t_ptr->tval == TV_CLOSED_DOOR) X`09 t_ptr->p1 = 0; /* Locked or jammed doors become merely closed. */ X`09 else if (t_ptr->tval == TV_SECRET_DOOR) X`09 `7B X`09 c_ptr->fm = TRUE; X`09 change_trap(y, x); X`09 disarm = TRUE; X`09 `7D X`09 else if ((t_ptr->tval == TV_CHEST) && (t_ptr->flags != 0)) X`09 `7B X`09 msg_print("Click!"); X`09 t_ptr->flags &= `7E(CH_TRAPPED`7CCH_LOCKED); X`09 disarm = TRUE; X`09 t_ptr->name2 = SN_UNLOCKED; X`09 known2(t_ptr); X`09 `7D X`09`7D X (void) mmove(dir, &y, &x); X `7D X while ((dist <= OBJ_BOLT_RANGE) && c_ptr->fval <= MAX_OPEN_SPACE); X return(disarm); X`7D X X X/* Return flags for given type area affect`09`09-RAK-`09*/ Xvoid get_flags(typ, weapon_type, harm_type, destroy) Xint typ; Xint32u *weapon_type; int *harm_type; Xint (**destroy)(); X`7B X switch(typ) X `7B X case GF_MAGIC_MISSILE: X *weapon_type = 0; X *harm_type = 0; X *destroy`09 = set_null; X break; X case GF_LIGHTNING: X *weapon_type = CS_BR_LIGHT; X *harm_type = CD_LIGHT; X *destroy`09 = set_lightning_destroy; X break; X case GF_POISON_GAS: X *weapon_type = CS_BR_GAS; X *harm_type = CD_POISON; X *destroy`09 = set_null; X break; X case GF_ACID: X *weapon_type = CS_BR_ACID; X *harm_type = CD_ACID; X *destroy`09 = set_acid_destroy; X break; X case GF_FROST: X *weapon_type = CS_BR_FROST; X *harm_type = CD_FROST; X *destroy`09 = set_frost_destroy; X break; X case GF_FIRE: X *weapon_type = CS_BR_FIRE; X *harm_type = CD_FIRE; X *destroy`09 = set_fire_destroy; X break; X case GF_HOLY_ORB: X *weapon_type = 0; X *harm_type = CD_EVIL; X *destroy`09 = set_null; X break; X default: X msg_print("ERROR in get_flags()\n"); X `7D X`7D X X X/* Shoot a bolt in a given direction`09`09`09-RAK-`09*/ Xvoid fire_bolt(typ, dir, y, x, dam, bolt_typ) Xint typ, dir, y, x, dam; Xchar *bolt_typ; X`7B X int i, oldy, oldx, dist, flag; X int32u weapon_type; int harm_type; X int (*dummy)(); X register cave_type *c_ptr; X register monster_type *m_ptr; X register creature_type *r_ptr; X vtype out_val, m_name; X X flag = FALSE; X get_flags(typ, &weapon_type, &harm_type, &dummy); X oldy = y; X oldx = x; X dist = 0; X do X `7B X (void) mmove(dir, &y, &x); X dist++; X c_ptr = &cave`5By`5D`5Bx`5D; X lite_spot(oldy, oldx); X if ((dist > OBJ_BOLT_RANGE) `7C`7C c_ptr->fval >= MIN_CLOSED_SPACE) X`09flag = TRUE; X else X`09`7B X`09 if (c_ptr->cptr > 1) X`09 `7B X`09 flag = TRUE; X`09 m_ptr = &m_list`5Bc_ptr->cptr`5D; X`09 r_ptr = &c_list`5Bm_ptr->mptr`5D; X X`09 /* light up monster and draw monster, temporarily set X`09`09 pl so that update_mon() will work */ X`09 i = c_ptr->pl; X`09 c_ptr->pl = TRUE; X`09 update_mon ((int)c_ptr->cptr); X`09 c_ptr->pl = i; X`09 /* draw monster and clear previous bolt */ X`09 put_qio(); X X`09 lower_monster_name(m_name, m_ptr, r_ptr); X`09 (void) sprintf(out_val, "The %s strikes %s.", bolt_typ, m_name); X`09 msg_print(out_val); X`09 if (harm_type & r_ptr->cdefense) X`09`09`7B X`09`09 dam = dam*2; X`09`09 if (m_ptr->ml) X`09`09 c_recall`5Bm_ptr->mptr`5D.r_cdefense `7C= harm_type; X`09`09`7D X`09 else if (weapon_type & r_ptr->spells) X`09`09`7B X`09`09 dam = dam / 4; X`09`09 if (m_ptr->ml) X`09`09 c_recall`5Bm_ptr->mptr`5D.r_spells `7C= weapon_type; X`09`09`7D X`09 monster_name(m_name, m_ptr, r_ptr); X`09 i = mon_take_hit((int)c_ptr->cptr, dam); X`09 if (i >= 0) X`09`09`7B X`09`09 (void) sprintf(out_val, "%s dies in a fit of agony.", X`09`09`09`09 m_name); X`09`09 msg_print(out_val); X`09`09 prt_experience(); X`09`09`7D X`09 else if (dam > 0) X`09`09`7B X`09`09 (void) sprintf (out_val, "%s screams in agony.", m_name); X`09`09 msg_print (out_val); X`09`09`7D X`09 `7D X`09 else if (panel_contains(y, x) && (py.flags.blind < 1)) X`09 `7B X`09 print('*', y, x); X`09 /* show the bolt */ X`09 put_qio(); X`09 `7D X`09`7D X oldy = y; X oldx = x; X `7D X while (!flag); X`7D X X X/* Shoot a ball in a given direction. Note that balls have an`09*/ X/* area affect.`09`09`09`09`09 -RAK- */ Xvoid fire_ball(typ, dir, y, x, dam_hp, descrip) Xint typ, dir, y, x, dam_hp; Xchar *descrip; X`7B X register int i, j; X int dam, max_dis, thit, tkill, k, tmp; X int oldy, oldx, dist, flag, harm_type; X int32u weapon_type; X int (*destroy)(); X register cave_type *c_ptr; X register monster_type *m_ptr; X register creature_type *r_ptr; X vtype out_val; X X thit`09 = 0; X tkill`09 = 0; X max_dis = 2; X get_flags(typ, &weapon_type, &harm_type, &destroy); X flag = FALSE; X oldy = y; X oldx = x; X dist = 0; X do X `7B X (void) mmove(dir, &y, &x); X dist++; X lite_spot(oldy, oldx); X if (dist > OBJ_BOLT_RANGE) X`09flag = TRUE; X else X`09`7B X`09 c_ptr = &cave`5By`5D`5Bx`5D; X`09 if ((c_ptr->fval >= MIN_CLOSED_SPACE) `7C`7C (c_ptr->cptr > 1)) X`09 `7B X`09 flag = TRUE; X`09 if (c_ptr->fval >= MIN_CLOSED_SPACE) X`09`09`7B X`09`09 y = oldy; X`09`09 x = oldx; X`09`09`7D X`09 /* The ball hits and explodes.`09`09 */ X`09 /* The explosion.`09`09`09 */ X`09 for (i = y-max_dis; i <= y+max_dis; i++) X`09`09for (j = x-max_dis; j <= x+max_dis; j++) X`09`09 if (in_bounds(i, j) && (distance(y, x, i, j) <= max_dis) X`09`09 && los(y, x, i, j)) X`09`09 `7B X`09`09 c_ptr = &cave`5Bi`5D`5Bj`5D; X`09`09 if ((c_ptr->tptr != 0) && X`09`09`09 (*destroy)(&t_list`5Bc_ptr->tptr`5D)) X`09`09`09(void) delete_object(i, j); X`09`09 if (c_ptr->fval <= MAX_OPEN_SPACE) X`09`09`09`7B X`09`09`09 if (c_ptr->cptr > 1) X`09`09`09 `7B X`09`09`09 m_ptr = &m_list`5Bc_ptr->cptr`5D; X`09`09`09 r_ptr = &c_list`5Bm_ptr->mptr`5D; X X`09`09`09 /* lite up creature if visible, temp X`09`09`09`09 set pl so that update_mon works */ X`09`09`09 tmp = c_ptr->pl; X`09`09`09 c_ptr->pl = TRUE; X`09`09`09 update_mon((int)c_ptr->cptr); X X`09`09`09 thit++; X`09`09`09 dam = dam_hp; X`09`09`09 if (harm_type & r_ptr->cdefense) X`09`09`09`09`7B X`09`09`09`09 dam = dam*2; +-+-+-+-+-+-+-+- END OF PART 62 +-+-+-+-+-+-+-+-