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/monster-describer.h"
27 #include "monster/monster-description-types.h"
28 #include "monster/monster-info.h"
29 #include "monster/monster-status-setter.h"
30 #include "monster/monster-status.h"
31 #include "monster/smart-learn-types.h"
32 #include "object-hook/hook-weapon.h"
33 #include "pet/pet-util.h"
34 #include "player-base/player-class.h"
35 #include "player-info/class-info.h"
36 #include "player-info/equipment-info.h"
37 #include "player-info/samurai-data-type.h"
38 #include "player-status/player-energy.h"
39 #include "player-status/player-hand-types.h"
40 #include "player/attack-defense-types.h"
41 #include "player/player-damage.h"
42 #include "player/player-move.h"
43 #include "player/player-skill.h"
44 #include "player/player-status-flags.h"
45 #include "player/special-defense-types.h"
46 #include "status/action-setter.h"
47 #include "system/floor-type-definition.h"
48 #include "system/grid-type-definition.h"
49 #include "system/item-entity.h"
50 #include "system/monster-entity.h"
51 #include "system/monster-race-info.h"
52 #include "system/player-type-definition.h"
53 #include "system/redrawing-flags-updater.h"
54 #include "system/terrain-type-definition.h"
55 #include "target/target-checker.h"
56 #include "target/target-getter.h"
57 #include "target/target-setter.h"
58 #include "target/target-types.h"
59 #include "term/screen-processor.h"
60 #include "timed-effect/player-hallucination.h"
61 #include "timed-effect/timed-effects.h"
62 #include "util/bit-flags-calculator.h"
63 #include "util/int-char-converter.h"
64 #include "util/sort.h"
65 #include "util/string-processor.h"
66 #include "view/display-messages.h"
67 #include "world/world.h"
71 * @brief ペットを開放するコマンドのメインルーチン
73 void do_cmd_pet_dismiss(PlayerType *player_ptr)
76 bool all_pets = false;
82 cu = game_term->scr->cu;
83 cv = game_term->scr->cv;
84 game_term->scr->cu = 0;
85 game_term->scr->cv = 1;
87 /* Allocate the "who" array */
88 std::vector<MONSTER_IDX> who;
90 /* Process the monsters (backwards) */
91 for (MONSTER_IDX pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
92 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
94 who.push_back(pet_ctr);
98 ang_sort(player_ptr, who.data(), &dummy_why, who.size(), ang_sort_comp_pet_dismiss, ang_sort_swap_hook);
100 /* Process the monsters (backwards) */
101 auto &rfu = RedrawingFlagsUpdater::get_instance();
102 for (auto i = 0U; i < who.size(); i++) {
103 auto pet_ctr = who[i];
104 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
106 auto delete_this = false;
107 auto should_ask = (pet_ctr == player_ptr->riding) || m_ptr->is_named();
108 const auto friend_name = monster_desc(player_ptr, m_ptr, MD_ASSUME_VISIBLE);
111 /* Hack -- health bar for this monster */
112 health_track(player_ptr, pet_ctr);
113 handle_stuff(player_ptr);
114 constexpr auto mes = _("%sを放しますか? [Yes/No/Unnamed (%lu体)]", "Dismiss %s? [Yes/No/Unnamed (%lu remain)]");
115 msg_format(mes, friend_name.data(), who.size() - i);
118 move_cursor_relative(m_ptr->fy, m_ptr->fx);
124 if (ch == 'Y' || ch == 'y') {
128 msg_format(_("本当によろしいですか? (%s) ", "Are you sure? (%s) "), friend_name.data());
130 if (ch != 'Y' && ch != 'y') {
137 if (ch == 'U' || ch == 'u') {
142 if (ch == ESCAPE || ch == 'N' || ch == 'n') {
150 if ((all_pets && !should_ask) || (!all_pets && delete_this)) {
151 if (record_named_pet && m_ptr->is_named()) {
152 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
153 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
156 if (pet_ctr == player_ptr->riding) {
157 msg_format(_("%sから降りた。", "You dismount from %s. "), friend_name.data());
159 player_ptr->riding = 0;
160 rfu.set_flag(StatusRecalculatingFlag::MONSTER_STATUSES);
161 static constexpr auto flags = {
162 MainWindowRedrawingFlag::EXTRA,
163 MainWindowRedrawingFlag::UHEALTH,
165 rfu.set_flags(flags);
168 msg_format(_("%s を放した。", "Dismissed %s."), friend_name.data());
169 rfu.set_flag(StatusRecalculatingFlag::BONUS);
170 rfu.set_flag(SubWindowRedrawingFlag::MESSAGE);
172 delete_monster_idx(player_ptr, pet_ctr);
177 game_term->scr->cu = cu;
178 game_term->scr->cv = cv;
182 msg_format("%d 体のペットを放しました。", Dismissed);
184 msg_format("You have dismissed %d pet%s.", Dismissed, (Dismissed == 1 ? "" : "s"));
186 if (Dismissed == 0 && all_pets) {
187 msg_print(_("'U'nnamed は、乗馬以外の名前のないペットだけを全て解放します。", "'U'nnamed means all your pets except named pets and your mount."));
190 handle_stuff(player_ptr);
194 * @brief ペットから騎乗/下馬するコマンドのメインルーチン /
195 * @param force 強制的に騎乗/下馬するならばTRUE
196 * @return 騎乗/下馬できたらTRUE
198 bool do_cmd_riding(PlayerType *player_ptr, bool force)
201 if (!get_direction(player_ptr, &dir)) {
205 const Pos2D pos(player_ptr->y + ddy[dir], player_ptr->x + ddx[dir]);
206 auto &grid = player_ptr->current_floor_ptr->get_grid(pos);
208 PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
210 if (player_ptr->riding) {
211 /* Skip non-empty grids */
212 if (!can_player_ride_pet(player_ptr, &grid, false)) {
213 msg_print(_("そちらには降りられません。", "You cannot go that direction."));
217 if (!pattern_seq(player_ptr, pos)) {
222 PlayerEnergy(player_ptr).set_player_turn_energy(100);
224 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
226 do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
230 player_ptr->riding = 0;
231 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
232 player_ptr->riding_ryoute = player_ptr->old_riding_ryoute = false;
234 if (cmd_limit_confused(player_ptr)) {
238 const auto *m_ptr = &player_ptr->current_floor_ptr->m_list[grid.m_idx];
240 if (!grid.m_idx || !m_ptr->ml) {
241 msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
244 if (!m_ptr->is_pet() && !force) {
245 msg_print(_("そのモンスターはペットではありません。", "That monster is not a pet."));
248 if (m_ptr->get_monrace().misc_flags.has_not(MonsterMiscType::RIDING)) {
249 msg_print(_("そのモンスターには乗れなさそうだ。", "This monster doesn't seem suitable for riding."));
253 if (!pattern_seq(player_ptr, pos)) {
257 if (!can_player_ride_pet(player_ptr, &grid, true)) {
258 /* Feature code (applying "mimic" field) */
259 const auto &terrain = grid.get_terrain_mimic();
260 using Tc = TerrainCharacteristics;
262 msg_format("そのモンスターは%sの%sにいる。", terrain.name.data(),
263 (terrain.flags.has_none_of({ Tc::MOVE, Tc::CAN_FLY }) || terrain.flags.has_none_of({ Tc::LOS, Tc::TREE })) ? "中" : "上");
265 msg_format("This monster is %s the %s.",
266 (terrain.flags.has_none_of({ Tc::MOVE, Tc::CAN_FLY }) || terrain.flags.has_none_of({ Tc::LOS, Tc::TREE })) ? "in" : "on", terrain.name.data());
271 if (m_ptr->get_monrace().level > randint1((player_ptr->skill_exp[PlayerSkillKindType::RIDING] / 50 + player_ptr->lev / 2 + 20))) {
272 msg_print(_("うまく乗れなかった。", "You failed to ride."));
273 PlayerEnergy(player_ptr).set_player_turn_energy(100);
277 if (m_ptr->is_asleep()) {
278 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
279 (void)set_monster_csleep(player_ptr, grid.m_idx, 0);
280 msg_format(_("%sを起こした。", "You have woken %s up."), m_name.data());
283 if (player_ptr->action == ACTION_MONK_STANCE) {
284 set_action(player_ptr, ACTION_NONE);
287 player_ptr->riding = grid.m_idx;
289 /* Hack -- remove tracked monster */
290 if (player_ptr->riding == player_ptr->health_who) {
291 health_track(player_ptr, 0);
295 PlayerEnergy(player_ptr).set_player_turn_energy(100);
297 auto &rfu = RedrawingFlagsUpdater::get_instance();
298 static constexpr auto flags_srf = {
299 StatusRecalculatingFlag::UN_VIEW,
300 StatusRecalculatingFlag::UN_LITE,
301 StatusRecalculatingFlag::BONUS,
303 rfu.set_flags(flags_srf);
304 static constexpr auto flags_mwrf = {
305 MainWindowRedrawingFlag::MAP,
306 MainWindowRedrawingFlag::EXTRA,
307 MainWindowRedrawingFlag::UHEALTH,
309 rfu.set_flags(flags_mwrf);
310 (void)move_player_effect(player_ptr, pos.y, pos.x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
315 * @brief ペットに名前をつけるコマンドのメインルーチン
317 static void do_name_pet(PlayerType *player_ptr)
319 auto old_target_pet = target_pet;
321 if (!target_set(player_ptr, TARGET_KILL)) {
322 target_pet = old_target_pet;
326 target_pet = old_target_pet;
327 auto &floor = *player_ptr->current_floor_ptr;
328 const auto &grid = floor.grid_array[target_row][target_col];
329 if (grid.m_idx == 0) {
333 auto *m_ptr = &floor.m_list[grid.m_idx];
334 if (!m_ptr->is_pet()) {
335 msg_print(_("そのモンスターはペットではない。", "This monster is not a pet."));
339 if (m_ptr->get_monrace().kind_flags.has(MonsterKindType::UNIQUE)) {
340 msg_print(_("そのモンスターの名前は変えられない!", "You cannot change the name of this monster!"));
344 msg_format(_("%sに名前をつける。", "Name %s."), monster_desc(player_ptr, m_ptr, 0).data());
347 auto old_name = false;
348 std::string initial_name("");
349 if (m_ptr->is_named()) {
350 initial_name = m_ptr->nickname;
354 const auto new_name = input_string(_("名前: ", "Name: "), 15, initial_name);
359 if (!new_name->empty()) {
360 m_ptr->nickname = *new_name;
361 if (record_named_pet) {
362 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_NAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
368 if (record_named_pet && old_name) {
369 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_UNNAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
372 m_ptr->nickname.clear();
376 * @brief ペットに関するコマンドリストのメインルーチン /
377 * Issue a pet command
379 void do_cmd_pet(PlayerType *player_ptr)
383 std::string power_desc[36];
387 MonsterEntity *m_ptr;
388 auto command_idx = 0;
389 int menu_line = use_menu ? 1 : 0;
391 if (player_ptr->wild_mode) {
395 power_desc[num] = _("ペットを放す", "dismiss pets");
396 powers[num++] = PET_DISMISS;
398 auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
399 auto taget_of_pet = monraces_info[player_ptr->current_floor_ptr->m_list[player_ptr->pet_t_m_idx].ap_r_idx].name.data();
400 auto target_of_pet_appearance = is_hallucinated ? _("何か奇妙な物", "something strange") : taget_of_pet;
401 auto mes = _("ペットのターゲットを指定 (現在:%s)", "specify a target of pet (now:%s)");
402 auto target_name = player_ptr->pet_t_m_idx > 0 ? target_of_pet_appearance : _("指定なし", "nothing");
403 auto target_ask = format(mes, target_name);
404 power_desc[num] = target_ask;
405 powers[num++] = PET_TARGET;
406 power_desc[num] = _("近くにいろ", "stay close");
408 if (player_ptr->pet_follow_distance == PET_CLOSE_DIST) {
411 powers[num++] = PET_STAY_CLOSE;
412 power_desc[num] = _("ついて来い", "follow me");
414 if (player_ptr->pet_follow_distance == PET_FOLLOW_DIST) {
417 powers[num++] = PET_FOLLOW_ME;
418 power_desc[num] = _("敵を見つけて倒せ", "seek and destroy");
420 if (player_ptr->pet_follow_distance == PET_DESTROY_DIST) {
423 powers[num++] = PET_SEEK_AND_DESTROY;
424 power_desc[num] = _("少し離れていろ", "give me space");
426 if (player_ptr->pet_follow_distance == PET_SPACE_DIST) {
429 powers[num++] = PET_ALLOW_SPACE;
430 power_desc[num] = _("離れていろ", "stay away");
432 if (player_ptr->pet_follow_distance == PET_AWAY_DIST) {
435 powers[num++] = PET_STAY_AWAY;
437 if (player_ptr->pet_extra_flags & PF_OPEN_DOORS) {
438 power_desc[num] = _("ドアを開ける (現在:ON)", "pets open doors (now On)");
440 power_desc[num] = _("ドアを開ける (現在:OFF)", "pets open doors (now Off)");
442 powers[num++] = PET_OPEN_DOORS;
444 if (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
445 power_desc[num] = _("アイテムを拾う (現在:ON)", "pets pick up items (now On)");
447 power_desc[num] = _("アイテムを拾う (現在:OFF)", "pets pick up items (now Off)");
449 powers[num++] = PET_TAKE_ITEMS;
451 if (player_ptr->pet_extra_flags & PF_TELEPORT) {
452 power_desc[num] = _("テレポート系魔法を使う (現在:ON)", "allow teleport (now On)");
454 power_desc[num] = _("テレポート系魔法を使う (現在:OFF)", "allow teleport (now Off)");
456 powers[num++] = PET_TELEPORT;
458 if (player_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
459 power_desc[num] = _("攻撃魔法を使う (現在:ON)", "allow cast attack spell (now On)");
461 power_desc[num] = _("攻撃魔法を使う (現在:OFF)", "allow cast attack spell (now Off)");
463 powers[num++] = PET_ATTACK_SPELL;
465 if (player_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
466 power_desc[num] = _("召喚魔法を使う (現在:ON)", "allow cast summon spell (now On)");
468 power_desc[num] = _("召喚魔法を使う (現在:OFF)", "allow cast summon spell (now Off)");
470 powers[num++] = PET_SUMMON_SPELL;
472 if (player_ptr->pet_extra_flags & PF_BALL_SPELL) {
473 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:ON)", "allow involve player in area spell (now On)");
475 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:OFF)", "allow involve player in area spell (now Off)");
477 powers[num++] = PET_BALL_SPELL;
479 if (player_ptr->riding) {
480 power_desc[num] = _("ペットから降りる", "get off a pet");
482 power_desc[num] = _("ペットに乗る", "ride a pet");
484 powers[num++] = PET_RIDING;
485 power_desc[num] = _("ペットに名前をつける", "name pets");
486 powers[num++] = PET_NAME;
488 bool empty_main = can_attack_with_main_hand(player_ptr);
489 empty_main &= empty_hands(player_ptr, false) == EMPTY_HAND_SUB;
490 empty_main &= player_ptr->inventory_list[INVEN_MAIN_HAND].allow_two_hands_wielding();
492 bool empty_sub = can_attack_with_sub_hand(player_ptr);
493 empty_sub &= empty_hands(player_ptr, false) == EMPTY_HAND_MAIN;
494 empty_sub &= player_ptr->inventory_list[INVEN_SUB_HAND].allow_two_hands_wielding();
496 if (player_ptr->riding) {
497 if (empty_main || empty_sub) {
498 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
499 power_desc[num] = _("武器を片手で持つ", "use one hand to control the pet you are riding");
501 power_desc[num] = _("武器を両手で持つ", "use both hands for a weapon");
504 powers[num++] = PET_TWO_HANDS;
506 switch (player_ptr->pclass) {
507 case PlayerClassType::MONK:
508 case PlayerClassType::FORCETRAINER:
509 case PlayerClassType::BERSERKER: {
510 if (empty_hands(player_ptr, false) == (EMPTY_HAND_MAIN | EMPTY_HAND_SUB)) {
511 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
512 power_desc[num] = _("片手で格闘する", "use one hand to control the pet you are riding");
514 power_desc[num] = _("両手で格闘する", "use both hands for melee");
517 powers[num++] = PET_TWO_HANDS;
521 auto has_any_melee_weapon = has_melee_weapon(player_ptr, INVEN_MAIN_HAND);
522 has_any_melee_weapon |= has_melee_weapon(player_ptr, INVEN_SUB_HAND);
523 if ((empty_hands(player_ptr, false) != EMPTY_HAND_NONE) && !has_any_melee_weapon) {
524 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
525 power_desc[num] = _("格闘を行わない", "use one hand to control the pet you are riding");
527 power_desc[num] = _("格闘を行う", "use one hand for melee");
530 powers[num++] = PET_TWO_HANDS;
542 if (!(repeat_pull(&i) && (i >= 0) && (i < num))) {
549 prompt = _("(コマンド、ESC=終了) コマンドを選んでください:", "(Command, ESC=exit) Choose command from menu.");
551 constexpr auto fmt = _("(コマンド %c-%c、'*'=一覧、ESC=終了) コマンドを選んでください:",
552 "(Command %c-%c, *=List, ESC=exit) Select a command: ");
553 prompt = format(fmt, I2A(0), I2A(num - 1));
556 choice = (always_show_list || use_menu) ? ESCAPE : '\1';
558 /* Get a command from the user */
560 if (choice == ESCAPE) {
563 const auto new_choice = input_command(prompt, true);
568 choice = *new_choice;
571 auto should_redraw_cursor = true;
572 if (use_menu && (choice != ' ')) {
581 menu_line += (num - 1);
607 should_redraw_cursor = false;
610 if (menu_line > num) {
616 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && should_redraw_cursor)) {
618 if (!redraw || use_menu) {
629 for (control = 0; control < num; control++) {
630 /* Letter/number for power selection */
631 std::stringstream ss;
633 ss << format("%c%s ", (control == command_idx) ? '*' : ' ', (control == (menu_line - 1)) ? _("》", "> ") : " ");
635 ss << format("%c%c) ", (control == command_idx) ? '*' : ' ', I2A(control));
638 ss << power_desc[control];
639 prt(ss.str(), y + control, x);
642 prt("", y + std::min(control, 17), x);
660 /* Totally Illegal */
661 if ((i < 0) || (i >= num)) {
673 /* Abort if needed */
675 PlayerEnergy(player_ptr).reset_player_turn();
682 case PET_DISMISS: /* Dismiss pets */
684 /* Check pets (backwards) */
685 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
686 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
687 if (m_ref.is_pet()) {
693 msg_print(_("ペットがいない!", "You have no pets!"));
696 do_cmd_pet_dismiss(player_ptr);
697 (void)calculate_upkeep(player_ptr);
702 if (!target_set(player_ptr, TARGET_KILL)) {
703 player_ptr->pet_t_m_idx = 0;
705 auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[target_row][target_col];
706 if (g_ptr->m_idx && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
707 player_ptr->pet_t_m_idx = player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
708 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
710 player_ptr->pet_t_m_idx = 0;
718 case PET_STAY_CLOSE: {
719 player_ptr->pet_follow_distance = PET_CLOSE_DIST;
720 player_ptr->pet_t_m_idx = 0;
724 case PET_FOLLOW_ME: {
725 player_ptr->pet_follow_distance = PET_FOLLOW_DIST;
726 player_ptr->pet_t_m_idx = 0;
729 /* "Seek and destoy" */
730 case PET_SEEK_AND_DESTROY: {
731 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
734 /* "Give me space" */
735 case PET_ALLOW_SPACE: {
736 player_ptr->pet_follow_distance = PET_SPACE_DIST;
740 case PET_STAY_AWAY: {
741 player_ptr->pet_follow_distance = PET_AWAY_DIST;
744 /* flag - allow pets to open doors */
745 case PET_OPEN_DOORS: {
746 if (player_ptr->pet_extra_flags & PF_OPEN_DOORS) {
747 player_ptr->pet_extra_flags &= ~(PF_OPEN_DOORS);
749 player_ptr->pet_extra_flags |= (PF_OPEN_DOORS);
753 /* flag - allow pets to pickup items */
754 case PET_TAKE_ITEMS: {
755 if (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
756 player_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
757 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
758 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
759 if (m_ptr->is_pet()) {
760 monster_drop_carried_objects(player_ptr, m_ptr);
764 player_ptr->pet_extra_flags |= (PF_PICKUP_ITEMS);
769 /* flag - allow pets to teleport */
771 if (player_ptr->pet_extra_flags & PF_TELEPORT) {
772 player_ptr->pet_extra_flags &= ~(PF_TELEPORT);
774 player_ptr->pet_extra_flags |= (PF_TELEPORT);
778 /* flag - allow pets to cast attack spell */
779 case PET_ATTACK_SPELL: {
780 if (player_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
781 player_ptr->pet_extra_flags &= ~(PF_ATTACK_SPELL);
783 player_ptr->pet_extra_flags |= (PF_ATTACK_SPELL);
787 /* flag - allow pets to cast attack spell */
788 case PET_SUMMON_SPELL: {
789 if (player_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
790 player_ptr->pet_extra_flags &= ~(PF_SUMMON_SPELL);
792 player_ptr->pet_extra_flags |= (PF_SUMMON_SPELL);
796 /* flag - allow pets to cast attack spell */
797 case PET_BALL_SPELL: {
798 if (player_ptr->pet_extra_flags & PF_BALL_SPELL) {
799 player_ptr->pet_extra_flags &= ~(PF_BALL_SPELL);
801 player_ptr->pet_extra_flags |= (PF_BALL_SPELL);
807 (void)do_cmd_riding(player_ptr, false);
812 do_name_pet(player_ptr);
816 case PET_TWO_HANDS: {
817 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
818 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
820 player_ptr->pet_extra_flags |= (PF_TWO_HANDS);
823 RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::BONUS);
824 handle_stuff(player_ptr);