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/stuff-handler.h"
8 #include "core/window-redrawer.h"
9 #include "effect/spells-effect-util.h"
10 #include "floor/geometry.h"
11 #include "floor/pattern-walk.h"
12 #include "game-option/input-options.h"
13 #include "game-option/map-screen-options.h"
14 #include "game-option/play-record-options.h"
15 #include "game-option/text-display-options.h"
16 #include "grid/grid.h"
17 #include "inventory/inventory-slot-types.h"
18 #include "io/command-repeater.h"
19 #include "io/cursor.h"
20 #include "io/input-key-acceptor.h"
21 #include "io/input-key-requester.h"
22 #include "io/write-diary.h"
23 #include "main/sound-of-music.h"
24 #include "monster-floor/monster-object.h"
25 #include "monster-floor/monster-remover.h"
26 #include "monster-race/monster-race.h"
27 #include "monster-race/race-flags1.h"
28 #include "monster-race/race-flags7.h"
29 #include "monster/monster-describer.h"
30 #include "monster/monster-description-types.h"
31 #include "monster/monster-info.h"
32 #include "monster/monster-status-setter.h"
33 #include "monster/monster-status.h"
34 #include "monster/smart-learn-types.h"
35 #include "object-hook/hook-weapon.h"
36 #include "pet/pet-util.h"
37 #include "player-base/player-class.h"
38 #include "player-info/class-info.h"
39 #include "player-info/equipment-info.h"
40 #include "player-info/samurai-data-type.h"
41 #include "player-status/player-energy.h"
42 #include "player-status/player-hand-types.h"
43 #include "player/attack-defense-types.h"
44 #include "player/player-damage.h"
45 #include "player/player-move.h"
46 #include "player/player-skill.h"
47 #include "player/player-status-flags.h"
48 #include "player/special-defense-types.h"
49 #include "status/action-setter.h"
50 #include "system/floor-type-definition.h"
51 #include "system/grid-type-definition.h"
52 #include "system/item-entity.h"
53 #include "system/monster-entity.h"
54 #include "system/monster-race-info.h"
55 #include "system/player-type-definition.h"
56 #include "system/redrawing-flags-updater.h"
57 #include "system/terrain-type-definition.h"
58 #include "target/target-checker.h"
59 #include "target/target-getter.h"
60 #include "target/target-setter.h"
61 #include "target/target-types.h"
62 #include "term/screen-processor.h"
63 #include "timed-effect/player-hallucination.h"
64 #include "timed-effect/timed-effects.h"
65 #include "util/bit-flags-calculator.h"
66 #include "util/int-char-converter.h"
67 #include "util/quarks.h"
68 #include "util/sort.h"
69 #include "util/string-processor.h"
70 #include "view/display-messages.h"
71 #include "world/world.h"
75 * @brief ペットを開放するコマンドのメインルーチン
77 void do_cmd_pet_dismiss(PlayerType *player_ptr)
80 bool all_pets = false;
86 cu = game_term->scr->cu;
87 cv = game_term->scr->cv;
88 game_term->scr->cu = 0;
89 game_term->scr->cv = 1;
91 /* Allocate the "who" array */
92 std::vector<MONSTER_IDX> who;
94 /* Process the monsters (backwards) */
95 for (MONSTER_IDX pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
96 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
98 who.push_back(pet_ctr);
102 ang_sort(player_ptr, who.data(), &dummy_why, who.size(), ang_sort_comp_pet_dismiss, ang_sort_swap_hook);
104 /* Process the monsters (backwards) */
105 auto &rfu = RedrawingFlagsUpdater::get_instance();
106 for (auto i = 0U; i < who.size(); i++) {
107 auto pet_ctr = who[i];
108 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
110 auto delete_this = false;
111 auto should_ask = (pet_ctr == player_ptr->riding) || m_ptr->is_named();
112 const auto friend_name = monster_desc(player_ptr, m_ptr, MD_ASSUME_VISIBLE);
115 /* Hack -- health bar for this monster */
116 health_track(player_ptr, pet_ctr);
117 handle_stuff(player_ptr);
118 constexpr auto mes = _("%sを放しますか? [Yes/No/Unnamed (%lu体)]", "Dismiss %s? [Yes/No/Unnamed (%lu remain)]");
119 msg_format(mes, friend_name.data(), who.size() - i);
122 move_cursor_relative(m_ptr->fy, m_ptr->fx);
128 if (ch == 'Y' || ch == 'y') {
132 msg_format(_("本当によろしいですか? (%s) ", "Are you sure? (%s) "), friend_name.data());
134 if (ch != 'Y' && ch != 'y') {
141 if (ch == 'U' || ch == 'u') {
146 if (ch == ESCAPE || ch == 'N' || ch == 'n') {
154 if ((all_pets && !should_ask) || (!all_pets && delete_this)) {
155 if (record_named_pet && m_ptr->is_named()) {
156 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
157 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name.data());
160 if (pet_ctr == player_ptr->riding) {
161 msg_format(_("%sから降りた。", "You dismount from %s. "), friend_name.data());
163 player_ptr->riding = 0;
164 rfu.set_flag(StatusRedrawingFlag::MONSTER_STATUSES);
165 player_ptr->redraw |= (PR_EXTRA | PR_UHEALTH);
168 /* HACK : Add the line to message buffer */
169 msg_format(_("%s を放した。", "Dismissed %s."), friend_name.data());
170 rfu.set_flag(StatusRedrawingFlag::BONUS);
171 player_ptr->window_flags |= (PW_MESSAGE);
173 delete_monster_idx(player_ptr, pet_ctr);
178 game_term->scr->cu = cu;
179 game_term->scr->cv = cv;
183 msg_format("%d 体のペットを放しました。", Dismissed);
185 msg_format("You have dismissed %d pet%s.", Dismissed, (Dismissed == 1 ? "" : "s"));
187 if (Dismissed == 0 && all_pets) {
188 msg_print(_("'U'nnamed は、乗馬以外の名前のないペットだけを全て解放します。", "'U'nnamed means all your pets except named pets and your mount."));
191 handle_stuff(player_ptr);
195 * @brief ペットから騎乗/下馬するコマンドのメインルーチン /
196 * @param force 強制的に騎乗/下馬するならばTRUE
197 * @return 騎乗/下馬できたらTRUE
199 bool do_cmd_riding(PlayerType *player_ptr, bool force)
204 MonsterEntity *m_ptr;
206 if (!get_direction(player_ptr, &dir, false, false)) {
209 y = player_ptr->y + ddy[dir];
210 x = player_ptr->x + ddx[dir];
211 g_ptr = &player_ptr->current_floor_ptr->grid_array[y][x];
213 PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
215 if (player_ptr->riding) {
216 /* Skip non-empty grids */
217 if (!can_player_ride_pet(player_ptr, g_ptr, false)) {
218 msg_print(_("そちらには降りられません。", "You cannot go that direction."));
222 if (!pattern_seq(player_ptr, player_ptr->y, player_ptr->x, y, x)) {
227 PlayerEnergy(player_ptr).set_player_turn_energy(100);
229 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
231 do_cmd_attack(player_ptr, y, x, HISSATSU_NONE);
235 player_ptr->riding = 0;
236 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
237 player_ptr->riding_ryoute = player_ptr->old_riding_ryoute = false;
239 if (cmd_limit_confused(player_ptr)) {
243 m_ptr = &player_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
245 if (!g_ptr->m_idx || !m_ptr->ml) {
246 msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
249 if (!m_ptr->is_pet() && !force) {
250 msg_print(_("そのモンスターはペットではありません。", "That monster is not a pet."));
253 if (!(monraces_info[m_ptr->r_idx].flags7 & RF7_RIDING)) {
254 msg_print(_("そのモンスターには乗れなさそうだ。", "This monster doesn't seem suitable for riding."));
258 if (!pattern_seq(player_ptr, player_ptr->y, player_ptr->x, y, x)) {
262 if (!can_player_ride_pet(player_ptr, g_ptr, true)) {
263 /* Feature code (applying "mimic" field) */
264 auto *f_ptr = &terrains_info[g_ptr->get_feat_mimic()];
265 using Tc = TerrainCharacteristics;
267 msg_format("そのモンスターは%sの%sにいる。", f_ptr->name.data(),
268 (f_ptr->flags.has_none_of({ Tc::MOVE, Tc::CAN_FLY }) || f_ptr->flags.has_none_of({ Tc::LOS, Tc::TREE })) ? "中" : "上");
270 msg_format("This monster is %s the %s.",
271 (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());
276 if (monraces_info[m_ptr->r_idx].level > randint1((player_ptr->skill_exp[PlayerSkillKindType::RIDING] / 50 + player_ptr->lev / 2 + 20))) {
277 msg_print(_("うまく乗れなかった。", "You failed to ride."));
278 PlayerEnergy(player_ptr).set_player_turn_energy(100);
282 if (m_ptr->is_asleep()) {
283 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
284 (void)set_monster_csleep(player_ptr, g_ptr->m_idx, 0);
285 msg_format(_("%sを起こした。", "You have woken %s up."), m_name.data());
288 if (player_ptr->action == ACTION_MONK_STANCE) {
289 set_action(player_ptr, ACTION_NONE);
292 player_ptr->riding = g_ptr->m_idx;
294 /* Hack -- remove tracked monster */
295 if (player_ptr->riding == player_ptr->health_who) {
296 health_track(player_ptr, 0);
300 PlayerEnergy(player_ptr).set_player_turn_energy(100);
302 auto &rfu = RedrawingFlagsUpdater::get_instance();
303 const auto flags_srf = {
304 StatusRedrawingFlag::UN_VIEW,
305 StatusRedrawingFlag::UN_LITE,
306 StatusRedrawingFlag::BONUS,
308 rfu.set_flags(flags_srf);
309 player_ptr->redraw |= (PR_MAP | PR_EXTRA);
310 player_ptr->redraw |= (PR_UHEALTH);
312 (void)move_player_effect(player_ptr, y, x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
318 * @brief ペットに名前をつけるコマンドのメインルーチン
320 static void do_name_pet(PlayerType *player_ptr)
322 MonsterEntity *m_ptr;
323 bool old_name = false;
324 bool old_target_pet = target_pet;
327 if (!target_set(player_ptr, TARGET_KILL)) {
328 target_pet = old_target_pet;
332 target_pet = old_target_pet;
334 if (player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) {
335 m_ptr = &player_ptr->current_floor_ptr->m_list[player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
337 if (!m_ptr->is_pet()) {
338 msg_print(_("そのモンスターはペットではない。", "This monster is not a pet."));
341 if (monraces_info[m_ptr->r_idx].kind_flags.has(MonsterKindType::UNIQUE)) {
342 msg_print(_("そのモンスターの名前は変えられない!", "You cannot change the name of this monster!"));
346 msg_format(_("%sに名前をつける。", "Name %s."), monster_desc(player_ptr, m_ptr, 0).data());
349 /* Start with nothing */
352 /* Use old inscription */
353 if (m_ptr->is_named()) {
354 /* Start with the old inscription */
355 angband_strcpy(out_val, m_ptr->nickname.data(), sizeof(out_val));
359 /* Get a new inscription (possibly empty) */
360 if (get_string(_("名前: ", "Name: "), out_val, 15)) {
362 /* Save the inscription */
363 m_ptr->nickname = out_val;
364 if (record_named_pet) {
365 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_NAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE).data());
368 if (record_named_pet && old_name) {
369 exe_write_diary(player_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_UNNAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE).data());
371 m_ptr->nickname.clear();
378 * @brief ペットに関するコマンドリストのメインルーチン /
379 * Issue a pet command
381 void do_cmd_pet(PlayerType *player_ptr)
385 std::string power_desc[36];
389 MonsterEntity *m_ptr;
390 auto command_idx = 0;
391 int menu_line = use_menu ? 1 : 0;
393 if (player_ptr->wild_mode) {
397 power_desc[num] = _("ペットを放す", "dismiss pets");
398 powers[num++] = PET_DISMISS;
400 auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
401 auto taget_of_pet = monraces_info[player_ptr->current_floor_ptr->m_list[player_ptr->pet_t_m_idx].ap_r_idx].name.data();
402 auto target_of_pet_appearance = is_hallucinated ? _("何か奇妙な物", "something strange") : taget_of_pet;
403 auto mes = _("ペットのターゲットを指定 (現在:%s)", "specify a target of pet (now:%s)");
404 auto target_name = player_ptr->pet_t_m_idx > 0 ? target_of_pet_appearance : _("指定なし", "nothing");
405 auto target_ask = format(mes, target_name);
406 power_desc[num] = target_ask;
407 powers[num++] = PET_TARGET;
408 power_desc[num] = _("近くにいろ", "stay close");
410 if (player_ptr->pet_follow_distance == PET_CLOSE_DIST) {
413 powers[num++] = PET_STAY_CLOSE;
414 power_desc[num] = _("ついて来い", "follow me");
416 if (player_ptr->pet_follow_distance == PET_FOLLOW_DIST) {
419 powers[num++] = PET_FOLLOW_ME;
420 power_desc[num] = _("敵を見つけて倒せ", "seek and destroy");
422 if (player_ptr->pet_follow_distance == PET_DESTROY_DIST) {
425 powers[num++] = PET_SEEK_AND_DESTROY;
426 power_desc[num] = _("少し離れていろ", "give me space");
428 if (player_ptr->pet_follow_distance == PET_SPACE_DIST) {
431 powers[num++] = PET_ALLOW_SPACE;
432 power_desc[num] = _("離れていろ", "stay away");
434 if (player_ptr->pet_follow_distance == PET_AWAY_DIST) {
437 powers[num++] = PET_STAY_AWAY;
439 if (player_ptr->pet_extra_flags & PF_OPEN_DOORS) {
440 power_desc[num] = _("ドアを開ける (現在:ON)", "pets open doors (now On)");
442 power_desc[num] = _("ドアを開ける (現在:OFF)", "pets open doors (now Off)");
444 powers[num++] = PET_OPEN_DOORS;
446 if (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
447 power_desc[num] = _("アイテムを拾う (現在:ON)", "pets pick up items (now On)");
449 power_desc[num] = _("アイテムを拾う (現在:OFF)", "pets pick up items (now Off)");
451 powers[num++] = PET_TAKE_ITEMS;
453 if (player_ptr->pet_extra_flags & PF_TELEPORT) {
454 power_desc[num] = _("テレポート系魔法を使う (現在:ON)", "allow teleport (now On)");
456 power_desc[num] = _("テレポート系魔法を使う (現在:OFF)", "allow teleport (now Off)");
458 powers[num++] = PET_TELEPORT;
460 if (player_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
461 power_desc[num] = _("攻撃魔法を使う (現在:ON)", "allow cast attack spell (now On)");
463 power_desc[num] = _("攻撃魔法を使う (現在:OFF)", "allow cast attack spell (now Off)");
465 powers[num++] = PET_ATTACK_SPELL;
467 if (player_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
468 power_desc[num] = _("召喚魔法を使う (現在:ON)", "allow cast summon spell (now On)");
470 power_desc[num] = _("召喚魔法を使う (現在:OFF)", "allow cast summon spell (now Off)");
472 powers[num++] = PET_SUMMON_SPELL;
474 if (player_ptr->pet_extra_flags & PF_BALL_SPELL) {
475 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:ON)", "allow involve player in area spell (now On)");
477 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:OFF)", "allow involve player in area spell (now Off)");
479 powers[num++] = PET_BALL_SPELL;
481 if (player_ptr->riding) {
482 power_desc[num] = _("ペットから降りる", "get off a pet");
484 power_desc[num] = _("ペットに乗る", "ride a pet");
486 powers[num++] = PET_RIDING;
487 power_desc[num] = _("ペットに名前をつける", "name pets");
488 powers[num++] = PET_NAME;
490 bool empty_main = can_attack_with_main_hand(player_ptr);
491 empty_main &= empty_hands(player_ptr, false) == EMPTY_HAND_SUB;
492 empty_main &= player_ptr->inventory_list[INVEN_MAIN_HAND].allow_two_hands_wielding();
494 bool empty_sub = can_attack_with_sub_hand(player_ptr);
495 empty_sub &= empty_hands(player_ptr, false) == EMPTY_HAND_MAIN;
496 empty_sub &= player_ptr->inventory_list[INVEN_SUB_HAND].allow_two_hands_wielding();
498 if (player_ptr->riding) {
499 if (empty_main || empty_sub) {
500 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
501 power_desc[num] = _("武器を片手で持つ", "use one hand to control the pet you are riding");
503 power_desc[num] = _("武器を両手で持つ", "use both hands for a weapon");
506 powers[num++] = PET_TWO_HANDS;
508 switch (player_ptr->pclass) {
509 case PlayerClassType::MONK:
510 case PlayerClassType::FORCETRAINER:
511 case PlayerClassType::BERSERKER: {
512 if (empty_hands(player_ptr, false) == (EMPTY_HAND_MAIN | EMPTY_HAND_SUB)) {
513 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
514 power_desc[num] = _("片手で格闘する", "use one hand to control the pet you are riding");
516 power_desc[num] = _("両手で格闘する", "use both hands for melee");
519 powers[num++] = PET_TWO_HANDS;
523 auto has_any_melee_weapon = has_melee_weapon(player_ptr, INVEN_MAIN_HAND);
524 has_any_melee_weapon |= has_melee_weapon(player_ptr, INVEN_SUB_HAND);
525 if ((empty_hands(player_ptr, false) != EMPTY_HAND_NONE) && !has_any_melee_weapon) {
526 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
527 power_desc[num] = _("格闘を行わない", "use one hand to control the pet you are riding");
529 power_desc[num] = _("格闘を行う", "use one hand for melee");
532 powers[num++] = PET_TWO_HANDS;
544 if (!(repeat_pull(&i) && (i >= 0) && (i < num))) {
551 prompt = _("(コマンド、ESC=終了) コマンドを選んでください:", "(Command, ESC=exit) Choose command from menu.");
553 prompt = format(_("(コマンド %c-%c、'*'=一覧、ESC=終了) コマンドを選んでください:", "(Command %c-%c, *=List, ESC=exit) Select a command: "),
554 I2A(0), I2A(num - 1));
557 choice = (always_show_list || use_menu) ? ESCAPE : 1;
559 /* Get a command from the user */
561 if (choice == ESCAPE) {
563 } else if (!get_com(prompt.data(), &choice, true)) {
567 auto should_redraw_cursor = true;
568 if (use_menu && (choice != ' ')) {
577 menu_line += (num - 1);
603 should_redraw_cursor = false;
606 if (menu_line > num) {
612 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && should_redraw_cursor)) {
614 if (!redraw || use_menu) {
625 for (control = 0; control < num; control++) {
626 /* Letter/number for power selection */
627 std::stringstream ss;
629 ss << format("%c%s ", (control == command_idx) ? '*' : ' ', (control == (menu_line - 1)) ? _("》", "> ") : " ");
631 ss << format("%c%c) ", (control == command_idx) ? '*' : ' ', I2A(control));
634 ss << power_desc[control];
635 prt(ss.str().data(), y + control, x);
638 prt("", y + std::min(control, 17), x);
656 /* Totally Illegal */
657 if ((i < 0) || (i >= num)) {
669 /* Abort if needed */
671 PlayerEnergy(player_ptr).reset_player_turn();
678 case PET_DISMISS: /* Dismiss pets */
680 /* Check pets (backwards) */
681 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
682 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
683 if (m_ref.is_pet()) {
689 msg_print(_("ペットがいない!", "You have no pets!"));
692 do_cmd_pet_dismiss(player_ptr);
693 (void)calculate_upkeep(player_ptr);
698 if (!target_set(player_ptr, TARGET_KILL)) {
699 player_ptr->pet_t_m_idx = 0;
701 auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[target_row][target_col];
702 if (g_ptr->m_idx && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
703 player_ptr->pet_t_m_idx = player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
704 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
706 player_ptr->pet_t_m_idx = 0;
714 case PET_STAY_CLOSE: {
715 player_ptr->pet_follow_distance = PET_CLOSE_DIST;
716 player_ptr->pet_t_m_idx = 0;
720 case PET_FOLLOW_ME: {
721 player_ptr->pet_follow_distance = PET_FOLLOW_DIST;
722 player_ptr->pet_t_m_idx = 0;
725 /* "Seek and destoy" */
726 case PET_SEEK_AND_DESTROY: {
727 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
730 /* "Give me space" */
731 case PET_ALLOW_SPACE: {
732 player_ptr->pet_follow_distance = PET_SPACE_DIST;
736 case PET_STAY_AWAY: {
737 player_ptr->pet_follow_distance = PET_AWAY_DIST;
740 /* flag - allow pets to open doors */
741 case PET_OPEN_DOORS: {
742 if (player_ptr->pet_extra_flags & PF_OPEN_DOORS) {
743 player_ptr->pet_extra_flags &= ~(PF_OPEN_DOORS);
745 player_ptr->pet_extra_flags |= (PF_OPEN_DOORS);
749 /* flag - allow pets to pickup items */
750 case PET_TAKE_ITEMS: {
751 if (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
752 player_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
753 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
754 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
755 if (m_ptr->is_pet()) {
756 monster_drop_carried_objects(player_ptr, m_ptr);
760 player_ptr->pet_extra_flags |= (PF_PICKUP_ITEMS);
765 /* flag - allow pets to teleport */
767 if (player_ptr->pet_extra_flags & PF_TELEPORT) {
768 player_ptr->pet_extra_flags &= ~(PF_TELEPORT);
770 player_ptr->pet_extra_flags |= (PF_TELEPORT);
774 /* flag - allow pets to cast attack spell */
775 case PET_ATTACK_SPELL: {
776 if (player_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
777 player_ptr->pet_extra_flags &= ~(PF_ATTACK_SPELL);
779 player_ptr->pet_extra_flags |= (PF_ATTACK_SPELL);
783 /* flag - allow pets to cast attack spell */
784 case PET_SUMMON_SPELL: {
785 if (player_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
786 player_ptr->pet_extra_flags &= ~(PF_SUMMON_SPELL);
788 player_ptr->pet_extra_flags |= (PF_SUMMON_SPELL);
792 /* flag - allow pets to cast attack spell */
793 case PET_BALL_SPELL: {
794 if (player_ptr->pet_extra_flags & PF_BALL_SPELL) {
795 player_ptr->pet_extra_flags &= ~(PF_BALL_SPELL);
797 player_ptr->pet_extra_flags |= (PF_BALL_SPELL);
803 (void)do_cmd_riding(player_ptr, false);
808 do_name_pet(player_ptr);
812 case PET_TWO_HANDS: {
813 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
814 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
816 player_ptr->pet_extra_flags |= (PF_TWO_HANDS);
819 RedrawingFlagsUpdater::get_instance().set_flag(StatusRedrawingFlag::BONUS);
820 handle_stuff(player_ptr);