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/stuff-handler.h"
7 #include "core/window-redrawer.h"
8 #include "effect/spells-effect-util.h"
9 #include "floor/geometry.h"
10 #include "floor/pattern-walk.h"
11 #include "game-option/input-options.h"
12 #include "game-option/map-screen-options.h"
13 #include "game-option/play-record-options.h"
14 #include "game-option/text-display-options.h"
15 #include "grid/grid.h"
16 #include "inventory/inventory-slot-types.h"
17 #include "io/command-repeater.h"
18 #include "io/cursor.h"
19 #include "io/input-key-acceptor.h"
20 #include "io/input-key-requester.h"
21 #include "io/write-diary.h"
22 #include "main/sound-of-music.h"
23 #include "monster-floor/monster-object.h"
24 #include "monster-floor/monster-remover.h"
25 #include "monster-race/monster-race.h"
26 #include "monster-race/race-flags1.h"
27 #include "monster-race/race-flags7.h"
28 #include "monster/monster-describer.h"
29 #include "monster/monster-description-types.h"
30 #include "monster/monster-info.h"
31 #include "monster/monster-status-setter.h"
32 #include "monster/monster-status.h"
33 #include "monster/smart-learn-types.h"
34 #include "object-hook/hook-weapon.h"
35 #include "pet/pet-util.h"
36 #include "player-base/player-class.h"
37 #include "player-info/class-info.h"
38 #include "player-info/equipment-info.h"
39 #include "player-info/samurai-data-type.h"
40 #include "player-status/player-energy.h"
41 #include "player-status/player-hand-types.h"
42 #include "player/attack-defense-types.h"
43 #include "player/player-damage.h"
44 #include "player/player-move.h"
45 #include "player/player-skill.h"
46 #include "player/player-status-flags.h"
47 #include "player/special-defense-types.h"
48 #include "status/action-setter.h"
49 #include "system/floor-type-definition.h"
50 #include "system/grid-type-definition.h"
51 #include "system/item-entity.h"
52 #include "system/monster-entity.h"
53 #include "system/monster-race-info.h"
54 #include "system/player-type-definition.h"
55 #include "system/redrawing-flags-updater.h"
56 #include "system/terrain-type-definition.h"
57 #include "target/target-checker.h"
58 #include "target/target-getter.h"
59 #include "target/target-setter.h"
60 #include "target/target-types.h"
61 #include "term/screen-processor.h"
62 #include "timed-effect/player-hallucination.h"
63 #include "timed-effect/timed-effects.h"
64 #include "util/bit-flags-calculator.h"
65 #include "util/int-char-converter.h"
66 #include "util/sort.h"
67 #include "util/string-processor.h"
68 #include "view/display-messages.h"
69 #include "world/world.h"
73 * @brief ペットを開放するコマンドのメインルーチン
75 void do_cmd_pet_dismiss(PlayerType *player_ptr)
78 bool all_pets = false;
84 cu = game_term->scr->cu;
85 cv = game_term->scr->cv;
86 game_term->scr->cu = 0;
87 game_term->scr->cv = 1;
89 /* Allocate the "who" array */
90 std::vector<MONSTER_IDX> who;
92 /* Process the monsters (backwards) */
93 for (MONSTER_IDX pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
94 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
96 who.push_back(pet_ctr);
100 ang_sort(player_ptr, who.data(), &dummy_why, who.size(), ang_sort_comp_pet_dismiss, ang_sort_swap_hook);
102 /* Process the monsters (backwards) */
103 auto &rfu = RedrawingFlagsUpdater::get_instance();
104 for (auto i = 0U; i < who.size(); i++) {
105 auto pet_ctr = who[i];
106 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
108 auto delete_this = false;
109 auto should_ask = (pet_ctr == player_ptr->riding) || m_ptr->is_named();
110 const auto friend_name = monster_desc(player_ptr, m_ptr, MD_ASSUME_VISIBLE);
113 /* Hack -- health bar for this monster */
114 health_track(player_ptr, pet_ctr);
115 handle_stuff(player_ptr);
116 constexpr auto mes = _("%sを放しますか? [Yes/No/Unnamed (%lu体)]", "Dismiss %s? [Yes/No/Unnamed (%lu remain)]");
117 msg_format(mes, friend_name.data(), who.size() - i);
120 move_cursor_relative(m_ptr->fy, m_ptr->fx);
126 if (ch == 'Y' || ch == 'y') {
130 msg_format(_("本当によろしいですか? (%s) ", "Are you sure? (%s) "), friend_name.data());
132 if (ch != 'Y' && ch != 'y') {
139 if (ch == 'U' || ch == 'u') {
144 if (ch == ESCAPE || ch == 'N' || ch == 'n') {
152 if ((all_pets && !should_ask) || (!all_pets && delete_this)) {
153 if (record_named_pet && m_ptr->is_named()) {
154 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
155 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
158 if (pet_ctr == player_ptr->riding) {
159 msg_format(_("%sから降りた。", "You dismount from %s. "), friend_name.data());
161 player_ptr->riding = 0;
162 rfu.set_flag(StatusRecalculatingFlag::MONSTER_STATUSES);
163 static constexpr auto flags = {
164 MainWindowRedrawingFlag::EXTRA,
165 MainWindowRedrawingFlag::UHEALTH,
167 rfu.set_flags(flags);
170 msg_format(_("%s を放した。", "Dismissed %s."), friend_name.data());
171 rfu.set_flag(StatusRecalculatingFlag::BONUS);
172 rfu.set_flag(SubWindowRedrawingFlag::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)
203 if (!get_direction(player_ptr, &dir)) {
207 const Pos2D pos(player_ptr->y + ddy[dir], player_ptr->x + ddx[dir]);
208 auto &grid = player_ptr->current_floor_ptr->get_grid(pos);
210 PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
212 if (player_ptr->riding) {
213 /* Skip non-empty grids */
214 if (!can_player_ride_pet(player_ptr, &grid, false)) {
215 msg_print(_("そちらには降りられません。", "You cannot go that direction."));
219 if (!pattern_seq(player_ptr, pos)) {
224 PlayerEnergy(player_ptr).set_player_turn_energy(100);
226 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
228 do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
232 player_ptr->riding = 0;
233 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
234 player_ptr->riding_ryoute = player_ptr->old_riding_ryoute = false;
236 if (cmd_limit_confused(player_ptr)) {
240 const auto *m_ptr = &player_ptr->current_floor_ptr->m_list[grid.m_idx];
242 if (!grid.m_idx || !m_ptr->ml) {
243 msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
246 if (!m_ptr->is_pet() && !force) {
247 msg_print(_("そのモンスターはペットではありません。", "That monster is not a pet."));
250 if (!(m_ptr->get_monrace().flags7 & RF7_RIDING)) {
251 msg_print(_("そのモンスターには乗れなさそうだ。", "This monster doesn't seem suitable for riding."));
255 if (!pattern_seq(player_ptr, pos)) {
259 if (!can_player_ride_pet(player_ptr, &grid, true)) {
260 /* Feature code (applying "mimic" field) */
261 const auto &terrain = grid.get_terrain_mimic();
262 using Tc = TerrainCharacteristics;
264 msg_format("そのモンスターは%sの%sにいる。", terrain.name.data(),
265 (terrain.flags.has_none_of({ Tc::MOVE, Tc::CAN_FLY }) || terrain.flags.has_none_of({ Tc::LOS, Tc::TREE })) ? "中" : "上");
267 msg_format("This monster is %s the %s.",
268 (terrain.flags.has_none_of({ Tc::MOVE, Tc::CAN_FLY }) || terrain.flags.has_none_of({ Tc::LOS, Tc::TREE })) ? "in" : "on", terrain.name.data());
273 if (m_ptr->get_monrace().level > randint1((player_ptr->skill_exp[PlayerSkillKindType::RIDING] / 50 + player_ptr->lev / 2 + 20))) {
274 msg_print(_("うまく乗れなかった。", "You failed to ride."));
275 PlayerEnergy(player_ptr).set_player_turn_energy(100);
279 if (m_ptr->is_asleep()) {
280 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
281 (void)set_monster_csleep(player_ptr, grid.m_idx, 0);
282 msg_format(_("%sを起こした。", "You have woken %s up."), m_name.data());
285 if (player_ptr->action == ACTION_MONK_STANCE) {
286 set_action(player_ptr, ACTION_NONE);
289 player_ptr->riding = grid.m_idx;
291 /* Hack -- remove tracked monster */
292 if (player_ptr->riding == player_ptr->health_who) {
293 health_track(player_ptr, 0);
297 PlayerEnergy(player_ptr).set_player_turn_energy(100);
299 auto &rfu = RedrawingFlagsUpdater::get_instance();
300 static constexpr auto flags_srf = {
301 StatusRecalculatingFlag::UN_VIEW,
302 StatusRecalculatingFlag::UN_LITE,
303 StatusRecalculatingFlag::BONUS,
305 rfu.set_flags(flags_srf);
306 static constexpr auto flags_mwrf = {
307 MainWindowRedrawingFlag::MAP,
308 MainWindowRedrawingFlag::EXTRA,
309 MainWindowRedrawingFlag::UHEALTH,
311 rfu.set_flags(flags_mwrf);
312 (void)move_player_effect(player_ptr, pos.y, pos.x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
317 * @brief ペットに名前をつけるコマンドのメインルーチン
319 static void do_name_pet(PlayerType *player_ptr)
321 auto old_target_pet = target_pet;
323 if (!target_set(player_ptr, TARGET_KILL)) {
324 target_pet = old_target_pet;
328 target_pet = old_target_pet;
329 auto &floor = *player_ptr->current_floor_ptr;
330 const auto &grid = floor.grid_array[target_row][target_col];
331 if (grid.m_idx == 0) {
335 auto *m_ptr = &floor.m_list[grid.m_idx];
336 if (!m_ptr->is_pet()) {
337 msg_print(_("そのモンスターはペットではない。", "This monster is not a pet."));
341 if (m_ptr->get_monrace().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 auto old_name = false;
350 std::string initial_name("");
351 if (m_ptr->is_named()) {
352 initial_name = m_ptr->nickname;
356 const auto new_name = input_string(_("名前: ", "Name: "), 15, initial_name);
361 if (!new_name->empty()) {
362 m_ptr->nickname = *new_name;
363 if (record_named_pet) {
364 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_NAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
370 if (record_named_pet && old_name) {
371 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_UNNAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
374 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 constexpr auto fmt = _("(コマンド %c-%c、'*'=一覧、ESC=終了) コマンドを選んでください:",
554 "(Command %c-%c, *=List, ESC=exit) Select a command: ");
555 prompt = format(fmt, 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) {
565 const auto new_choice = input_command(prompt, true);
570 choice = *new_choice;
573 auto should_redraw_cursor = true;
574 if (use_menu && (choice != ' ')) {
583 menu_line += (num - 1);
609 should_redraw_cursor = false;
612 if (menu_line > num) {
618 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && should_redraw_cursor)) {
620 if (!redraw || use_menu) {
631 for (control = 0; control < num; control++) {
632 /* Letter/number for power selection */
633 std::stringstream ss;
635 ss << format("%c%s ", (control == command_idx) ? '*' : ' ', (control == (menu_line - 1)) ? _("》", "> ") : " ");
637 ss << format("%c%c) ", (control == command_idx) ? '*' : ' ', I2A(control));
640 ss << power_desc[control];
641 prt(ss.str(), y + control, x);
644 prt("", y + std::min(control, 17), x);
662 /* Totally Illegal */
663 if ((i < 0) || (i >= num)) {
675 /* Abort if needed */
677 PlayerEnergy(player_ptr).reset_player_turn();
684 case PET_DISMISS: /* Dismiss pets */
686 /* Check pets (backwards) */
687 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
688 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
689 if (m_ref.is_pet()) {
695 msg_print(_("ペットがいない!", "You have no pets!"));
698 do_cmd_pet_dismiss(player_ptr);
699 (void)calculate_upkeep(player_ptr);
704 if (!target_set(player_ptr, TARGET_KILL)) {
705 player_ptr->pet_t_m_idx = 0;
707 auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[target_row][target_col];
708 if (g_ptr->m_idx && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
709 player_ptr->pet_t_m_idx = player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
710 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
712 player_ptr->pet_t_m_idx = 0;
720 case PET_STAY_CLOSE: {
721 player_ptr->pet_follow_distance = PET_CLOSE_DIST;
722 player_ptr->pet_t_m_idx = 0;
726 case PET_FOLLOW_ME: {
727 player_ptr->pet_follow_distance = PET_FOLLOW_DIST;
728 player_ptr->pet_t_m_idx = 0;
731 /* "Seek and destoy" */
732 case PET_SEEK_AND_DESTROY: {
733 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
736 /* "Give me space" */
737 case PET_ALLOW_SPACE: {
738 player_ptr->pet_follow_distance = PET_SPACE_DIST;
742 case PET_STAY_AWAY: {
743 player_ptr->pet_follow_distance = PET_AWAY_DIST;
746 /* flag - allow pets to open doors */
747 case PET_OPEN_DOORS: {
748 if (player_ptr->pet_extra_flags & PF_OPEN_DOORS) {
749 player_ptr->pet_extra_flags &= ~(PF_OPEN_DOORS);
751 player_ptr->pet_extra_flags |= (PF_OPEN_DOORS);
755 /* flag - allow pets to pickup items */
756 case PET_TAKE_ITEMS: {
757 if (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
758 player_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
759 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
760 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
761 if (m_ptr->is_pet()) {
762 monster_drop_carried_objects(player_ptr, m_ptr);
766 player_ptr->pet_extra_flags |= (PF_PICKUP_ITEMS);
771 /* flag - allow pets to teleport */
773 if (player_ptr->pet_extra_flags & PF_TELEPORT) {
774 player_ptr->pet_extra_flags &= ~(PF_TELEPORT);
776 player_ptr->pet_extra_flags |= (PF_TELEPORT);
780 /* flag - allow pets to cast attack spell */
781 case PET_ATTACK_SPELL: {
782 if (player_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
783 player_ptr->pet_extra_flags &= ~(PF_ATTACK_SPELL);
785 player_ptr->pet_extra_flags |= (PF_ATTACK_SPELL);
789 /* flag - allow pets to cast attack spell */
790 case PET_SUMMON_SPELL: {
791 if (player_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
792 player_ptr->pet_extra_flags &= ~(PF_SUMMON_SPELL);
794 player_ptr->pet_extra_flags |= (PF_SUMMON_SPELL);
798 /* flag - allow pets to cast attack spell */
799 case PET_BALL_SPELL: {
800 if (player_ptr->pet_extra_flags & PF_BALL_SPELL) {
801 player_ptr->pet_extra_flags &= ~(PF_BALL_SPELL);
803 player_ptr->pet_extra_flags |= (PF_BALL_SPELL);
809 (void)do_cmd_riding(player_ptr, false);
814 do_name_pet(player_ptr);
818 case PET_TWO_HANDS: {
819 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
820 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
822 player_ptr->pet_extra_flags |= (PF_TWO_HANDS);
825 RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::BONUS);
826 handle_stuff(player_ptr);