1 #include "cmd-action/cmd-pet.h"
2 #include "action/action-limited.h"
3 #include "cmd-action/cmd-attack.h"
4 #include "cmd-io/cmd-dump.h"
5 #include "core/asking-player.h"
6 #include "core/player-redraw-types.h"
7 #include "core/player-update-types.h"
8 #include "core/stuff-handler.h"
9 #include "core/window-redrawer.h"
10 #include "effect/spells-effect-util.h"
11 #include "floor/geometry.h"
12 #include "floor/pattern-walk.h"
13 #include "game-option/input-options.h"
14 #include "game-option/map-screen-options.h"
15 #include "game-option/play-record-options.h"
16 #include "game-option/text-display-options.h"
17 #include "grid/grid.h"
18 #include "inventory/inventory-slot-types.h"
19 #include "io/command-repeater.h"
20 #include "io/cursor.h"
21 #include "io/input-key-acceptor.h"
22 #include "io/input-key-requester.h"
23 #include "io/write-diary.h"
24 #include "main/sound-of-music.h"
25 #include "monster-floor/monster-object.h"
26 #include "monster-floor/monster-remover.h"
27 #include "monster-race/monster-race.h"
28 #include "monster-race/race-flags1.h"
29 #include "monster-race/race-flags7.h"
30 #include "monster/monster-describer.h"
31 #include "monster/monster-description-types.h"
32 #include "monster/monster-info.h"
33 #include "monster/monster-status-setter.h"
34 #include "monster/monster-status.h"
35 #include "monster/smart-learn-types.h"
36 #include "object-hook/hook-weapon.h"
37 #include "pet/pet-util.h"
38 #include "player-base/player-class.h"
39 #include "player-info/class-info.h"
40 #include "player-info/equipment-info.h"
41 #include "player-info/samurai-data-type.h"
42 #include "player-status/player-energy.h"
43 #include "player-status/player-hand-types.h"
44 #include "player/attack-defense-types.h"
45 #include "player/player-damage.h"
46 #include "player/player-move.h"
47 #include "player/player-skill.h"
48 #include "player/player-status-flags.h"
49 #include "player/special-defense-types.h"
50 #include "status/action-setter.h"
51 #include "system/floor-type-definition.h"
52 #include "system/grid-type-definition.h"
53 #include "system/item-entity.h"
54 #include "system/monster-entity.h"
55 #include "system/monster-race-info.h"
56 #include "system/player-type-definition.h"
57 #include "system/redrawing-flags-updater.h"
58 #include "system/terrain-type-definition.h"
59 #include "target/target-checker.h"
60 #include "target/target-getter.h"
61 #include "target/target-setter.h"
62 #include "target/target-types.h"
63 #include "term/screen-processor.h"
64 #include "timed-effect/player-hallucination.h"
65 #include "timed-effect/timed-effects.h"
66 #include "util/bit-flags-calculator.h"
67 #include "util/int-char-converter.h"
68 #include "util/quarks.h"
69 #include "util/sort.h"
70 #include "util/string-processor.h"
71 #include "view/display-messages.h"
72 #include "world/world.h"
76 * @brief ペットを開放するコマンドのメインルーチン
78 void do_cmd_pet_dismiss(PlayerType *player_ptr)
81 bool all_pets = false;
87 cu = game_term->scr->cu;
88 cv = game_term->scr->cv;
89 game_term->scr->cu = 0;
90 game_term->scr->cv = 1;
92 /* Allocate the "who" array */
93 std::vector<MONSTER_IDX> who;
95 /* Process the monsters (backwards) */
96 for (MONSTER_IDX pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
97 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
99 who.push_back(pet_ctr);
103 ang_sort(player_ptr, who.data(), &dummy_why, who.size(), ang_sort_comp_pet_dismiss, ang_sort_swap_hook);
105 /* Process the monsters (backwards) */
106 auto &rfu = RedrawingFlagsUpdater::get_instance();
107 for (auto i = 0U; i < who.size(); i++) {
108 auto pet_ctr = who[i];
109 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
111 auto delete_this = false;
112 auto should_ask = (pet_ctr == player_ptr->riding) || m_ptr->is_named();
113 const auto friend_name = monster_desc(player_ptr, m_ptr, MD_ASSUME_VISIBLE);
116 /* Hack -- health bar for this monster */
117 health_track(player_ptr, pet_ctr);
118 handle_stuff(player_ptr);
119 constexpr auto mes = _("%sを放しますか? [Yes/No/Unnamed (%lu体)]", "Dismiss %s? [Yes/No/Unnamed (%lu remain)]");
120 msg_format(mes, friend_name.data(), who.size() - i);
123 move_cursor_relative(m_ptr->fy, m_ptr->fx);
129 if (ch == 'Y' || ch == 'y') {
133 msg_format(_("本当によろしいですか? (%s) ", "Are you sure? (%s) "), friend_name.data());
135 if (ch != 'Y' && ch != 'y') {
142 if (ch == 'U' || ch == 'u') {
147 if (ch == ESCAPE || ch == 'N' || ch == 'n') {
155 if ((all_pets && !should_ask) || (!all_pets && delete_this)) {
156 if (record_named_pet && m_ptr->is_named()) {
157 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
158 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name.data());
161 if (pet_ctr == player_ptr->riding) {
162 msg_format(_("%sから降りた。", "You dismount from %s. "), friend_name.data());
164 player_ptr->riding = 0;
165 rfu.set_flag(StatusRedrawingFlag::MONSTER_STATUSES);
166 player_ptr->redraw |= (PR_EXTRA | PR_UHEALTH);
169 /* HACK : Add the line to message buffer */
170 msg_format(_("%s を放した。", "Dismissed %s."), friend_name.data());
171 rfu.set_flag(StatusRedrawingFlag::BONUS);
172 player_ptr->window_flags |= (PW_MESSAGE);
174 delete_monster_idx(player_ptr, pet_ctr);
179 game_term->scr->cu = cu;
180 game_term->scr->cv = cv;
184 msg_format("%d 体のペットを放しました。", Dismissed);
186 msg_format("You have dismissed %d pet%s.", Dismissed, (Dismissed == 1 ? "" : "s"));
188 if (Dismissed == 0 && all_pets) {
189 msg_print(_("'U'nnamed は、乗馬以外の名前のないペットだけを全て解放します。", "'U'nnamed means all your pets except named pets and your mount."));
192 handle_stuff(player_ptr);
196 * @brief ペットから騎乗/下馬するコマンドのメインルーチン /
197 * @param force 強制的に騎乗/下馬するならばTRUE
198 * @return 騎乗/下馬できたらTRUE
200 bool do_cmd_riding(PlayerType *player_ptr, bool force)
205 MonsterEntity *m_ptr;
207 if (!get_direction(player_ptr, &dir, false, false)) {
210 y = player_ptr->y + ddy[dir];
211 x = player_ptr->x + ddx[dir];
212 g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
214 PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
216 if (player_ptr->riding) {
217 /* Skip non-empty grids */
218 if (!can_player_ride_pet(player_ptr, g_ptr, false)) {
219 msg_print(_("そちらには降りられません。", "You cannot go that direction."));
223 if (!pattern_seq(player_ptr, player_ptr->y, player_ptr->x, y, x)) {
228 PlayerEnergy(player_ptr).set_player_turn_energy(100);
230 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
232 do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
236 player_ptr->riding = 0;
237 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
238 player_ptr->riding_ryoute = player_ptr->old_riding_ryoute = false;
240 if (cmd_limit_confused(player_ptr)) {
244 m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
246 if (!g_ptr->m_idx || !m_ptr->ml) {
247 msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
250 if (!m_ptr->is_pet() && !force) {
251 msg_print(_("そのモンスターはペットではありません。", "That monster is not a pet."));
254 if (!(monraces_info[m_ptr->r_idx].flags7 & RF7_RIDING)) {
255 msg_print(_("そのモンスターには乗れなさそうだ。", "This monster doesn't seem suitable for riding."));
259 if (!pattern_seq(player_ptr, player_ptr->y, player_ptr->x, y, x)) {
263 if (!can_player_ride_pet(player_ptr, g_ptr, true)) {
264 /* Feature code (applying "mimic" field) */
265 auto *f_ptr = &terrains_info[g_ptr->get_feat_mimic()];
266 using Tc = TerrainCharacteristics;
268 msg_format("そのモンスターは%sの%sにいる。", f_ptr->name.data(),
269 (f_ptr->flags.has_none_of({ Tc::MOVE, Tc::CAN_FLY }) || f_ptr->flags.has_none_of({ Tc::LOS, Tc::TREE })) ? "中" : "上");
271 msg_format("This monster is %s the %s.",
272 (f_ptr->flags.has_none_of({ Tc::MOVE, Tc::CAN_FLY }) || f_ptr->flags.has_none_of({ Tc::LOS, Tc::TREE })) ? "in" : "on", f_ptr->name.data());
277 if (monraces_info[m_ptr->r_idx].level > randint1((player_ptr->skill_exp[PlayerSkillKindType::RIDING] / 50 + player_ptr->lev / 2 + 20))) {
278 msg_print(_("うまく乗れなかった。", "You failed to ride."));
279 PlayerEnergy(player_ptr).set_player_turn_energy(100);
283 if (m_ptr->is_asleep()) {
284 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
285 (void)set_monster_csleep(player_ptr, g_ptr->m_idx, 0);
286 msg_format(_("%sを起こした。", "You have woken %s up."), m_name.data());
289 if (player_ptr->action == ACTION_MONK_STANCE) {
290 set_action(player_ptr, ACTION_NONE);
293 player_ptr->riding = g_ptr->m_idx;
295 /* Hack -- remove tracked monster */
296 if (player_ptr->riding == player_ptr->health_who) {
297 health_track(player_ptr, 0);
301 PlayerEnergy(player_ptr).set_player_turn_energy(100);
303 auto &rfu = RedrawingFlagsUpdater::get_instance();
304 const auto flags_srf = {
305 StatusRedrawingFlag::UN_VIEW,
306 StatusRedrawingFlag::UN_LITE,
307 StatusRedrawingFlag::BONUS,
309 rfu.set_flags(flags_srf);
310 player_ptr->redraw |= (PR_MAP | PR_EXTRA);
311 player_ptr->redraw |= (PR_UHEALTH);
313 (void)move_player_effect(player_ptr, y, x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
319 * @brief ペットに名前をつけるコマンドのメインルーチン
321 static void do_name_pet(PlayerType *player_ptr)
323 MonsterEntity *m_ptr;
324 bool old_name = false;
325 bool old_target_pet = target_pet;
328 if (!target_set(player_ptr, TARGET_KILL)) {
329 target_pet = old_target_pet;
333 target_pet = old_target_pet;
335 if (player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) {
336 m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
338 if (!m_ptr->is_pet()) {
339 msg_print(_("そのモンスターはペットではない。", "This monster is not a pet."));
342 if (monraces_info[m_ptr->r_idx].kind_flags.has(MonsterKindType::UNIQUE)) {
343 msg_print(_("そのモンスターの名前は変えられない!", "You cannot change the name of this monster!"));
347 msg_format(_("%sに名前をつける。", "Name %s."), monster_desc(player_ptr, m_ptr, 0).data());
350 /* Start with nothing */
353 /* Use old inscription */
354 if (m_ptr->is_named()) {
355 /* Start with the old inscription */
356 angband_strcpy(out_val, m_ptr->nickname.data(), sizeof(out_val));
360 /* Get a new inscription (possibly empty) */
361 if (get_string(_("名前: ", "Name: "), out_val, 15)) {
363 /* Save the inscription */
364 m_ptr->nickname = out_val;
365 if (record_named_pet) {
366 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_NAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE).data());
369 if (record_named_pet && old_name) {
370 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_UNNAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE).data());
372 m_ptr->nickname.clear();
379 * @brief ペットに関するコマンドリストのメインルーチン /
380 * Issue a pet command
382 void do_cmd_pet(PlayerType *player_ptr)
386 std::string power_desc[36];
390 MonsterEntity *m_ptr;
391 auto command_idx = 0;
392 int menu_line = use_menu ? 1 : 0;
394 if (player_ptr->wild_mode) {
398 power_desc[num] = _("ペットを放す", "dismiss pets");
399 powers[num++] = PET_DISMISS;
401 auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
402 auto taget_of_pet = monraces_info[player_ptr->current_floor_ptr->m_list[player_ptr->pet_t_m_idx].ap_r_idx].name.data();
403 auto target_of_pet_appearance = is_hallucinated ? _("何か奇妙な物", "something strange") : taget_of_pet;
404 auto mes = _("ペットのターゲットを指定 (現在:%s)", "specify a target of pet (now:%s)");
405 auto target_name = player_ptr->pet_t_m_idx > 0 ? target_of_pet_appearance : _("指定なし", "nothing");
406 auto target_ask = format(mes, target_name);
407 power_desc[num] = target_ask;
408 powers[num++] = PET_TARGET;
409 power_desc[num] = _("近くにいろ", "stay close");
411 if (player_ptr->pet_follow_distance == PET_CLOSE_DIST) {
414 powers[num++] = PET_STAY_CLOSE;
415 power_desc[num] = _("ついて来い", "follow me");
417 if (player_ptr->pet_follow_distance == PET_FOLLOW_DIST) {
420 powers[num++] = PET_FOLLOW_ME;
421 power_desc[num] = _("敵を見つけて倒せ", "seek and destroy");
423 if (player_ptr->pet_follow_distance == PET_DESTROY_DIST) {
426 powers[num++] = PET_SEEK_AND_DESTROY;
427 power_desc[num] = _("少し離れていろ", "give me space");
429 if (player_ptr->pet_follow_distance == PET_SPACE_DIST) {
432 powers[num++] = PET_ALLOW_SPACE;
433 power_desc[num] = _("離れていろ", "stay away");
435 if (player_ptr->pet_follow_distance == PET_AWAY_DIST) {
438 powers[num++] = PET_STAY_AWAY;
440 if (player_ptr->pet_extra_flags & PF_OPEN_DOORS) {
441 power_desc[num] = _("ドアを開ける (現在:ON)", "pets open doors (now On)");
443 power_desc[num] = _("ドアを開ける (現在:OFF)", "pets open doors (now Off)");
445 powers[num++] = PET_OPEN_DOORS;
447 if (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
448 power_desc[num] = _("アイテムを拾う (現在:ON)", "pets pick up items (now On)");
450 power_desc[num] = _("アイテムを拾う (現在:OFF)", "pets pick up items (now Off)");
452 powers[num++] = PET_TAKE_ITEMS;
454 if (player_ptr->pet_extra_flags & PF_TELEPORT) {
455 power_desc[num] = _("テレポート系魔法を使う (現在:ON)", "allow teleport (now On)");
457 power_desc[num] = _("テレポート系魔法を使う (現在:OFF)", "allow teleport (now Off)");
459 powers[num++] = PET_TELEPORT;
461 if (player_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
462 power_desc[num] = _("攻撃魔法を使う (現在:ON)", "allow cast attack spell (now On)");
464 power_desc[num] = _("攻撃魔法を使う (現在:OFF)", "allow cast attack spell (now Off)");
466 powers[num++] = PET_ATTACK_SPELL;
468 if (player_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
469 power_desc[num] = _("召喚魔法を使う (現在:ON)", "allow cast summon spell (now On)");
471 power_desc[num] = _("召喚魔法を使う (現在:OFF)", "allow cast summon spell (now Off)");
473 powers[num++] = PET_SUMMON_SPELL;
475 if (player_ptr->pet_extra_flags & PF_BALL_SPELL) {
476 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:ON)", "allow involve player in area spell (now On)");
478 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:OFF)", "allow involve player in area spell (now Off)");
480 powers[num++] = PET_BALL_SPELL;
482 if (player_ptr->riding) {
483 power_desc[num] = _("ペットから降りる", "get off a pet");
485 power_desc[num] = _("ペットに乗る", "ride a pet");
487 powers[num++] = PET_RIDING;
488 power_desc[num] = _("ペットに名前をつける", "name pets");
489 powers[num++] = PET_NAME;
491 bool empty_main = can_attack_with_main_hand(player_ptr);
492 empty_main &= empty_hands(player_ptr, false) == EMPTY_HAND_SUB;
493 empty_main &= player_ptr->inventory_list[INVEN_MAIN_HAND].allow_two_hands_wielding();
495 bool empty_sub = can_attack_with_sub_hand(player_ptr);
496 empty_sub &= empty_hands(player_ptr, false) == EMPTY_HAND_MAIN;
497 empty_sub &= player_ptr->inventory_list[INVEN_SUB_HAND].allow_two_hands_wielding();
499 if (player_ptr->riding) {
500 if (empty_main || empty_sub) {
501 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
502 power_desc[num] = _("武器を片手で持つ", "use one hand to control the pet you are riding");
504 power_desc[num] = _("武器を両手で持つ", "use both hands for a weapon");
507 powers[num++] = PET_TWO_HANDS;
509 switch (player_ptr->pclass) {
510 case PlayerClassType::MONK:
511 case PlayerClassType::FORCETRAINER:
512 case PlayerClassType::BERSERKER: {
513 if (empty_hands(player_ptr, false) == (EMPTY_HAND_MAIN | EMPTY_HAND_SUB)) {
514 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
515 power_desc[num] = _("片手で格闘する", "use one hand to control the pet you are riding");
517 power_desc[num] = _("両手で格闘する", "use both hands for melee");
520 powers[num++] = PET_TWO_HANDS;
524 auto has_any_melee_weapon = has_melee_weapon(player_ptr, INVEN_MAIN_HAND);
525 has_any_melee_weapon |= has_melee_weapon(player_ptr, INVEN_SUB_HAND);
526 if ((empty_hands(player_ptr, false) != EMPTY_HAND_NONE) && !has_any_melee_weapon) {
527 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
528 power_desc[num] = _("格闘を行わない", "use one hand to control the pet you are riding");
530 power_desc[num] = _("格闘を行う", "use one hand for melee");
533 powers[num++] = PET_TWO_HANDS;
545 if (!(repeat_pull(&i) && (i >= 0) && (i < num))) {
552 prompt = _("(コマンド、ESC=終了) コマンドを選んでください:", "(Command, ESC=exit) Choose command from menu.");
554 prompt = format(_("(コマンド %c-%c、'*'=一覧、ESC=終了) コマンドを選んでください:", "(Command %c-%c, *=List, ESC=exit) Select a command: "),
555 I2A(0), I2A(num - 1));
558 choice = (always_show_list || use_menu) ? ESCAPE : 1;
560 /* Get a command from the user */
562 if (choice == ESCAPE) {
564 } else if (!get_com(prompt.data(), &choice, true)) {
568 auto should_redraw_cursor = true;
569 if (use_menu && (choice != ' ')) {
578 menu_line += (num - 1);
604 should_redraw_cursor = false;
607 if (menu_line > num) {
613 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && should_redraw_cursor)) {
615 if (!redraw || use_menu) {
626 for (control = 0; control < num; control++) {
627 /* Letter/number for power selection */
628 std::stringstream ss;
630 ss << format("%c%s ", (control == command_idx) ? '*' : ' ', (control == (menu_line - 1)) ? _("》", "> ") : " ");
632 ss << format("%c%c) ", (control == command_idx) ? '*' : ' ', I2A(control));
635 ss << power_desc[control];
636 prt(ss.str().data(), y + control, x);
639 prt("", y + std::min(control, 17), x);
657 /* Totally Illegal */
658 if ((i < 0) || (i >= num)) {
670 /* Abort if needed */
672 PlayerEnergy(player_ptr).reset_player_turn();
679 case PET_DISMISS: /* Dismiss pets */
681 /* Check pets (backwards) */
682 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
683 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
684 if (m_ref.is_pet()) {
690 msg_print(_("ペットがいない!", "You have no pets!"));
693 do_cmd_pet_dismiss(player_ptr);
694 (void)calculate_upkeep(player_ptr);
699 if (!target_set(player_ptr, TARGET_KILL)) {
700 player_ptr->pet_t_m_idx = 0;
702 auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[target_row][target_col];
703 if (g_ptr->m_idx && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
704 player_ptr->pet_t_m_idx = player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
705 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
707 player_ptr->pet_t_m_idx = 0;
715 case PET_STAY_CLOSE: {
716 player_ptr->pet_follow_distance = PET_CLOSE_DIST;
717 player_ptr->pet_t_m_idx = 0;
721 case PET_FOLLOW_ME: {
722 player_ptr->pet_follow_distance = PET_FOLLOW_DIST;
723 player_ptr->pet_t_m_idx = 0;
726 /* "Seek and destoy" */
727 case PET_SEEK_AND_DESTROY: {
728 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
731 /* "Give me space" */
732 case PET_ALLOW_SPACE: {
733 player_ptr->pet_follow_distance = PET_SPACE_DIST;
737 case PET_STAY_AWAY: {
738 player_ptr->pet_follow_distance = PET_AWAY_DIST;
741 /* flag - allow pets to open doors */
742 case PET_OPEN_DOORS: {
743 if (player_ptr->pet_extra_flags & PF_OPEN_DOORS) {
744 player_ptr->pet_extra_flags &= ~(PF_OPEN_DOORS);
746 player_ptr->pet_extra_flags |= (PF_OPEN_DOORS);
750 /* flag - allow pets to pickup items */
751 case PET_TAKE_ITEMS: {
752 if (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
753 player_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
754 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
755 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
756 if (m_ptr->is_pet()) {
757 monster_drop_carried_objects(player_ptr, m_ptr);
761 player_ptr->pet_extra_flags |= (PF_PICKUP_ITEMS);
766 /* flag - allow pets to teleport */
768 if (player_ptr->pet_extra_flags & PF_TELEPORT) {
769 player_ptr->pet_extra_flags &= ~(PF_TELEPORT);
771 player_ptr->pet_extra_flags |= (PF_TELEPORT);
775 /* flag - allow pets to cast attack spell */
776 case PET_ATTACK_SPELL: {
777 if (player_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
778 player_ptr->pet_extra_flags &= ~(PF_ATTACK_SPELL);
780 player_ptr->pet_extra_flags |= (PF_ATTACK_SPELL);
784 /* flag - allow pets to cast attack spell */
785 case PET_SUMMON_SPELL: {
786 if (player_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
787 player_ptr->pet_extra_flags &= ~(PF_SUMMON_SPELL);
789 player_ptr->pet_extra_flags |= (PF_SUMMON_SPELL);
793 /* flag - allow pets to cast attack spell */
794 case PET_BALL_SPELL: {
795 if (player_ptr->pet_extra_flags & PF_BALL_SPELL) {
796 player_ptr->pet_extra_flags &= ~(PF_BALL_SPELL);
798 player_ptr->pet_extra_flags |= (PF_BALL_SPELL);
804 (void)do_cmd_riding(player_ptr, false);
809 do_name_pet(player_ptr);
813 case PET_TWO_HANDS: {
814 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
815 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
817 player_ptr->pet_extra_flags |= (PF_TWO_HANDS);
820 RedrawingFlagsUpdater::get_instance().set_flag(StatusRedrawingFlag::BONUS);
821 handle_stuff(player_ptr);