Lines Matching refs:p_ptr

20 void do_cmd_go_up(player_type *p_ptr)  in do_cmd_go_up()  argument
22 int Depth = p_ptr->dun_depth; in do_cmd_go_up()
27 if (p_ptr->new_level_flag) in do_cmd_go_up()
31 __trap(p_ptr, CPI(p_ptr, '<')); in do_cmd_go_up()
34 c_ptr = &cave[Depth][p_ptr->py][p_ptr->px]; in do_cmd_go_up()
37 if (!p_ptr->ghost && c_ptr->feat != FEAT_LESS) in do_cmd_go_up()
39 msg_print(p_ptr, "I see no up staircase here."); in do_cmd_go_up()
44 if (p_ptr->dun_depth <= 0) in do_cmd_go_up()
46 msg_print(p_ptr, "There is nothing above you."); in do_cmd_go_up()
56 if(!is_dm_p(p_ptr)) in do_cmd_go_up()
58 msg_print(p_ptr, "Morgoth awaits you in the darkness below."); in do_cmd_go_up()
67 everyone_lite_spot(Depth, p_ptr->py, p_ptr->px); in do_cmd_go_up()
70 update_player(p_ptr); in do_cmd_go_up()
73 forget_lite(p_ptr); in do_cmd_go_up()
74 forget_view(p_ptr); in do_cmd_go_up()
77 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_go_up()
82 msg_print(p_ptr, "You enter a maze of up staircases."); in do_cmd_go_up()
83 sound(p_ptr, MSG_STAIRS_UP); in do_cmd_go_up()
84 p_ptr->new_level_method = LEVEL_UP; in do_cmd_go_up()
88 msg_print(p_ptr, "You float upwards."); in do_cmd_go_up()
89 p_ptr->new_level_method = LEVEL_GHOST; in do_cmd_go_up()
93 players_on_depth[p_ptr->dun_depth]--; in do_cmd_go_up()
96 p_ptr->dun_depth--; in do_cmd_go_up()
99 players_on_depth[p_ptr->dun_depth]++; in do_cmd_go_up()
101 p_ptr->new_level_flag = TRUE; in do_cmd_go_up()
111 void do_cmd_go_down(player_type *p_ptr) in do_cmd_go_down() argument
113 int Depth = p_ptr->dun_depth; in do_cmd_go_down()
118 if (p_ptr->new_level_flag) in do_cmd_go_down()
122 __trap(p_ptr, CPI(p_ptr, '>')); in do_cmd_go_down()
125 c_ptr = &cave[Depth][p_ptr->py][p_ptr->px]; in do_cmd_go_down()
128 if (!p_ptr->ghost && c_ptr->feat != FEAT_MORE) in do_cmd_go_down()
130 msg_print(p_ptr, "I see no down staircase here."); in do_cmd_go_down()
136 if (p_ptr->ghost && !cfg_ghost_diving && !is_dm_p(p_ptr)) { in do_cmd_go_down()
137 msg_print(p_ptr, "You seem unable to go down. Try going up."); in do_cmd_go_down()
142 if (is_quest_level(p_ptr, p_ptr->dun_depth) in do_cmd_go_down()
148 msg_print(p_ptr, "An unvanquished adversary pulls you back, you can descend no further."); in do_cmd_go_down()
153 if (p_ptr->dun_depth < 0) in do_cmd_go_down()
155 msg_print(p_ptr, "There is nothing below you."); in do_cmd_go_down()
160 if (p_ptr->dun_depth >= 127) in do_cmd_go_down()
162 msg_print(p_ptr, "You are at the bottom of the dungeon."); in do_cmd_go_down()
171 everyone_lite_spot(Depth, p_ptr->py, p_ptr->px); in do_cmd_go_down()
174 update_player(p_ptr); in do_cmd_go_down()
177 forget_lite(p_ptr); in do_cmd_go_down()
178 forget_view(p_ptr); in do_cmd_go_down()
181 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_go_down()
186 msg_print(p_ptr, "You enter a maze of down staircases."); in do_cmd_go_down()
187 sound(p_ptr, MSG_STAIRS_DOWN); in do_cmd_go_down()
188 p_ptr->new_level_method = LEVEL_DOWN; in do_cmd_go_down()
192 msg_print(p_ptr, "You float downwards."); in do_cmd_go_down()
193 p_ptr->new_level_method = LEVEL_GHOST; in do_cmd_go_down()
197 players_on_depth[p_ptr->dun_depth]--; in do_cmd_go_down()
200 p_ptr->dun_depth++; in do_cmd_go_down()
203 players_on_depth[p_ptr->dun_depth]++; in do_cmd_go_down()
205 p_ptr->new_level_flag = TRUE; in do_cmd_go_down()
216 void do_cmd_search(player_type *p_ptr) in do_cmd_search() argument
219 if (p_ptr->command_arg) in do_cmd_search()
225 p_ptr->redraw |= (PR_STATE); in do_cmd_search()
228 p_ptr->command_arg = 0; in do_cmd_search()
232 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_search()
235 search(p_ptr); in do_cmd_search()
242 void do_cmd_toggle_search(player_type *p_ptr) in do_cmd_toggle_search() argument
245 if (p_ptr->searching) in do_cmd_toggle_search()
248 p_ptr->searching = FALSE; in do_cmd_toggle_search()
251 p_ptr->update |= (PU_BONUS); in do_cmd_toggle_search()
254 p_ptr->redraw |= (PR_STATE); in do_cmd_toggle_search()
261 p_ptr->searching = TRUE; in do_cmd_toggle_search()
264 p_ptr->update |= (PU_BONUS); in do_cmd_toggle_search()
267 p_ptr->redraw |= (PR_STATE | PR_SPEED); in do_cmd_toggle_search()
284 static void chest_death(player_type *p_ptr, int y, int x, object_type *o_ptr) in chest_death() argument
286 int Depth = p_ptr->dun_depth; in chest_death()
369 static void chest_trap(player_type *p_ptr, int y, int x, object_type *o_ptr) in chest_trap() argument
386 msg_print(p_ptr, "A small needle has pricked you!"); in chest_trap()
387 take_hit(p_ptr, damroll(1, 4), "a poison needle"); in chest_trap()
388 (void)do_dec_stat(p_ptr, A_STR); in chest_trap()
394 msg_print(p_ptr, "A small needle has pricked you!"); in chest_trap()
395 take_hit(p_ptr, damroll(1, 4), "a poison needle"); in chest_trap()
396 (void)do_dec_stat(p_ptr, A_CON); in chest_trap()
402 msg_print(p_ptr, "A puff of green gas surrounds you!"); in chest_trap()
403 if (!(p_ptr->resist_pois || p_ptr->oppose_pois)) in chest_trap()
405 (void)set_poisoned(p_ptr, p_ptr->poisoned + 10 + randint1(20)); in chest_trap()
412 msg_print(p_ptr, "A puff of yellow gas surrounds you!"); in chest_trap()
413 if (!p_ptr->free_act) in chest_trap()
415 (void)set_paralyzed(p_ptr, p_ptr->paralyzed + 10 + randint1(20)); in chest_trap()
423 msg_print(p_ptr, "You are enveloped in a cloud of smoke!"); in chest_trap()
424 sound(p_ptr, MSG_SUM_MONSTER); in chest_trap()
427 (void)summon_specific(p_ptr->dun_depth, y, x, p_ptr->dun_depth, 0); in chest_trap()
434 msg_print(p_ptr, "There is a sudden explosion!"); in chest_trap()
435 msg_print(p_ptr, "Everything inside the chest is destroyed!"); in chest_trap()
437 take_hit(p_ptr, damroll(5, 8), "an exploding chest"); in chest_trap()
467 bool house_inside(player_type *p_ptr, int house) in house_inside() argument
471 if (houses[house].depth == p_ptr->dun_depth in house_inside()
472 && p_ptr->px >= houses[house].x_1 && p_ptr->px <= houses[house].x_2 in house_inside()
473 && p_ptr->py >= houses[house].y_1 && p_ptr->py <= houses[house].y_2) in house_inside()
500 bool house_owned_by(player_type *p_ptr, int house) in house_owned_by() argument
506 if (!strcmp(p_ptr->name,houses[house].owned)) in house_owned_by()
516 int houses_owned(player_type *p_ptr) in houses_owned() argument
524 if (house_owned_by(p_ptr, i)) in houses_owned()
560 bool is_valid_foundation(player_type *p_ptr, int x, int y) in is_valid_foundation() argument
567 o_ptr = &o_list[cave[p_ptr->dun_depth][y][x].o_idx]; in is_valid_foundation()
575 c_ptr = &cave[p_ptr->dun_depth][y][x]; in is_valid_foundation()
580 house = find_house(p_ptr->dun_depth, x, y, 0); in is_valid_foundation()
584 if (house_owned_by(p_ptr, house)) in is_valid_foundation()
618 bool create_house_door(player_type *p_ptr, int x, int y) in create_house_door() argument
625 while( (house = find_house(p_ptr->dun_depth,x,y,lastmatch)) > -1 ) in create_house_door()
630 if (!house_owned_by(p_ptr, house)) in create_house_door()
633 msg_print(p_ptr, "You do not own this house"); in create_house_door()
643 c_ptr = &cave[p_ptr->dun_depth][y][x]; in create_house_door()
645 everyone_lite_spot(p_ptr->dun_depth, y, x); in create_house_door()
646 msg_print(p_ptr, "You create a door for your house!"); in create_house_door()
682 bool get_house_foundation(player_type *p_ptr, int *px1, int *py1, int *px2, int *py2) in get_house_foundation() argument
689 plog(format("Player is at x,y %d, %d",p_ptr->px, p_ptr->py)); in get_house_foundation()
692 o_ptr = &o_list[cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px].o_idx]; in get_house_foundation()
695 msg_print(p_ptr, "There is no house foundation here."); in get_house_foundation()
700 x1 = p_ptr->px; in get_house_foundation()
701 x2 = p_ptr->px; in get_house_foundation()
702 y1 = p_ptr->py; in get_house_foundation()
703 y2 = p_ptr->py; in get_house_foundation()
715 if(!is_valid_foundation(p_ptr, x, y1-1)) in get_house_foundation()
728 if(!is_valid_foundation(p_ptr, x2+1, y)) in get_house_foundation()
741 if(!is_valid_foundation(p_ptr, x, y2+1)) in get_house_foundation()
754 if(!is_valid_foundation(p_ptr, x1-1, y)) in get_house_foundation()
763 ne = is_valid_foundation(p_ptr, x2+1, y1-1); in get_house_foundation()
764 nw = is_valid_foundation(p_ptr, x1-1, y1-1); in get_house_foundation()
765 se = is_valid_foundation(p_ptr, x2+1, y2+1); in get_house_foundation()
766 sw = is_valid_foundation(p_ptr, x1-1, y2+1); in get_house_foundation()
791 msg_print(p_ptr, "The foundation is too small."); in get_house_foundation()
807 bool create_house(player_type *p_ptr) in create_house() argument
813 if (p_ptr->dun_depth >= 0 || check_special_level(p_ptr->dun_depth)) in create_house()
815 msg_print(p_ptr, "The surrounding magic is too strong for House Creation."); in create_house()
820 if (!get_house_foundation(p_ptr, &x1, &y1, &x2, &y2)) in create_house()
834 houses[num_houses].depth = p_ptr->dun_depth; in create_house()
837 set_house_owner(p_ptr, num_houses); in create_house()
846 c_ptr = &cave[p_ptr->dun_depth][y][x]; in create_house()
849 delete_object(p_ptr->dun_depth, y, x); in create_house()
858 everyone_lite_spot(p_ptr->dun_depth, y, x); in create_house()
866 c_ptr = &cave[p_ptr->dun_depth][y][x]; in create_house()
869 delete_object(p_ptr->dun_depth, y, x); in create_house()
878 everyone_lite_spot(p_ptr->dun_depth, y, x); in create_house()
887 bool set_house_owner(player_type *p_ptr, int house) in set_house_owner() argument
893 my_strcpy(houses[house].owned, p_ptr->name, MAX_NAME_LEN+1); in set_house_owner()
951 static bool do_cmd_open_chest(player_type *p_ptr, int y, int x, s16b o_idx) in do_cmd_open_chest() argument
969 i = p_ptr->skill_dis; in do_cmd_open_chest()
972 if (p_ptr->blind || no_lite(p_ptr)) i = i / 10; in do_cmd_open_chest()
973 if (p_ptr->confused || p_ptr->image) i = i / 10; in do_cmd_open_chest()
984 msg_print_aux(p_ptr, "You have picked the lock.", MSG_LOCKPICK); in do_cmd_open_chest()
985 sound(p_ptr, MSG_LOCKPICK); in do_cmd_open_chest()
986 gain_exp(p_ptr, 1); in do_cmd_open_chest()
996 msg_print_aux(p_ptr, "You failed to pick the lock.", MSG_LOCKPICK_FAIL); in do_cmd_open_chest()
997 sound(p_ptr, MSG_LOCKPICK_FAIL); in do_cmd_open_chest()
1005 chest_trap(p_ptr, y, x, o_ptr); in do_cmd_open_chest()
1008 chest_death(p_ptr, y, x, o_ptr); in do_cmd_open_chest()
1022 static bool do_cmd_disarm_chest(player_type *p_ptr, int y, int x, s16b o_idx) in do_cmd_disarm_chest() argument
1032 i = p_ptr->skill_dis; in do_cmd_disarm_chest()
1035 if (p_ptr->blind || no_lite(p_ptr)) i = i / 10; in do_cmd_disarm_chest()
1036 if (p_ptr->confused || p_ptr->image) i = i / 10; in do_cmd_disarm_chest()
1045 if (!object_known_p(p_ptr, o_ptr)) in do_cmd_disarm_chest()
1047 msg_print(p_ptr, "I don't see any traps."); in do_cmd_disarm_chest()
1053 msg_print(p_ptr, "The chest is not trapped."); in do_cmd_disarm_chest()
1059 msg_print(p_ptr, "The chest is not trapped."); in do_cmd_disarm_chest()
1065 msg_print_aux(p_ptr, "You have disarmed the chest.", MSG_DISARM); in do_cmd_disarm_chest()
1066 sound(p_ptr, MSG_DISARM); in do_cmd_disarm_chest()
1067 gain_exp(p_ptr, o_ptr->pval); in do_cmd_disarm_chest()
1077 msg_print(p_ptr, "You failed to disarm the chest."); in do_cmd_disarm_chest()
1083 msg_print(p_ptr, "You set off a trap!"); in do_cmd_disarm_chest()
1084 chest_trap(p_ptr, y, x, o_ptr); in do_cmd_disarm_chest()
1103 static bool twall(player_type *p_ptr, int y, int x) in twall() argument
1105 int Depth = p_ptr->dun_depth; in twall()
1111 sound(p_ptr, MSG_DIG); in twall()
1131 static bool do_cmd_open_test(player_type *p_ptr, int y, int x) in do_cmd_open_test() argument
1133 int Depth = p_ptr->dun_depth; in do_cmd_open_test()
1138 if ( (p_ptr->ghost || p_ptr->fruit_bat) && !(p_ptr->dm_flags & DM_GHOST_HANDS) ) in do_cmd_open_test()
1141 msg_print(p_ptr, "You cannot open things!"); in do_cmd_open_test()
1150 if (!(p_ptr->cave_flag[y][x] & (CAVE_MARK))) in do_cmd_open_test()
1153 msg_print(p_ptr, "You see nothing there."); in do_cmd_open_test()
1169 msg_print_aux(p_ptr, "You see nothing there to open.", MSG_NOTHING_TO_OPEN); in do_cmd_open_test()
1170 sound(p_ptr, MSG_NOTHING_TO_OPEN); in do_cmd_open_test()
1188 static bool do_cmd_open_aux(player_type *p_ptr, int y, int x) in do_cmd_open_aux() argument
1190 int Depth = p_ptr->dun_depth; in do_cmd_open_aux()
1200 if (!do_cmd_open_test(p_ptr, y, x)) return (FALSE); in do_cmd_open_aux()
1219 if (house_owned_by(p_ptr, i) || (p_ptr->dm_flags & DM_HOUSE_CONTROL) ) in do_cmd_open_aux()
1227 if (q_ptr && !same_player(p_ptr, q_ptr)) in do_cmd_open_aux()
1249 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS); in do_cmd_open_aux()
1258 disturb(p_ptr, 0, 0); in do_cmd_open_aux()
1262 do_cmd_store(p_ptr, i); in do_cmd_open_aux()
1269 factor = adj_chr_gold[p_ptr->stat_ind[A_CHR]]; in do_cmd_open_aux()
1276 msg_format(p_ptr, "This house costs %ld gold.", price); in do_cmd_open_aux()
1285 create_house_door(p_ptr, x, y); in do_cmd_open_aux()
1292 msg_print(p_ptr, "The door appears to be stuck."); in do_cmd_open_aux()
1299 i = p_ptr->skill_dis; in do_cmd_open_aux()
1302 if (p_ptr->blind || no_lite(p_ptr)) i = i / 10; in do_cmd_open_aux()
1303 if (p_ptr->confused || p_ptr->image) i = i / 10; in do_cmd_open_aux()
1318 msg_print_aux(p_ptr, "You have picked the lock.", MSG_LOCKPICK); in do_cmd_open_aux()
1319 sound(p_ptr, MSG_LOCKPICK); in do_cmd_open_aux()
1325 gain_exp(p_ptr, 1); in do_cmd_open_aux()
1335 msg_print_aux(p_ptr, "You failed to pick the lock.", MSG_LOCKPICK_FAIL); in do_cmd_open_aux()
1336 sound(p_ptr, MSG_LOCKPICK_FAIL); in do_cmd_open_aux()
1357 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS); in do_cmd_open_aux()
1360 sound(p_ptr, MSG_OPENDOOR); in do_cmd_open_aux()
1374 void do_cmd_open(player_type *p_ptr, int dir) in do_cmd_open() argument
1376 int Depth = p_ptr->dun_depth; in do_cmd_open()
1389 if (p_ptr->easy_open) in do_cmd_open()
1402 p_ptr->command_dir = motion_dir(p_ptr->py, p_ptr->px, y, x); in do_cmd_open()
1411 y = p_ptr->py + ddy[dir]; in do_cmd_open()
1412 x = p_ptr->px + ddx[dir]; in do_cmd_open()
1425 if (!o_idx && !do_cmd_open_test(p_ptr, y, x)) return; in do_cmd_open()
1429 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_open()
1432 if (confuse_dir((bool)p_ptr->confused, &dir)) in do_cmd_open()
1435 y = p_ptr->py + ddy[dir]; in do_cmd_open()
1436 x = p_ptr->px + ddx[dir]; in do_cmd_open()
1450 if (p_ptr->command_arg) in do_cmd_open()
1456 p_ptr->redraw |= (PR_STATE); in do_cmd_open()
1459 p_ptr->command_arg = 0; in do_cmd_open()
1466 msg_print(p_ptr, "There is a monster in the way!"); in do_cmd_open()
1469 py_attack(p_ptr, y, x); in do_cmd_open()
1476 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_open()
1479 msg_print(p_ptr, "There is a player in the way!"); in do_cmd_open()
1487 more = do_cmd_open_chest(p_ptr, y, x, o_idx); in do_cmd_open()
1494 more = do_cmd_open_aux(p_ptr, y, x); in do_cmd_open()
1498 if (!more) disturb(p_ptr, 0, 0); in do_cmd_open()
1505 static bool do_cmd_close_test(player_type *p_ptr, int y, int x) in do_cmd_close_test() argument
1507 int Depth = p_ptr->dun_depth; in do_cmd_close_test()
1513 if ( (p_ptr->ghost || p_ptr->fruit_bat) && !(p_ptr->dm_flags & DM_GHOST_HANDS) ) in do_cmd_close_test()
1516 msg_print(p_ptr, "You cannot close things!"); in do_cmd_close_test()
1525 if (!(p_ptr->cave_flag[y][x] & (CAVE_MARK))) in do_cmd_close_test()
1528 msg_print(p_ptr, "You see nothing there."); in do_cmd_close_test()
1540 msg_print(p_ptr, "You see nothing there to close."); in do_cmd_close_test()
1558 static bool do_cmd_close_aux(player_type *p_ptr, int y, int x) in do_cmd_close_aux() argument
1560 int Depth = p_ptr->dun_depth; in do_cmd_close_aux()
1569 if (!do_cmd_close_test(p_ptr, y, x)) return (FALSE); in do_cmd_close_aux()
1580 msg_print(p_ptr, "The door appears to be broken."); in do_cmd_close_aux()
1599 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS); in do_cmd_close_aux()
1615 p_ptr->update |= (PU_VIEW | PU_LITE | PU_MONSTERS); in do_cmd_close_aux()
1618 sound(p_ptr, MSG_SHUTDOOR); in do_cmd_close_aux()
1629 void do_cmd_close(player_type *p_ptr, int dir) in do_cmd_close() argument
1631 int Depth = p_ptr->dun_depth; in do_cmd_close()
1640 __trap(p_ptr, CPI(p_ptr, 'c')); in do_cmd_close()
1644 if (p_ptr->easy_open) in do_cmd_close()
1649 p_ptr->command_dir = motion_dir(p_ptr->py, p_ptr->px, y, x); in do_cmd_close()
1658 y = p_ptr->py + ddy[dir]; in do_cmd_close()
1659 x = p_ptr->px + ddx[dir]; in do_cmd_close()
1662 if (!do_cmd_close_test(p_ptr, y, x)) return; in do_cmd_close()
1665 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_close()
1668 if (confuse_dir((bool)p_ptr->confused, &dir)) in do_cmd_close()
1671 y = p_ptr->py + ddy[dir]; in do_cmd_close()
1672 x = p_ptr->px + ddx[dir]; in do_cmd_close()
1679 if (p_ptr->command_arg) in do_cmd_close()
1685 p_ptr->redraw |= (PR_STATE); in do_cmd_close()
1688 p_ptr->command_arg = 0; in do_cmd_close()
1695 msg_print(p_ptr, "There is a monster in the way!"); in do_cmd_close()
1698 py_attack(p_ptr, y, x); in do_cmd_close()
1705 msg_print(p_ptr, "There is a player in the way!"); in do_cmd_close()
1712 more = do_cmd_close_aux(p_ptr, y, x); in do_cmd_close()
1716 if (!more) disturb(p_ptr, 0, 0); in do_cmd_close()
1723 static bool do_cmd_tunnel_test(player_type *p_ptr, int y, int x) in do_cmd_tunnel_test() argument
1725 int Depth = p_ptr->dun_depth; in do_cmd_tunnel_test()
1731 if ( (p_ptr->ghost || p_ptr->fruit_bat) && !(p_ptr->dm_flags & DM_GHOST_HANDS) ) in do_cmd_tunnel_test()
1734 msg_print(p_ptr, "You cannot tunnel!"); in do_cmd_tunnel_test()
1743 if (!(p_ptr->cave_flag[y][x] & (CAVE_MARK))) in do_cmd_tunnel_test()
1746 msg_print(p_ptr, "You see nothing there."); in do_cmd_tunnel_test()
1756 msg_print(p_ptr, "You see nothing there to tunnel."); in do_cmd_tunnel_test()
1767 msg_print(p_ptr, "You cannot tunnel through house doors."); in do_cmd_tunnel_test()
1777 msg_print(p_ptr, "You see nothing there to tunnel through."); in do_cmd_tunnel_test()
1806 static bool do_cmd_tunnel_aux(player_type *p_ptr, int y, int x) in do_cmd_tunnel_aux() argument
1808 int Depth = p_ptr->dun_depth; in do_cmd_tunnel_aux()
1816 if (!do_cmd_tunnel_test(p_ptr, y, x)) return (FALSE); in do_cmd_tunnel_aux()
1822 sound(p_ptr, MSG_DIG); in do_cmd_tunnel_aux()
1830 if ((p_ptr->skill_dig + wielding_cut_p(p_ptr) * 10 > randint0(400)) && twall(p_ptr, y, x)) in do_cmd_tunnel_aux()
1835 msg_print(p_ptr, "You hack your way through the vegetation."); in do_cmd_tunnel_aux()
1840 msg_print(p_ptr, "You attempt to clear a path."); in do_cmd_tunnel_aux()
1848 if ((p_ptr->skill_dig + wielding_cut_p(p_ptr) * 10 > randint0(600)) && twall(p_ptr, y, x)) in do_cmd_tunnel_aux()
1851 msg_print(p_ptr, "You hack your way through the vegetation."); in do_cmd_tunnel_aux()
1856 msg_print(p_ptr, "You attempt to clear a path."); in do_cmd_tunnel_aux()
1864 msg_print(p_ptr, "This seems to be permanent rock."); in do_cmd_tunnel_aux()
1871 if ((p_ptr->skill_dig > 40 + randint0(1600)) && twall(p_ptr, y, x)) in do_cmd_tunnel_aux()
1873 msg_print(p_ptr, "You have finished the tunnel."); in do_cmd_tunnel_aux()
1880 msg_print(p_ptr, "You tunnel into the granite wall."); in do_cmd_tunnel_aux()
1907 okay = (p_ptr->skill_dig > 20 + randint0(800)); in do_cmd_tunnel_aux()
1913 okay = (p_ptr->skill_dig > 10 + randint0(400)); in do_cmd_tunnel_aux()
1917 if (okay && twall(p_ptr, y, x)) in do_cmd_tunnel_aux()
1926 msg_print(p_ptr, "You have found something!"); in do_cmd_tunnel_aux()
1933 msg_print(p_ptr, "You have finished the tunnel."); in do_cmd_tunnel_aux()
1941 msg_print(p_ptr, "You tunnel into the quartz vein."); in do_cmd_tunnel_aux()
1949 msg_print(p_ptr, "You tunnel into the magma vein."); in do_cmd_tunnel_aux()
1958 if ((p_ptr->skill_dig > randint0(200)) && twall(p_ptr, y, x)) in do_cmd_tunnel_aux()
1961 msg_print(p_ptr, "You have removed the rubble."); in do_cmd_tunnel_aux()
1970 if (player_can_see_bold(p_ptr, y, x)) in do_cmd_tunnel_aux()
1972 msg_print(p_ptr, "You have found something!"); in do_cmd_tunnel_aux()
1980 msg_print(p_ptr, "You dig in the rubble."); in do_cmd_tunnel_aux()
1989 if ((p_ptr->skill_dig > 30 + randint0(1200)) && twall(p_ptr, y, x)) in do_cmd_tunnel_aux()
1991 msg_print(p_ptr, "You have finished the tunnel."); in do_cmd_tunnel_aux()
1998 msg_print(p_ptr, "You tunnel into the granite wall."); in do_cmd_tunnel_aux()
2002 if (randint0(100) < 25) search(p_ptr); in do_cmd_tunnel_aux()
2010 if ((p_ptr->skill_dig > 30 + randint0(1200)) && twall(p_ptr, y, x)) in do_cmd_tunnel_aux()
2012 msg_print(p_ptr, "You have finished the tunnel."); in do_cmd_tunnel_aux()
2019 msg_print(p_ptr, "You tunnel into the door."); in do_cmd_tunnel_aux()
2035 void do_cmd_tunnel(player_type *p_ptr, int dir) in do_cmd_tunnel() argument
2037 int Depth = p_ptr->dun_depth; in do_cmd_tunnel()
2046 __trap(p_ptr, CPI(p_ptr, 'T')); in do_cmd_tunnel()
2053 y = p_ptr->py + ddy[dir]; in do_cmd_tunnel()
2054 x = p_ptr->px + ddx[dir]; in do_cmd_tunnel()
2057 if (!do_cmd_tunnel_test(p_ptr, y, x)) return; in do_cmd_tunnel()
2060 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_tunnel()
2063 if (confuse_dir((bool)p_ptr->confused, &dir)) in do_cmd_tunnel()
2066 y = p_ptr->py + ddy[dir]; in do_cmd_tunnel()
2067 x = p_ptr->px + ddx[dir]; in do_cmd_tunnel()
2074 if (p_ptr->command_arg) in do_cmd_tunnel()
2080 p_ptr->redraw |= (PR_STATE); in do_cmd_tunnel()
2083 p_ptr->command_arg = 0; in do_cmd_tunnel()
2090 msg_print(p_ptr, "There is a monster in the way!"); in do_cmd_tunnel()
2093 py_attack(p_ptr, y, x); in do_cmd_tunnel()
2100 msg_print(p_ptr, "There is a player in the way!"); in do_cmd_tunnel()
2107 more = do_cmd_tunnel_aux(p_ptr, y, x); in do_cmd_tunnel()
2111 if (!more) disturb(p_ptr, 0, 0); in do_cmd_tunnel()
2118 static bool do_cmd_disarm_test(player_type *p_ptr, int y, int x) in do_cmd_disarm_test() argument
2120 int Depth = p_ptr->dun_depth; in do_cmd_disarm_test()
2127 if ( (p_ptr->ghost || p_ptr->fruit_bat) && !(p_ptr->dm_flags & DM_GHOST_HANDS) ) in do_cmd_disarm_test()
2130 msg_print(p_ptr, "You cannot disarm things!"); in do_cmd_disarm_test()
2142 if (!(p_ptr->cave_flag[y][x] & (CAVE_MARK))) in do_cmd_disarm_test()
2145 msg_print(p_ptr, "You see nothing there."); in do_cmd_disarm_test()
2156 msg_print(p_ptr, "You see nothing there to disarm."); in do_cmd_disarm_test()
2174 static bool do_cmd_disarm_aux(player_type *p_ptr, int y, int x, int dir) in do_cmd_disarm_aux() argument
2176 int Depth = p_ptr->dun_depth; in do_cmd_disarm_aux()
2188 if (!do_cmd_disarm_test(p_ptr, y, x)) return (FALSE); in do_cmd_disarm_aux()
2197 i = p_ptr->skill_dis; in do_cmd_disarm_aux()
2200 if (p_ptr->blind || no_lite(p_ptr)) i = i / 10; in do_cmd_disarm_aux()
2201 if (p_ptr->confused || p_ptr->image) i = i / 10; in do_cmd_disarm_aux()
2218 msg_format_type(p_ptr, MSG_DISARM, "You have disarmed the %s.", name); in do_cmd_disarm_aux()
2219 sound(p_ptr, MSG_DISARM); in do_cmd_disarm_aux()
2222 gain_exp(p_ptr, power); in do_cmd_disarm_aux()
2238 move_player(p_ptr, dir, FALSE); in do_cmd_disarm_aux()
2249 msg_format(p_ptr, "You failed to disarm the %s.", name); in do_cmd_disarm_aux()
2259 msg_format(p_ptr, "You set off the %s!", name); in do_cmd_disarm_aux()
2264 move_player(p_ptr, dir, FALSE); in do_cmd_disarm_aux()
2275 void do_cmd_disarm(player_type *p_ptr, int dir) in do_cmd_disarm() argument
2277 int Depth = p_ptr->dun_depth; in do_cmd_disarm()
2289 __trap(p_ptr, CPI(p_ptr, 'D')); in do_cmd_disarm()
2293 if (p_ptr->easy_open) in do_cmd_disarm()
2307 p_ptr->command_dir = motion_dir(p_ptr->py, p_ptr->px, y, x); in do_cmd_disarm()
2317 y = p_ptr->py + ddy[dir]; in do_cmd_disarm()
2318 x = p_ptr->px + ddx[dir]; in do_cmd_disarm()
2331 if (!o_idx && !do_cmd_disarm_test(p_ptr, y, x)) return; in do_cmd_disarm()
2335 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_disarm()
2338 if (confuse_dir((bool)p_ptr->confused, &dir)) in do_cmd_disarm()
2341 y = p_ptr->py + ddy[dir]; in do_cmd_disarm()
2342 x = p_ptr->px + ddx[dir]; in do_cmd_disarm()
2356 if (p_ptr->command_arg) in do_cmd_disarm()
2362 p_ptr->redraw |= (PR_STATE); in do_cmd_disarm()
2365 p_ptr->command_arg = 0; in do_cmd_disarm()
2372 msg_print(p_ptr, "There is a monster in the way!"); in do_cmd_disarm()
2375 py_attack(p_ptr, y, x); in do_cmd_disarm()
2382 msg_print(p_ptr, "There is a player in the way!"); in do_cmd_disarm()
2389 more = do_cmd_disarm_chest(p_ptr, y, x, o_idx); in do_cmd_disarm()
2396 more = do_cmd_disarm_aux(p_ptr, y, x, dir); in do_cmd_disarm()
2400 if (!more) disturb(p_ptr, 0, 0); in do_cmd_disarm()
2406 static bool do_cmd_bash_test(player_type *p_ptr, int y, int x) in do_cmd_bash_test() argument
2408 int Depth = p_ptr->dun_depth; in do_cmd_bash_test()
2414 if ( (p_ptr->ghost || p_ptr->fruit_bat) && !(p_ptr->dm_flags & DM_GHOST_HANDS) ) in do_cmd_bash_test()
2417 msg_print(p_ptr, "You cannot bash things!"); in do_cmd_bash_test()
2426 if (!(p_ptr->cave_flag[y][x] & (CAVE_MARK))) in do_cmd_bash_test()
2429 msg_print(p_ptr, "You see nothing there."); in do_cmd_bash_test()
2440 msg_print(p_ptr, "You see nothing there to bash."); in do_cmd_bash_test()
2458 static bool do_cmd_bash_aux(player_type *p_ptr, int y, int x) in do_cmd_bash_aux() argument
2460 int Depth = p_ptr->dun_depth; in do_cmd_bash_aux()
2470 if (!do_cmd_bash_test(p_ptr, y, x)) return (FALSE); in do_cmd_bash_aux()
2476 msg_print(p_ptr, "You smash into the door!"); in do_cmd_bash_aux()
2480 bash = adj_str_blow[p_ptr->stat_ind[A_STR]]; in do_cmd_bash_aux()
2495 msg_print_aux(p_ptr, "The door crashes open!", MSG_OPENDOOR); in do_cmd_bash_aux()
2496 sound(p_ptr, MSG_OPENDOOR); in do_cmd_bash_aux()
2517 move_player(p_ptr, dir, FALSE); in do_cmd_bash_aux()
2520 p_ptr->update |= (PU_VIEW | PU_LITE); in do_cmd_bash_aux()
2521 p_ptr->update |= (PU_DISTANCE); in do_cmd_bash_aux()
2525 else if (randint0(100) < adj_dex_safe[p_ptr->stat_ind[A_DEX]] + in do_cmd_bash_aux()
2526 p_ptr->lev) in do_cmd_bash_aux()
2529 msg_print(p_ptr, "The door holds firm."); in do_cmd_bash_aux()
2539 msg_print(p_ptr, "You are off-balance."); in do_cmd_bash_aux()
2542 (void)set_paralyzed(p_ptr, p_ptr->paralyzed + 2 + randint0(2)); in do_cmd_bash_aux()
2564 void do_cmd_bash(player_type *p_ptr, int dir) in do_cmd_bash() argument
2566 int Depth = p_ptr->dun_depth; in do_cmd_bash()
2573 __trap(p_ptr, CPI(p_ptr, 'B')); in do_cmd_bash()
2580 y = p_ptr->py + ddy[dir]; in do_cmd_bash()
2581 x = p_ptr->px + ddx[dir]; in do_cmd_bash()
2584 if (!do_cmd_bash_test(p_ptr, y, x)) return; in do_cmd_bash()
2588 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_bash()
2591 if (confuse_dir((bool)p_ptr->confused, &dir)) in do_cmd_bash()
2594 y = p_ptr->py + ddy[dir]; in do_cmd_bash()
2595 x = p_ptr->px + ddx[dir]; in do_cmd_bash()
2602 if (p_ptr->command_arg) in do_cmd_bash()
2608 p_ptr->redraw |= (PR_STATE); in do_cmd_bash()
2611 p_ptr->command_arg = 0; in do_cmd_bash()
2618 msg_print(p_ptr, "There is a monster in the way!"); in do_cmd_bash()
2621 py_attack(p_ptr, y, x); in do_cmd_bash()
2628 msg_print(p_ptr, "There is a player in the way!"); in do_cmd_bash()
2635 if (!do_cmd_bash_aux(p_ptr, y, x)) in do_cmd_bash()
2638 disturb(p_ptr, 0, 0); in do_cmd_bash()
2663 void do_cmd_alter(player_type *p_ptr, int dir) in do_cmd_alter() argument
2665 int Depth = p_ptr->dun_depth; in do_cmd_alter()
2676 __trap(p_ptr, CPI(p_ptr, '+')); in do_cmd_alter()
2682 confuse_dir((bool)p_ptr->confused, &dir); in do_cmd_alter()
2685 y = p_ptr->py + ddy[dir]; in do_cmd_alter()
2686 x = p_ptr->px + ddx[dir]; in do_cmd_alter()
2689 if (p_ptr->master_hook[1]) in do_cmd_alter()
2690 master_new_hook(p_ptr, 'a', y, x); in do_cmd_alter()
2699 if (!(p_ptr->cave_flag[y][x] & (CAVE_MARK))) feat = FEAT_NONE; in do_cmd_alter()
2702 if (p_ptr->command_arg) in do_cmd_alter()
2708 p_ptr->redraw |= (PR_STATE); in do_cmd_alter()
2711 p_ptr->command_arg = 0; in do_cmd_alter()
2718 py_attack(p_ptr, y, x); in do_cmd_alter()
2725 more = do_cmd_open_aux(p_ptr, y, x); in do_cmd_alter()
2732 more = do_cmd_open_aux(p_ptr, y, x); in do_cmd_alter()
2739 more = do_cmd_tunnel_aux(p_ptr, y, x); in do_cmd_alter()
2746 more = do_cmd_bash_aux(p_ptr, y, x); in do_cmd_alter()
2753 more = do_cmd_open_aux(p_ptr, y, x); in do_cmd_alter()
2760 more = do_cmd_disarm_aux(p_ptr, y, x, dir); in do_cmd_alter()
2775 msg_print(p_ptr, "You spin around."); in do_cmd_alter()
2783 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_alter()
2787 if (!more) disturb(p_ptr, 0, 0); in do_cmd_alter()
2797 static bool get_spike(player_type *p_ptr, int *ip) in get_spike() argument
2804 object_type *o_ptr = &(p_ptr->inventory[i]); in get_spike()
2827 void do_cmd_spike(player_type *p_ptr, int dir) in do_cmd_spike() argument
2829 int Depth = p_ptr->dun_depth; in do_cmd_spike()
2836 __trap(p_ptr, CPI(p_ptr, 'j')); in do_cmd_spike()
2839 if ( (p_ptr->ghost || p_ptr->fruit_bat) && !(p_ptr->dm_flags & DM_GHOST_HANDS) ) in do_cmd_spike()
2842 msg_print(p_ptr, "You cannot spike doors!"); in do_cmd_spike()
2851 y = p_ptr->py + ddy[dir]; in do_cmd_spike()
2852 x = p_ptr->px + ddx[dir]; in do_cmd_spike()
2862 msg_print(p_ptr, "You see nothing there to spike."); in do_cmd_spike()
2866 else if (!get_spike(p_ptr, &item)) in do_cmd_spike()
2869 msg_print(p_ptr, "You have no spikes!"); in do_cmd_spike()
2876 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_spike()
2879 msg_print(p_ptr, "There is a monster in the way!"); in do_cmd_spike()
2882 py_attack(p_ptr, y, x); in do_cmd_spike()
2889 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_spike()
2892 msg_print(p_ptr, "You jam the door with a spike."); in do_cmd_spike()
2901 inven_item_increase(p_ptr, item, -1); in do_cmd_spike()
2902 inven_item_describe(p_ptr, item); in do_cmd_spike()
2903 inven_item_optimize(p_ptr, item); in do_cmd_spike()
2915 void do_cmd_mouseclick(player_type *p_ptr, int mod, int y, int x) in do_cmd_mouseclick() argument
2920 y = y + p_ptr->panel_row_min; in do_cmd_mouseclick()
2921 x = x + p_ptr->panel_col_min; in do_cmd_mouseclick()
2923 if (x < p_ptr->panel_col_min) x = p_ptr->panel_col_min; in do_cmd_mouseclick()
2924 if (y < p_ptr->panel_row_min) y = p_ptr->panel_row_min; in do_cmd_mouseclick()
2925 if (x > p_ptr->panel_col_max) x = p_ptr->panel_col_max; in do_cmd_mouseclick()
2926 if (y > p_ptr->panel_row_max) y = p_ptr->panel_row_max; in do_cmd_mouseclick()
2932 if (p_ptr->px == x && p_ptr->py == y) in do_cmd_mouseclick()
2934 do_cmd_enterfeat(p_ptr); in do_cmd_mouseclick()
2943 if (ABS(p_ptr->px - x) <= 1 && ABS(p_ptr->py - y) <= 1) in do_cmd_mouseclick()
2945 int dir = motion_dir(p_ptr->py, p_ptr->px, y, x); in do_cmd_mouseclick()
2946 do_cmd_alter(p_ptr, dir); in do_cmd_mouseclick()
2951 do_cmd_pathfind(p_ptr, y, x); in do_cmd_mouseclick()
2958 void do_cmd_walk(player_type *p_ptr, int dir, int pickup) in do_cmd_walk() argument
2965 __trap(p_ptr, CPI(p_ptr, ';')); in do_cmd_walk()
2968 if (p_ptr->new_level_flag) return; in do_cmd_walk()
2971 if (p_ptr->command_arg) in do_cmd_walk()
2977 p_ptr->redraw |= (PR_STATE); in do_cmd_walk()
2980 p_ptr->command_arg = 0; in do_cmd_walk()
2987 if (p_ptr->confused) in do_cmd_walk()
2997 if (option_p(p_ptr,EASY_ALTER)) in do_cmd_walk()
3000 c_ptr = &cave[p_ptr->dun_depth][p_ptr->py+ddy[dir]][p_ptr->px+ddx[dir]]; in do_cmd_walk()
3002 if ((p_ptr->cave_flag[p_ptr->py+ddy[dir]][p_ptr->px+ddx[dir]] & (CAVE_MARK)) && in do_cmd_walk()
3008 do_cmd_alter(p_ptr, dir); in do_cmd_walk()
3015 if (option_p(p_ptr,BUMP_OPEN)) in do_cmd_walk()
3018 c_ptr = &cave[p_ptr->dun_depth][p_ptr->py+ddy[dir]][p_ptr->px+ddx[dir]]; in do_cmd_walk()
3020 if ((p_ptr->cave_flag[p_ptr->py+ddy[dir]][p_ptr->px+ddx[dir]] & (CAVE_MARK)) && in do_cmd_walk()
3026 do_cmd_alter(p_ptr, dir); in do_cmd_walk()
3032 move_player(p_ptr, dir, pickup); in do_cmd_walk()
3036 if (!p_ptr->dealt_blows) { in do_cmd_walk()
3039 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_walk()
3048 if (!more) disturb(p_ptr, 0, 0); in do_cmd_walk()
3056 int do_cmd_run(player_type *p_ptr, int dir) in do_cmd_run() argument
3061 if (CPI(p_ptr, '.')) { msg_print(p_ptr, "The item's inscription prevents it."); return 0; } in do_cmd_run()
3066 if (p_ptr->confused) in do_cmd_run()
3069 if (p_ptr->dun_depth) in do_cmd_run()
3071 do_cmd_walk(p_ptr, dir, option_p(p_ptr, ALWAYS_PICKUP)); in do_cmd_run()
3076 if (p_ptr->confused) in do_cmd_run()
3078 msg_print(p_ptr, "You are too confused!"); in do_cmd_run()
3083 if (p_ptr->running && (dir == p_ptr->find_current) ) return 1; in do_cmd_run()
3089 if (see_wall(p_ptr, dir, p_ptr->py, p_ptr->px) && p_ptr->energy >= level_speed(p_ptr->dun_depth)) in do_cmd_run()
3092 if (option_p(p_ptr,EASY_ALTER)) in do_cmd_run()
3095 c_ptr = &cave[p_ptr->dun_depth][p_ptr->py+ddy[dir]][p_ptr->px+ddx[dir]]; in do_cmd_run()
3097 if ((p_ptr->cave_flag[p_ptr->py+ddy[dir]][p_ptr->px+ddx[dir]] & (CAVE_MARK)) && in do_cmd_run()
3104 if (p_ptr->energy >= level_speed(p_ptr->dun_depth)) in do_cmd_run()
3107 do_cmd_alter(p_ptr, dir); in do_cmd_run()
3115 if (option_p(p_ptr,BUMP_OPEN)) in do_cmd_run()
3118 c_ptr = &cave[p_ptr->dun_depth][p_ptr->py+ddy[dir]][p_ptr->px+ddx[dir]]; in do_cmd_run()
3120 if ((p_ptr->cave_flag[p_ptr->py+ddy[dir]][p_ptr->px+ddx[dir]] & (CAVE_MARK)) && in do_cmd_run()
3127 if (p_ptr->energy >= level_speed(p_ptr->dun_depth)) in do_cmd_run()
3130 do_cmd_alter(p_ptr, dir); in do_cmd_run()
3137 msg_print(p_ptr, "You cannot run in that direction."); in do_cmd_run()
3140 disturb(p_ptr, 0, 0); in do_cmd_run()
3146 p_ptr->run_request = dir; in do_cmd_run()
3147 p_ptr->running = FALSE; in do_cmd_run()
3148 p_ptr->ran_tiles = 0; in do_cmd_run()
3159 void do_cmd_hold_or_stay(player_type *p_ptr, int pickup, int take_stairs) in do_cmd_hold_or_stay() argument
3161 int Depth = p_ptr->dun_depth; in do_cmd_hold_or_stay()
3164 if (p_ptr->new_level_flag) return; in do_cmd_hold_or_stay()
3166 c_ptr = &cave[Depth][p_ptr->py][p_ptr->px]; in do_cmd_hold_or_stay()
3170 if (p_ptr->command_arg) in do_cmd_hold_or_stay()
3176 p_ptr->redraw |= (PR_STATE); in do_cmd_hold_or_stay()
3179 p_ptr->command_arg = 0; in do_cmd_hold_or_stay()
3186 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_hold_or_stay()
3190 if ((p_ptr->skill_fos >= 50) || (0 == randint0(50 - p_ptr->skill_fos))) in do_cmd_hold_or_stay()
3192 search(p_ptr); in do_cmd_hold_or_stay()
3196 if (p_ptr->searching) in do_cmd_hold_or_stay()
3198 search(p_ptr); in do_cmd_hold_or_stay()
3208 disturb(p_ptr, 0, 0); in do_cmd_hold_or_stay()
3216 carry(p_ptr, pickup, 0); in do_cmd_hold_or_stay()
3223 do_cmd_go_down(p_ptr); in do_cmd_hold_or_stay()
3227 do_cmd_go_up(p_ptr); in do_cmd_hold_or_stay()
3235 void do_cmd_enterfeat(player_type *p_ptr) in do_cmd_enterfeat() argument
3238 do_cmd_hold_or_stay(p_ptr, TRUE, TRUE); in do_cmd_enterfeat()
3244 void do_cmd_hold(player_type *p_ptr) in do_cmd_hold() argument
3247 do_cmd_hold_or_stay(p_ptr, TRUE, FALSE); in do_cmd_hold()
3253 void do_cmd_stay(player_type *p_ptr) in do_cmd_stay() argument
3256 do_cmd_hold_or_stay(p_ptr, !option_p(p_ptr,ALWAYS_PICKUP), FALSE); in do_cmd_stay()
3264 void do_cmd_toggle_rest(player_type *p_ptr) in do_cmd_toggle_rest() argument
3267 p_ptr->resting = TRUE; in do_cmd_toggle_rest()
3270 p_ptr->running = FALSE; in do_cmd_toggle_rest()
3273 p_ptr->energy -= (level_speed(p_ptr->dun_depth)); in do_cmd_toggle_rest()
3276 p_ptr->redraw |= (PR_STATE); in do_cmd_toggle_rest()
3286 if (p_ptr->command_arg <= 0)
3301 p_ptr->command_arg = (-2);
3307 p_ptr->command_arg = (-1);
3313 p_ptr->command_arg = atoi(out_val);
3314 if (p_ptr->command_arg <= 0) return;
3320 if (p_ptr->command_arg > 9999) p_ptr->command_arg = 9999;
3324 energy -= level_speed(p_ptr->dun_depth);
3327 resting = p_ptr->command_arg;
3330 p_ptr->searching = FALSE;
3333 p_ptr->update |= (PU_BONUS);
3336 p_ptr->redraw |= (PR_STATE);
3352 void do_cmd_pathfind(player_type *p_ptr, int y, int x) in do_cmd_pathfind() argument
3355 if (ABS(p_ptr->px - x) <= 1 && ABS(p_ptr->py - y) <= 1) in do_cmd_pathfind()
3357 int dir = motion_dir(p_ptr->py, p_ptr->px, y, x); in do_cmd_pathfind()
3358 do_cmd_walk(p_ptr, dir, option_p(p_ptr, ALWAYS_PICKUP)); in do_cmd_pathfind()
3363 if (p_ptr->confused) in do_cmd_pathfind()
3366 msg_print(p_ptr, "You are too confused!"); in do_cmd_pathfind()
3370 if (findpath(p_ptr, y, x)) in do_cmd_pathfind()
3372 p_ptr->running_withpathfind = TRUE; in do_cmd_pathfind()
3373 p_ptr->run_request = -1; in do_cmd_pathfind()
3457 void do_cmd_fire(player_type *p_ptr, int item, int dir) in do_cmd_fire() argument
3460 int Depth = p_ptr->dun_depth; in do_cmd_fire()
3481 __trap(p_ptr, CPI(p_ptr, 'f')); in do_cmd_fire()
3484 if ( (p_ptr->ghost || p_ptr->fruit_bat) && !(p_ptr->dm_flags & DM_GHOST_HANDS) ) in do_cmd_fire()
3486 msg_print(p_ptr, "You cannot shoot!"); in do_cmd_fire()
3491 j_ptr = &(p_ptr->inventory[INVEN_BOW]); in do_cmd_fire()
3496 msg_print(p_ptr, "You have nothing to fire with."); in do_cmd_fire()
3502 item_tester_tval = p_ptr->tval_ammo; in do_cmd_fire()
3506 msg_print(p_ptr, "You have nothing to fire."); in do_cmd_fire()
3513 o_ptr = &(p_ptr->inventory[item]); in do_cmd_fire()
3517 item = -cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px].o_idx; in do_cmd_fire()
3522 __trap(p_ptr, CGI(o_ptr, 'f')); in do_cmd_fire()
3524 if (o_ptr->tval != p_ptr->tval_ammo) in do_cmd_fire()
3526 msg_print(p_ptr, "You cannot fire that!"); in do_cmd_fire()
3532 msg_print(p_ptr, "You cannot fire that!"); in do_cmd_fire()
3541 p_ptr->command_dir = dir; in do_cmd_fire()
3542 if (!get_aim_dir(p_ptr, &dir)) return; in do_cmd_fire()
3553 inven_item_increase(p_ptr, item, -1); in do_cmd_fire()
3554 inven_item_describe(p_ptr, item); in do_cmd_fire()
3555 inven_item_optimize(p_ptr, item); in do_cmd_fire()
3563 floor_item_notify(p_ptr, 0 - item, TRUE); in do_cmd_fire()
3571 sound(p_ptr, MSG_SHOOT); in do_cmd_fire()
3574 object_desc(p_ptr, o_name, sizeof(o_name), o_ptr, FALSE, 3); in do_cmd_fire()
3577 missile_attr = object_attr_p(p_ptr, o_ptr); in do_cmd_fire()
3578 missile_char = object_char_p(p_ptr, o_ptr); in do_cmd_fire()
3582 thits = p_ptr->num_fire; in do_cmd_fire()
3591 bonus = (p_ptr->to_h + o_ptr->to_h + j_ptr->to_h); in do_cmd_fire()
3592 chance = (p_ptr->skill_thb + (bonus * BTH_PLUS_ADJ)); in do_cmd_fire()
3637 if (p_ptr->xtra_might) tmul++; in do_cmd_fire()
3647 p_ptr->energy -= (level_speed(p_ptr->dun_depth) / thits); in do_cmd_fire()
3651 y = p_ptr->py; in do_cmd_fire()
3652 x = p_ptr->px; in do_cmd_fire()
3655 tx = p_ptr->px + 99 * ddx[dir]; in do_cmd_fire()
3656 ty = p_ptr->py + 99 * ddy[dir]; in do_cmd_fire()
3659 if ((dir == 5) && target_okay(p_ptr)) in do_cmd_fire()
3661 tx = p_ptr->target_col; in do_cmd_fire()
3662 ty = p_ptr->target_row; in do_cmd_fire()
3667 handle_stuff(p_ptr); in do_cmd_fire()
3679 mmove2(&ny, &nx, p_ptr->py, p_ptr->px, ty, tx); in do_cmd_fire()
3692 q_ptr = p_ptr; in do_cmd_fire()
3700 p_ptr = Players[i]; in do_cmd_fire()
3703 if (p_ptr->dun_depth != Depth) in do_cmd_fire()
3707 if (panel_contains(p_ptr, y, x) && player_can_see_bold(p_ptr, y, x)) in do_cmd_fire()
3710 dispy = y - p_ptr->panel_row_prt; in do_cmd_fire()
3711 dispx = x - p_ptr->panel_col_prt; in do_cmd_fire()
3721 (void)send_air_char(p_ptr, dispy, dispx, missile_attr, missile_char, cur_dis, 1); in do_cmd_fire()
3739 p_ptr = q_ptr; in do_cmd_fire()
3749 if (!pvp_okay(p_ptr, q_ptr, (p_ptr->target_who == c_ptr->m_idx ? 2 : 3) )) in do_cmd_fire()
3755 visible = p_ptr->play_vis[0 - c_ptr->m_idx]; in do_cmd_fire()
3772 msg_format(p_ptr, "The %s finds a mark.", o_name); in do_cmd_fire()
3773 sound(p_ptr, MSG_SHOOT_HIT); in do_cmd_fire()
3781 msg_format(p_ptr, "The %s hits %s.", o_name, pvp_name); in do_cmd_fire()
3782 sound(p_ptr, MSG_SHOOT_HIT); in do_cmd_fire()
3783 msg_format(q_ptr, "%^s hits you with a %s.", p_ptr->name, o_name); in do_cmd_fire()
3786 health_track(p_ptr, c_ptr->m_idx); in do_cmd_fire()
3791 tdam = critical_shot(p_ptr, o_ptr->weight, o_ptr->to_h, tdam); in do_cmd_fire()
3800 take_hit(q_ptr, tdam, p_ptr->name); in do_cmd_fire()
3816 visible = p_ptr->mon_vis[c_ptr->m_idx]; in do_cmd_fire()
3844 msg_format(p_ptr, "The %s finds a mark.", o_name); in do_cmd_fire()
3853 monster_desc(p_ptr, m_name, c_ptr->m_idx, 0); in do_cmd_fire()
3856 msg_format(p_ptr, "The %s hits %s.", o_name, m_name); in do_cmd_fire()
3859 if (visible) monster_race_track(p_ptr, m_ptr->r_idx); in do_cmd_fire()
3862 if (visible) health_track(p_ptr, c_ptr->m_idx); in do_cmd_fire()
3866 tdam = tot_dam_aux(p_ptr, o_ptr, tdam, m_ptr, p_ptr->mon_vis[c_ptr->m_idx]); in do_cmd_fire()
3867 tdam = critical_shot(p_ptr, o_ptr->weight, o_ptr->to_h, tdam); in do_cmd_fire()
3873 if (is_dm_p(p_ptr)) in do_cmd_fire()
3875 msg_format(p_ptr, "You do %d (out of %d) damage.", in do_cmd_fire()
3880 if (mon_take_hit(p_ptr, c_ptr->m_idx, tdam, &fear, note_dies)) in do_cmd_fire()
3889 message_pain(p_ptr, c_ptr->m_idx, tdam); in do_cmd_fire()
3897 sound(p_ptr, MSG_FLEE); in do_cmd_fire()
3900 monster_desc(p_ptr, m_name, c_ptr->m_idx, 0); in do_cmd_fire()
3903 msg_format(p_ptr, "%^s flees in terror!", m_name); in do_cmd_fire()
3931 void do_cmd_throw(player_type *p_ptr, int item, int dir) in do_cmd_throw() argument
3934 int Depth = p_ptr->dun_depth; in do_cmd_throw()
3953 __trap(p_ptr, CPI(p_ptr, 'v')); in do_cmd_throw()
3958 if ( ((p_ptr->ghost) || (p_ptr->fruit_bat && item >= 0)) && !(p_ptr->dm_flags & DM_GHOST_HANDS) ) in do_cmd_throw()
3960 msg_print(p_ptr, "You cannot throw things!"); in do_cmd_throw()
3967 o_ptr = &(p_ptr->inventory[item]); in do_cmd_throw()
3971 item = -cave[p_ptr->dun_depth][p_ptr->py][p_ptr->px].o_idx; in do_cmd_throw()
3976 msg_print(p_ptr, "There is nothing there to throw"); in do_cmd_throw()
3981 __trap(p_ptr, CGI(o_ptr, 'v')); in do_cmd_throw()
3986 msg_print(p_ptr, "You can not throw this!"); in do_cmd_throw()
3991 p_ptr->command_dir = dir; in do_cmd_throw()
3992 if (!get_aim_dir(p_ptr, &dir)) return; in do_cmd_throw()
4004 inven_item_increase(p_ptr, item, -1); in do_cmd_throw()
4005 inven_item_describe(p_ptr, item); in do_cmd_throw()
4006 inven_item_optimize(p_ptr, item); in do_cmd_throw()
4014 floor_item_notify(p_ptr, 0 - item, TRUE); in do_cmd_throw()
4021 object_desc(p_ptr, o_name, sizeof(o_name), o_ptr, FALSE, 3); in do_cmd_throw()
4024 missile_attr = object_attr_p(p_ptr, o_ptr); in do_cmd_throw()
4025 missile_char = object_char_p(p_ptr, o_ptr); in do_cmd_throw()
4035 tdis = (adj_str_blow[p_ptr->stat_ind[A_STR]] + 20) * mul / div; in do_cmd_throw()
4044 chance = (p_ptr->skill_tht + (p_ptr->to_h * BTH_PLUS_ADJ)); in do_cmd_throw()
4048 p_ptr->energy -= level_speed(p_ptr->dun_depth); in do_cmd_throw()
4052 y = p_ptr->py; in do_cmd_throw()
4053 x = p_ptr->px; in do_cmd_throw()
4056 tx = p_ptr->px + 99 * ddx[dir]; in do_cmd_throw()
4057 ty = p_ptr->py + 99 * ddy[dir]; in do_cmd_throw()
4060 if ((dir == 5) && target_okay(p_ptr)) in do_cmd_throw()
4062 tx = p_ptr->target_col; in do_cmd_throw()
4063 ty = p_ptr->target_row; in do_cmd_throw()
4068 handle_stuff(p_ptr); in do_cmd_throw()
4080 mmove2(&ny, &nx, p_ptr->py, p_ptr->px, ty, tx); in do_cmd_throw()
4107 if (!house_owned_by(p_ptr, j)) break; in do_cmd_throw()
4110 if (randint1(100) > p_ptr->sc) break; in do_cmd_throw()
4133 q_ptr = p_ptr; in do_cmd_throw()
4141 p_ptr = Players[i]; in do_cmd_throw()
4144 if (p_ptr->dun_depth != Depth) in do_cmd_throw()
4148 if (panel_contains(p_ptr, y, x) && player_can_see_bold(p_ptr, y, x)) in do_cmd_throw()
4151 dispy = y - p_ptr->panel_row_prt; in do_cmd_throw()
4152 dispx = x - p_ptr->panel_col_prt; in do_cmd_throw()
4162 (void)send_air_char(p_ptr, dispy, dispx, missile_attr, missile_char, cur_dis, 1); in do_cmd_throw()
4180 p_ptr = q_ptr; in do_cmd_throw()
4191 visible = p_ptr->play_vis[0 - c_ptr->m_idx]; in do_cmd_throw()
4203 msg_format(p_ptr, "The %s finds a mark!", o_name); in do_cmd_throw()
4208 if (!pvp_okay(p_ptr, q_ptr, 0)) in do_cmd_throw()
4215 msg_format(p_ptr, "%s shrugs off the %s.", q_ptr->name, o_name); in do_cmd_throw()
4216 msg_format(q_ptr, "%s throws you %s %s!", p_ptr->name, in do_cmd_throw()
4227 msg_format(p_ptr, "The %s hits %s.", o_name, q_ptr->name); in do_cmd_throw()
4228 msg_format(q_ptr, "%s hits you with %s %s!", p_ptr->name, in do_cmd_throw()
4232 health_track(p_ptr, c_ptr->m_idx); in do_cmd_throw()
4237 tdam = critical_shot(p_ptr, o_ptr->weight, o_ptr->to_h, tdam); in do_cmd_throw()
4246 take_hit(q_ptr, tdam, p_ptr->name); in do_cmd_throw()
4262 visible = p_ptr->mon_vis[c_ptr->m_idx]; in do_cmd_throw()
4290 msg_format(p_ptr, "The %s finds a mark.", o_name); in do_cmd_throw()
4299 monster_desc(p_ptr, m_name, c_ptr->m_idx, 0); in do_cmd_throw()
4302 msg_format(p_ptr, "The %s hits %s.", o_name, m_name); in do_cmd_throw()
4305 if (visible) monster_race_track(p_ptr, m_ptr->r_idx); in do_cmd_throw()
4308 if (visible) health_track(p_ptr, c_ptr->m_idx); in do_cmd_throw()
4312 tdam = tot_dam_aux(p_ptr, o_ptr, tdam, m_ptr, p_ptr->mon_vis[c_ptr->m_idx]); in do_cmd_throw()
4313 tdam = critical_shot(p_ptr, o_ptr->weight, o_ptr->to_h, tdam); in do_cmd_throw()
4319 if (is_dm_p(p_ptr)) in do_cmd_throw()
4321 msg_format(p_ptr, "You do %d (out of %d) damage.", in do_cmd_throw()
4326 if (mon_take_hit(p_ptr, c_ptr->m_idx, tdam, &fear, note_dies)) in do_cmd_throw()
4335 message_pain(p_ptr, c_ptr->m_idx, tdam); in do_cmd_throw()
4343 sound(p_ptr, MSG_FLEE); in do_cmd_throw()
4346 monster_desc(p_ptr, m_name, c_ptr->m_idx, 0); in do_cmd_throw()
4349 msg_format(p_ptr, "%^s flees in terror!", m_name); in do_cmd_throw()
4363 if ((p_ptr->lev == 1) && (cfg_newbies_cannot_drop)) in do_cmd_throw()
4378 void do_cmd_purchase_house(player_type *p_ptr, int dir) in do_cmd_purchase_house() argument
4380 int Depth = p_ptr->dun_depth; in do_cmd_purchase_house()
4386 __trap(p_ptr, CPI(p_ptr, 'h')); in do_cmd_purchase_house()
4389 if(!(p_ptr->dm_flags & DM_HOUSE_CONTROL)) { in do_cmd_purchase_house()
4390 if ( (p_ptr->ghost) || (p_ptr->fruit_bat) ) in do_cmd_purchase_house()
4393 msg_print(p_ptr, "You cannot buy a house."); in do_cmd_purchase_house()
4402 i = p_ptr->current_house; in do_cmd_purchase_house()
4403 p_ptr->current_house = -1; in do_cmd_purchase_house()
4408 msg_print(p_ptr, "You see nothing to sell there."); in do_cmd_purchase_house()
4416 factor = adj_chr_gold[p_ptr->stat_ind[A_CHR]]; in do_cmd_purchase_house()
4422 if (house_owned_by(p_ptr, i)) in do_cmd_purchase_house()
4427 msg_format(p_ptr, "You sell your house for %ld gold.", price/2); in do_cmd_purchase_house()
4430 p_ptr->au += price / 2; in do_cmd_purchase_house()
4433 p_ptr->redraw |= (PR_GOLD); in do_cmd_purchase_house()
4441 msg_print(p_ptr, "You don't own this house."); in do_cmd_purchase_house()
4449 y = p_ptr->py + ddy[dir]; in do_cmd_purchase_house()
4450 x = p_ptr->px + ddx[dir]; in do_cmd_purchase_house()
4459 msg_print(p_ptr, "You see nothing to buy there."); in do_cmd_purchase_house()
4464 factor = adj_chr_gold[p_ptr->stat_ind[A_CHR]]; in do_cmd_purchase_house()
4473 if (house_owned_by(p_ptr, i)) in do_cmd_purchase_house()
4475 if (house_inside(p_ptr, i)) in do_cmd_purchase_house()
4479 do_cmd_store(p_ptr, i); in do_cmd_purchase_house()
4484 p_ptr->current_house = i; in do_cmd_purchase_house()
4486 send_store_sell(p_ptr, price/2); in do_cmd_purchase_house()
4491 if (p_ptr->dm_flags & DM_HOUSE_CONTROL) in do_cmd_purchase_house()
4495 msg_format(p_ptr, "The house has been reset."); in do_cmd_purchase_house()
4501 msg_print(p_ptr, "That house is already owned."); in do_cmd_purchase_house()
4514 if (price > p_ptr->au) in do_cmd_purchase_house()
4517 msg_print(p_ptr, "You do not have enough money."); in do_cmd_purchase_house()
4522 if( cfg_max_houses && houses_owned(p_ptr) >= cfg_max_houses ) in do_cmd_purchase_house()
4525 msg_print(p_ptr, "You own too many houses already."); in do_cmd_purchase_house()
4536 p_ptr->au -= price; in do_cmd_purchase_house()
4539 set_house_owner(p_ptr, i); in do_cmd_purchase_house()
4542 p_ptr->redraw |= (PR_GOLD); in do_cmd_purchase_house()