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/monster-util.h"
32 #include "monster/smart-learn-types.h"
33 #include "object-hook/hook-weapon.h"
34 #include "pet/pet-util.h"
35 #include "player-base/player-class.h"
36 #include "player-info/class-info.h"
37 #include "player-info/equipment-info.h"
38 #include "player-info/samurai-data-type.h"
39 #include "player-status/player-energy.h"
40 #include "player-status/player-hand-types.h"
41 #include "player/attack-defense-types.h"
42 #include "player/player-damage.h"
43 #include "player/player-move.h"
44 #include "player/player-skill.h"
45 #include "player/player-status-flags.h"
46 #include "player/special-defense-types.h"
47 #include "status/action-setter.h"
48 #include "system/floor-type-definition.h"
49 #include "system/grid-type-definition.h"
50 #include "system/item-entity.h"
51 #include "system/monster-entity.h"
52 #include "system/monster-race-info.h"
53 #include "system/player-type-definition.h"
54 #include "system/redrawing-flags-updater.h"
55 #include "system/terrain-type-definition.h"
56 #include "target/target-checker.h"
57 #include "target/target-getter.h"
58 #include "target/target-setter.h"
59 #include "target/target-types.h"
60 #include "term/screen-processor.h"
61 #include "timed-effect/player-hallucination.h"
62 #include "timed-effect/timed-effects.h"
63 #include "util/bit-flags-calculator.h"
64 #include "util/int-char-converter.h"
65 #include "util/sort.h"
66 #include "util/string-processor.h"
67 #include "view/display-messages.h"
68 #include "world/world.h"
72 * @brief ペットを開放するコマンドのメインルーチン
74 void do_cmd_pet_dismiss(PlayerType *player_ptr)
77 bool all_pets = false;
83 cu = game_term->scr->cu;
84 cv = game_term->scr->cv;
85 game_term->scr->cu = 0;
86 game_term->scr->cv = 1;
88 /* Allocate the "who" array */
89 std::vector<MONSTER_IDX> who;
91 /* Process the monsters (backwards) */
92 for (MONSTER_IDX pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
93 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
95 who.push_back(pet_ctr);
99 ang_sort(player_ptr, who.data(), &dummy_why, who.size(), ang_sort_comp_pet_dismiss, ang_sort_swap_hook);
101 /* Process the monsters (backwards) */
102 auto &rfu = RedrawingFlagsUpdater::get_instance();
103 for (auto i = 0U; i < who.size(); i++) {
104 auto pet_ctr = who[i];
105 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
107 auto delete_this = false;
108 auto should_ask = (pet_ctr == player_ptr->riding) || m_ptr->is_named();
109 const auto friend_name = monster_desc(player_ptr, m_ptr, MD_ASSUME_VISIBLE);
112 /* Hack -- health bar for this monster */
113 health_track(player_ptr, pet_ctr);
114 handle_stuff(player_ptr);
115 constexpr auto mes = _("%sを放しますか? [Yes/No/Unnamed (%lu体)]", "Dismiss %s? [Yes/No/Unnamed (%lu remain)]");
116 msg_format(mes, friend_name.data(), who.size() - i);
119 move_cursor_relative(m_ptr->fy, m_ptr->fx);
125 if (ch == 'Y' || ch == 'y') {
129 msg_format(_("本当によろしいですか? (%s) ", "Are you sure? (%s) "), friend_name.data());
131 if (ch != 'Y' && ch != 'y') {
138 if (ch == 'U' || ch == 'u') {
143 if (ch == ESCAPE || ch == 'N' || ch == 'n') {
151 if ((all_pets && !should_ask) || (!all_pets && delete_this)) {
152 if (record_named_pet && m_ptr->is_named()) {
153 const auto m_name = monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE);
154 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
157 if (pet_ctr == player_ptr->riding) {
158 msg_format(_("%sから降りた。", "You dismount from %s. "), friend_name.data());
160 player_ptr->riding = 0;
161 rfu.set_flag(StatusRecalculatingFlag::MONSTER_STATUSES);
162 static constexpr auto flags = {
163 MainWindowRedrawingFlag::EXTRA,
164 MainWindowRedrawingFlag::UHEALTH,
166 rfu.set_flags(flags);
169 msg_format(_("%s を放した。", "Dismissed %s."), friend_name.data());
170 rfu.set_flag(StatusRecalculatingFlag::BONUS);
171 rfu.set_flag(SubWindowRedrawingFlag::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)
202 if (!get_direction(player_ptr, &dir)) {
206 const Pos2D pos(player_ptr->y + ddy[dir], player_ptr->x + ddx[dir]);
207 auto &grid = player_ptr->current_floor_ptr->get_grid(pos);
209 PlayerClass(player_ptr).break_samurai_stance({ SamuraiStanceType::MUSOU });
211 if (player_ptr->riding) {
212 /* Skip non-empty grids */
213 if (!can_player_ride_pet(player_ptr, &grid, false)) {
214 msg_print(_("そちらには降りられません。", "You cannot go that direction."));
218 if (!pattern_seq(player_ptr, pos)) {
222 if (is_monster(grid.m_idx)) {
223 PlayerEnergy(player_ptr).set_player_turn_energy(100);
225 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
227 do_cmd_attack(player_ptr, pos.y, pos.x, HISSATSU_NONE);
231 player_ptr->riding = 0;
232 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
233 player_ptr->riding_ryoute = player_ptr->old_riding_ryoute = false;
235 if (cmd_limit_confused(player_ptr)) {
239 const auto *m_ptr = &player_ptr->current_floor_ptr->m_list[grid.m_idx];
241 if (!is_monster(grid.m_idx) || !m_ptr->ml) {
242 msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
245 if (!m_ptr->is_pet() && !force) {
246 msg_print(_("そのモンスターはペットではありません。", "That monster is not a pet."));
249 if (m_ptr->get_monrace().misc_flags.has_not(MonsterMiscType::RIDING)) {
250 msg_print(_("そのモンスターには乗れなさそうだ。", "This monster doesn't seem suitable for riding."));
254 if (!pattern_seq(player_ptr, pos)) {
258 if (!can_player_ride_pet(player_ptr, &grid, true)) {
259 /* Feature code (applying "mimic" field) */
260 const auto &terrain = grid.get_terrain_mimic();
261 using Tc = TerrainCharacteristics;
263 msg_format("そのモンスターは%sの%sにいる。", terrain.name.data(),
264 (terrain.flags.has_none_of({ Tc::MOVE, Tc::CAN_FLY }) || terrain.flags.has_none_of({ Tc::LOS, Tc::TREE })) ? "中" : "上");
266 msg_format("This monster is %s the %s.",
267 (terrain.flags.has_none_of({ Tc::MOVE, Tc::CAN_FLY }) || terrain.flags.has_none_of({ Tc::LOS, Tc::TREE })) ? "in" : "on", terrain.name.data());
272 if (m_ptr->get_monrace().level > randint1((player_ptr->skill_exp[PlayerSkillKindType::RIDING] / 50 + player_ptr->lev / 2 + 20))) {
273 msg_print(_("うまく乗れなかった。", "You failed to ride."));
274 PlayerEnergy(player_ptr).set_player_turn_energy(100);
278 if (m_ptr->is_asleep()) {
279 const auto m_name = monster_desc(player_ptr, m_ptr, 0);
280 (void)set_monster_csleep(player_ptr, grid.m_idx, 0);
281 msg_format(_("%sを起こした。", "You have woken %s up."), m_name.data());
284 if (player_ptr->action == ACTION_MONK_STANCE) {
285 set_action(player_ptr, ACTION_NONE);
288 player_ptr->riding = grid.m_idx;
290 /* Hack -- remove tracked monster */
291 if (player_ptr->riding == player_ptr->health_who) {
292 health_track(player_ptr, 0);
296 PlayerEnergy(player_ptr).set_player_turn_energy(100);
298 auto &rfu = RedrawingFlagsUpdater::get_instance();
299 static constexpr auto flags_srf = {
300 StatusRecalculatingFlag::UN_VIEW,
301 StatusRecalculatingFlag::UN_LITE,
302 StatusRecalculatingFlag::BONUS,
304 rfu.set_flags(flags_srf);
305 static constexpr auto flags_mwrf = {
306 MainWindowRedrawingFlag::MAP,
307 MainWindowRedrawingFlag::EXTRA,
308 MainWindowRedrawingFlag::UHEALTH,
310 rfu.set_flags(flags_mwrf);
311 (void)move_player_effect(player_ptr, pos.y, pos.x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
316 * @brief ペットに名前をつけるコマンドのメインルーチン
318 static void do_name_pet(PlayerType *player_ptr)
320 auto old_target_pet = target_pet;
322 if (!target_set(player_ptr, TARGET_KILL)) {
323 target_pet = old_target_pet;
327 target_pet = old_target_pet;
328 auto &floor = *player_ptr->current_floor_ptr;
329 const auto &grid = floor.grid_array[target_row][target_col];
330 if (!is_monster(grid.m_idx)) {
334 auto *m_ptr = &floor.m_list[grid.m_idx];
335 if (!m_ptr->is_pet()) {
336 msg_print(_("そのモンスターはペットではない。", "This monster is not a pet."));
340 if (m_ptr->get_monrace().kind_flags.has(MonsterKindType::UNIQUE)) {
341 msg_print(_("そのモンスターの名前は変えられない!", "You cannot change the name of this monster!"));
345 msg_format(_("%sに名前をつける。", "Name %s."), monster_desc(player_ptr, m_ptr, 0).data());
348 auto old_name = false;
349 std::string initial_name("");
350 if (m_ptr->is_named()) {
351 initial_name = m_ptr->nickname;
355 const auto new_name = input_string(_("名前: ", "Name: "), 15, initial_name);
360 if (!new_name->empty()) {
361 m_ptr->nickname = *new_name;
362 if (record_named_pet) {
363 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_NAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
369 if (record_named_pet && old_name) {
370 exe_write_diary(player_ptr, DiaryKind::NAMED_PET, RECORD_NAMED_PET_UNNAME, monster_desc(player_ptr, m_ptr, MD_INDEF_VISIBLE));
373 m_ptr->nickname.clear();
377 * @brief ペットに関するコマンドリストのメインルーチン /
378 * Issue a pet command
380 void do_cmd_pet(PlayerType *player_ptr)
384 std::string power_desc[36];
388 MonsterEntity *m_ptr;
389 auto command_idx = 0;
390 int menu_line = use_menu ? 1 : 0;
392 if (player_ptr->wild_mode) {
396 power_desc[num] = _("ペットを放す", "dismiss pets");
397 powers[num++] = PET_DISMISS;
399 auto is_hallucinated = player_ptr->effects()->hallucination()->is_hallucinated();
400 auto taget_of_pet = monraces_info[player_ptr->current_floor_ptr->m_list[player_ptr->pet_t_m_idx].ap_r_idx].name.data();
401 auto target_of_pet_appearance = is_hallucinated ? _("何か奇妙な物", "something strange") : taget_of_pet;
402 auto mes = _("ペットのターゲットを指定 (現在:%s)", "specify a target of pet (now:%s)");
403 auto target_name = player_ptr->pet_t_m_idx > 0 ? target_of_pet_appearance : _("指定なし", "nothing");
404 auto target_ask = format(mes, target_name);
405 power_desc[num] = target_ask;
406 powers[num++] = PET_TARGET;
407 power_desc[num] = _("近くにいろ", "stay close");
409 if (player_ptr->pet_follow_distance == PET_CLOSE_DIST) {
412 powers[num++] = PET_STAY_CLOSE;
413 power_desc[num] = _("ついて来い", "follow me");
415 if (player_ptr->pet_follow_distance == PET_FOLLOW_DIST) {
418 powers[num++] = PET_FOLLOW_ME;
419 power_desc[num] = _("敵を見つけて倒せ", "seek and destroy");
421 if (player_ptr->pet_follow_distance == PET_DESTROY_DIST) {
424 powers[num++] = PET_SEEK_AND_DESTROY;
425 power_desc[num] = _("少し離れていろ", "give me space");
427 if (player_ptr->pet_follow_distance == PET_SPACE_DIST) {
430 powers[num++] = PET_ALLOW_SPACE;
431 power_desc[num] = _("離れていろ", "stay away");
433 if (player_ptr->pet_follow_distance == PET_AWAY_DIST) {
436 powers[num++] = PET_STAY_AWAY;
438 if (player_ptr->pet_extra_flags & PF_OPEN_DOORS) {
439 power_desc[num] = _("ドアを開ける (現在:ON)", "pets open doors (now On)");
441 power_desc[num] = _("ドアを開ける (現在:OFF)", "pets open doors (now Off)");
443 powers[num++] = PET_OPEN_DOORS;
445 if (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
446 power_desc[num] = _("アイテムを拾う (現在:ON)", "pets pick up items (now On)");
448 power_desc[num] = _("アイテムを拾う (現在:OFF)", "pets pick up items (now Off)");
450 powers[num++] = PET_TAKE_ITEMS;
452 if (player_ptr->pet_extra_flags & PF_TELEPORT) {
453 power_desc[num] = _("テレポート系魔法を使う (現在:ON)", "allow teleport (now On)");
455 power_desc[num] = _("テレポート系魔法を使う (現在:OFF)", "allow teleport (now Off)");
457 powers[num++] = PET_TELEPORT;
459 if (player_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
460 power_desc[num] = _("攻撃魔法を使う (現在:ON)", "allow cast attack spell (now On)");
462 power_desc[num] = _("攻撃魔法を使う (現在:OFF)", "allow cast attack spell (now Off)");
464 powers[num++] = PET_ATTACK_SPELL;
466 if (player_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
467 power_desc[num] = _("召喚魔法を使う (現在:ON)", "allow cast summon spell (now On)");
469 power_desc[num] = _("召喚魔法を使う (現在:OFF)", "allow cast summon spell (now Off)");
471 powers[num++] = PET_SUMMON_SPELL;
473 if (player_ptr->pet_extra_flags & PF_BALL_SPELL) {
474 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:ON)", "allow involve player in area spell (now On)");
476 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:OFF)", "allow involve player in area spell (now Off)");
478 powers[num++] = PET_BALL_SPELL;
480 if (player_ptr->riding) {
481 power_desc[num] = _("ペットから降りる", "get off a pet");
483 power_desc[num] = _("ペットに乗る", "ride a pet");
485 powers[num++] = PET_RIDING;
486 power_desc[num] = _("ペットに名前をつける", "name pets");
487 powers[num++] = PET_NAME;
489 bool empty_main = can_attack_with_main_hand(player_ptr);
490 empty_main &= empty_hands(player_ptr, false) == EMPTY_HAND_SUB;
491 empty_main &= player_ptr->inventory_list[INVEN_MAIN_HAND].allow_two_hands_wielding();
493 bool empty_sub = can_attack_with_sub_hand(player_ptr);
494 empty_sub &= empty_hands(player_ptr, false) == EMPTY_HAND_MAIN;
495 empty_sub &= player_ptr->inventory_list[INVEN_SUB_HAND].allow_two_hands_wielding();
497 if (player_ptr->riding) {
498 if (empty_main || empty_sub) {
499 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
500 power_desc[num] = _("武器を片手で持つ", "use one hand to control the pet you are riding");
502 power_desc[num] = _("武器を両手で持つ", "use both hands for a weapon");
505 powers[num++] = PET_TWO_HANDS;
507 switch (player_ptr->pclass) {
508 case PlayerClassType::MONK:
509 case PlayerClassType::FORCETRAINER:
510 case PlayerClassType::BERSERKER: {
511 if (empty_hands(player_ptr, false) == (EMPTY_HAND_MAIN | EMPTY_HAND_SUB)) {
512 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
513 power_desc[num] = _("片手で格闘する", "use one hand to control the pet you are riding");
515 power_desc[num] = _("両手で格闘する", "use both hands for melee");
518 powers[num++] = PET_TWO_HANDS;
522 auto has_any_melee_weapon = has_melee_weapon(player_ptr, INVEN_MAIN_HAND);
523 has_any_melee_weapon |= has_melee_weapon(player_ptr, INVEN_SUB_HAND);
524 if ((empty_hands(player_ptr, false) != EMPTY_HAND_NONE) && !has_any_melee_weapon) {
525 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
526 power_desc[num] = _("格闘を行わない", "use one hand to control the pet you are riding");
528 power_desc[num] = _("格闘を行う", "use one hand for melee");
531 powers[num++] = PET_TWO_HANDS;
543 if (!(repeat_pull(&i) && (i >= 0) && (i < num))) {
550 prompt = _("(コマンド、ESC=終了) コマンドを選んでください:", "(Command, ESC=exit) Choose command from menu.");
552 constexpr auto fmt = _("(コマンド %c-%c、'*'=一覧、ESC=終了) コマンドを選んでください:",
553 "(Command %c-%c, *=List, ESC=exit) Select a command: ");
554 prompt = format(fmt, 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) {
564 const auto new_choice = input_command(prompt, true);
569 choice = *new_choice;
572 auto should_redraw_cursor = true;
573 if (use_menu && (choice != ' ')) {
582 menu_line += (num - 1);
608 should_redraw_cursor = false;
611 if (menu_line > num) {
617 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && should_redraw_cursor)) {
619 if (!redraw || use_menu) {
630 for (control = 0; control < num; control++) {
631 /* Letter/number for power selection */
632 std::stringstream ss;
634 ss << format("%c%s ", (control == command_idx) ? '*' : ' ', (control == (menu_line - 1)) ? _("》", "> ") : " ");
636 ss << format("%c%c) ", (control == command_idx) ? '*' : ' ', I2A(control));
639 ss << power_desc[control];
640 prt(ss.str(), y + control, x);
643 prt("", y + std::min(control, 17), x);
661 /* Totally Illegal */
662 if ((i < 0) || (i >= num)) {
674 /* Abort if needed */
676 PlayerEnergy(player_ptr).reset_player_turn();
683 case PET_DISMISS: /* Dismiss pets */
685 /* Check pets (backwards) */
686 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
687 const auto &m_ref = player_ptr->current_floor_ptr->m_list[pet_ctr];
688 if (m_ref.is_pet()) {
694 msg_print(_("ペットがいない!", "You have no pets!"));
697 do_cmd_pet_dismiss(player_ptr);
698 (void)calculate_upkeep(player_ptr);
703 if (!target_set(player_ptr, TARGET_KILL)) {
704 player_ptr->pet_t_m_idx = 0;
706 auto *g_ptr = &player_ptr->current_floor_ptr->grid_array[target_row][target_col];
707 if (is_monster(g_ptr->m_idx) && (player_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
708 player_ptr->pet_t_m_idx = player_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
709 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
711 player_ptr->pet_t_m_idx = 0;
719 case PET_STAY_CLOSE: {
720 player_ptr->pet_follow_distance = PET_CLOSE_DIST;
721 player_ptr->pet_t_m_idx = 0;
725 case PET_FOLLOW_ME: {
726 player_ptr->pet_follow_distance = PET_FOLLOW_DIST;
727 player_ptr->pet_t_m_idx = 0;
730 /* "Seek and destoy" */
731 case PET_SEEK_AND_DESTROY: {
732 player_ptr->pet_follow_distance = PET_DESTROY_DIST;
735 /* "Give me space" */
736 case PET_ALLOW_SPACE: {
737 player_ptr->pet_follow_distance = PET_SPACE_DIST;
741 case PET_STAY_AWAY: {
742 player_ptr->pet_follow_distance = PET_AWAY_DIST;
745 /* flag - allow pets to open doors */
746 case PET_OPEN_DOORS: {
747 if (player_ptr->pet_extra_flags & PF_OPEN_DOORS) {
748 player_ptr->pet_extra_flags &= ~(PF_OPEN_DOORS);
750 player_ptr->pet_extra_flags |= (PF_OPEN_DOORS);
754 /* flag - allow pets to pickup items */
755 case PET_TAKE_ITEMS: {
756 if (player_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
757 player_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
758 for (pet_ctr = player_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
759 m_ptr = &player_ptr->current_floor_ptr->m_list[pet_ctr];
760 if (m_ptr->is_pet()) {
761 monster_drop_carried_objects(player_ptr, m_ptr);
765 player_ptr->pet_extra_flags |= (PF_PICKUP_ITEMS);
770 /* flag - allow pets to teleport */
772 if (player_ptr->pet_extra_flags & PF_TELEPORT) {
773 player_ptr->pet_extra_flags &= ~(PF_TELEPORT);
775 player_ptr->pet_extra_flags |= (PF_TELEPORT);
779 /* flag - allow pets to cast attack spell */
780 case PET_ATTACK_SPELL: {
781 if (player_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
782 player_ptr->pet_extra_flags &= ~(PF_ATTACK_SPELL);
784 player_ptr->pet_extra_flags |= (PF_ATTACK_SPELL);
788 /* flag - allow pets to cast attack spell */
789 case PET_SUMMON_SPELL: {
790 if (player_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
791 player_ptr->pet_extra_flags &= ~(PF_SUMMON_SPELL);
793 player_ptr->pet_extra_flags |= (PF_SUMMON_SPELL);
797 /* flag - allow pets to cast attack spell */
798 case PET_BALL_SPELL: {
799 if (player_ptr->pet_extra_flags & PF_BALL_SPELL) {
800 player_ptr->pet_extra_flags &= ~(PF_BALL_SPELL);
802 player_ptr->pet_extra_flags |= (PF_BALL_SPELL);
808 (void)do_cmd_riding(player_ptr, false);
813 do_name_pet(player_ptr);
817 case PET_TWO_HANDS: {
818 if (player_ptr->pet_extra_flags & PF_TWO_HANDS) {
819 player_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
821 player_ptr->pet_extra_flags |= (PF_TWO_HANDS);
824 RedrawingFlagsUpdater::get_instance().set_flag(StatusRecalculatingFlag::BONUS);
825 handle_stuff(player_ptr);