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/feature.h"
18 #include "grid/grid.h"
19 #include "inventory/inventory-slot-types.h"
20 #include "io/command-repeater.h"
21 #include "io/cursor.h"
22 #include "io/input-key-acceptor.h"
23 #include "io/input-key-requester.h"
24 #include "io/write-diary.h"
25 #include "main/sound-of-music.h"
26 #include "monster-floor/monster-object.h"
27 #include "monster-floor/monster-remover.h"
28 #include "monster-race/monster-race.h"
29 #include "monster-race/race-flags1.h"
30 #include "monster-race/race-flags7.h"
31 #include "monster/monster-describer.h"
32 #include "monster/monster-description-types.h"
33 #include "monster/monster-info.h"
34 #include "monster/monster-status-setter.h"
35 #include "monster/monster-status.h"
36 #include "monster/smart-learn-types.h"
37 #include "object-hook/hook-weapon.h"
38 #include "pet/pet-util.h"
39 #include "player-info/equipment-info.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-class.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/monster-race-definition.h"
53 #include "system/monster-type-definition.h"
54 #include "system/object-type-definition.h"
55 #include "system/player-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 "util/bit-flags-calculator.h"
62 #include "util/int-char-converter.h"
63 #include "util/quarks.h"
64 #include "util/sort.h"
65 #include "view/display-messages.h"
66 #include "world/world.h"
69 * @brief ペットを開放するコマンドのメインルーチン
71 void do_cmd_pet_dismiss(player_type *creature_ptr)
74 bool all_pets = false;
89 /* Allocate the "who" array */
90 C_MAKE(who, current_world_ptr->max_m_idx, MONSTER_IDX);
92 /* Process the monsters (backwards) */
93 for (pet_ctr = creature_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
94 if (is_pet(&creature_ptr->current_floor_ptr->m_list[pet_ctr]))
95 who[max_pet++] = pet_ctr;
98 ang_sort(creature_ptr, who, &dummy_why, max_pet, ang_sort_comp_pet_dismiss, ang_sort_swap_hook);
100 /* Process the monsters (backwards) */
101 for (i = 0; i < max_pet; i++) {
103 GAME_TEXT friend_name[MAX_NLEN];
107 m_ptr = &creature_ptr->current_floor_ptr->m_list[pet_ctr];
110 kakunin = ((pet_ctr == creature_ptr->riding) || (m_ptr->nickname));
111 monster_desc(creature_ptr, friend_name, m_ptr, MD_ASSUME_VISIBLE);
114 /* Hack -- health bar for this monster */
115 health_track(creature_ptr, pet_ctr);
116 handle_stuff(creature_ptr);
118 msg_format(_("%sを放しますか? [Yes/No/Unnamed (%d体)]", "Dismiss %s? [Yes/No/Unnamed (%d remain)]"), friend_name, max_pet - i);
121 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);
132 if (ch != 'Y' && ch != 'y')
138 if (ch == 'U' || ch == 'u') {
143 if (ch == ESCAPE || ch == 'N' || ch == 'n')
150 if ((all_pets && !kakunin) || (!all_pets && delete_this)) {
151 if (record_named_pet && m_ptr->nickname) {
152 GAME_TEXT m_name[MAX_NLEN];
154 monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
155 exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
158 if (pet_ctr == creature_ptr->riding) {
159 msg_format(_("%sから降りた。", "You dismount from %s. "), friend_name);
161 creature_ptr->riding = 0;
163 creature_ptr->update |= (PU_MONSTERS);
164 creature_ptr->redraw |= (PR_EXTRA | PR_UHEALTH);
167 /* HACK : Add the line to message buffer */
168 msg_format(_("%s を放した。", "Dismissed %s."), friend_name);
169 creature_ptr->update |= (PU_BONUS);
170 creature_ptr->window_flags |= (PW_MESSAGE);
172 delete_monster_idx(creature_ptr, pet_ctr);
181 C_KILL(who, current_world_ptr->max_m_idx, MONSTER_IDX);
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."));
191 handle_stuff(creature_ptr);
195 * @brief ペットから騎乗/下馬するコマンドのメインルーチン /
196 * @param force 強制的に騎乗/下馬するならばTRUE
197 * @return 騎乗/下馬できたらTRUE
199 bool do_cmd_riding(player_type *creature_ptr, bool force)
206 if (!get_direction(creature_ptr, &dir, false, false))
208 y = creature_ptr->y + ddy[dir];
209 x = creature_ptr->x + ddx[dir];
210 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
212 if (creature_ptr->special_defense & KATA_MUSOU)
213 set_action(creature_ptr, ACTION_NONE);
215 if (creature_ptr->riding) {
216 /* Skip non-empty grids */
217 if (!can_player_ride_pet(creature_ptr, g_ptr, false)) {
218 msg_print(_("そちらには降りられません。", "You cannot go that direction."));
222 if (!pattern_seq(creature_ptr, creature_ptr->y, creature_ptr->x, y, x))
226 PlayerEnergy(creature_ptr).set_player_turn_energy(100);
228 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
230 do_cmd_attack(creature_ptr, y, x, HISSATSU_NONE);
234 creature_ptr->riding = 0;
235 creature_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
236 creature_ptr->riding_ryoute = creature_ptr->old_riding_ryoute = false;
238 if (cmd_limit_confused(creature_ptr))
241 m_ptr = &creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
243 if (!g_ptr->m_idx || !m_ptr->ml) {
244 msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
247 if (!is_pet(m_ptr) && !force) {
248 msg_print(_("そのモンスターはペットではありません。", "That monster is not a pet."));
251 if (!(r_info[m_ptr->r_idx].flags7 & RF7_RIDING)) {
252 msg_print(_("そのモンスターには乗れなさそうだ。", "This monster doesn't seem suitable for riding."));
256 if (!pattern_seq(creature_ptr, creature_ptr->y, creature_ptr->x, y, x))
259 if (!can_player_ride_pet(creature_ptr, g_ptr, true)) {
260 /* Feature code (applying "mimic" field) */
261 feature_type *f_ptr = &f_info[g_ptr->get_feat_mimic()];
263 msg_format("そのモンスターは%sの%sにいる。", f_ptr->name.c_str(),
264 (f_ptr->flags.has_none_of({FF::MOVE, FF::CAN_FLY})
265 || f_ptr->flags.has_none_of({FF::LOS, FF::TREE}))
269 msg_format("This monster is %s the %s.",
270 (f_ptr->flags.has_none_of({FF::MOVE, FF::CAN_FLY})
271 || f_ptr->flags.has_none_of({FF::LOS, FF::TREE}))
274 f_ptr->name.c_str());
279 if (r_info[m_ptr->r_idx].level > randint1((creature_ptr->skill_exp[SKILL_RIDING] / 50 + creature_ptr->lev / 2 + 20))) {
280 msg_print(_("うまく乗れなかった。", "You failed to ride."));
281 PlayerEnergy(creature_ptr).set_player_turn_energy(100);
285 if (monster_csleep_remaining(m_ptr)) {
286 GAME_TEXT m_name[MAX_NLEN];
287 monster_desc(creature_ptr, m_name, m_ptr, 0);
288 (void)set_monster_csleep(creature_ptr, g_ptr->m_idx, 0);
289 msg_format(_("%sを起こした。", "You have woken %s up."), m_name);
292 if (creature_ptr->action == ACTION_KAMAE)
293 set_action(creature_ptr, ACTION_NONE);
295 creature_ptr->riding = g_ptr->m_idx;
297 /* Hack -- remove tracked monster */
298 if (creature_ptr->riding == creature_ptr->health_who)
299 health_track(creature_ptr, 0);
302 PlayerEnergy(creature_ptr).set_player_turn_energy(100);
304 /* Mega-Hack -- Forget the view and lite */
305 creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
306 creature_ptr->update |= (PU_BONUS);
307 creature_ptr->redraw |= (PR_MAP | PR_EXTRA);
308 creature_ptr->redraw |= (PR_UHEALTH);
310 (void)move_player_effect(creature_ptr, y, x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
316 * @brief ペットに名前をつけるコマンドのメインルーチン
318 static void do_name_pet(player_type *creature_ptr)
322 GAME_TEXT m_name[MAX_NLEN];
323 bool old_name = false;
324 bool old_target_pet = target_pet;
327 if (!target_set(creature_ptr, TARGET_KILL)) {
328 target_pet = old_target_pet;
332 target_pet = old_target_pet;
334 if (creature_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) {
335 m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
337 if (!is_pet(m_ptr)) {
338 msg_print(_("そのモンスターはペットではない。", "This monster is not a pet."));
341 if (r_info[m_ptr->r_idx].flags1 & RF1_UNIQUE) {
342 msg_print(_("そのモンスターの名前は変えられない!", "You cannot change the name of this monster!"));
345 monster_desc(creature_ptr, m_name, m_ptr, 0);
347 msg_format(_("%sに名前をつける。", "Name %s."), m_name);
350 /* Start with nothing */
353 /* Use old inscription */
354 if (m_ptr->nickname) {
355 /* Start with the old inscription */
356 strcpy(out_val, quark_str(m_ptr->nickname));
360 /* Get a new inscription (possibly empty) */
361 if (get_string(_("名前: ", "Name: "), out_val, 15)) {
363 /* Save the inscription */
364 m_ptr->nickname = quark_add(out_val);
365 if (record_named_pet) {
366 monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
367 exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_NAME, m_name);
370 if (record_named_pet && old_name) {
371 monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
372 exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_UNNAME, m_name);
381 * @brief ペットに関するコマンドリストのメインルーチン /
382 * Issue a pet command
384 void do_cmd_pet(player_type *creature_ptr)
389 concptr power_desc[36];
396 auto command_idx = 0;
399 char target_buf[160];
401 int menu_line = use_menu ? 1 : 0;
405 if (creature_ptr->wild_mode)
408 power_desc[num] = _("ペットを放す", "dismiss pets");
409 powers[num++] = PET_DISMISS;
412 sprintf(target_buf, "ペットのターゲットを指定 (現在:%s)",
413 (creature_ptr->pet_t_m_idx
414 ? (creature_ptr->image ? "何か奇妙な物" : r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name.c_str())
417 sprintf(target_buf, "specify a target of pet (now:%s)",
418 (creature_ptr->pet_t_m_idx
419 ? (creature_ptr->image ? "something strange" : r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name.c_str())
422 power_desc[num] = target_buf;
423 powers[num++] = PET_TARGET;
424 power_desc[num] = _("近くにいろ", "stay close");
426 if (creature_ptr->pet_follow_distance == PET_CLOSE_DIST)
428 powers[num++] = PET_STAY_CLOSE;
429 power_desc[num] = _("ついて来い", "follow me");
431 if (creature_ptr->pet_follow_distance == PET_FOLLOW_DIST)
433 powers[num++] = PET_FOLLOW_ME;
434 power_desc[num] = _("敵を見つけて倒せ", "seek and destroy");
436 if (creature_ptr->pet_follow_distance == PET_DESTROY_DIST)
438 powers[num++] = PET_SEEK_AND_DESTROY;
439 power_desc[num] = _("少し離れていろ", "give me space");
441 if (creature_ptr->pet_follow_distance == PET_SPACE_DIST)
443 powers[num++] = PET_ALLOW_SPACE;
444 power_desc[num] = _("離れていろ", "stay away");
446 if (creature_ptr->pet_follow_distance == PET_AWAY_DIST)
448 powers[num++] = PET_STAY_AWAY;
450 if (creature_ptr->pet_extra_flags & PF_OPEN_DOORS) {
451 power_desc[num] = _("ドアを開ける (現在:ON)", "pets open doors (now On)");
453 power_desc[num] = _("ドアを開ける (現在:OFF)", "pets open doors (now Off)");
455 powers[num++] = PET_OPEN_DOORS;
457 if (creature_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
458 power_desc[num] = _("アイテムを拾う (現在:ON)", "pets pick up items (now On)");
460 power_desc[num] = _("アイテムを拾う (現在:OFF)", "pets pick up items (now Off)");
462 powers[num++] = PET_TAKE_ITEMS;
464 if (creature_ptr->pet_extra_flags & PF_TELEPORT) {
465 power_desc[num] = _("テレポート系魔法を使う (現在:ON)", "allow teleport (now On)");
467 power_desc[num] = _("テレポート系魔法を使う (現在:OFF)", "allow teleport (now Off)");
469 powers[num++] = PET_TELEPORT;
471 if (creature_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
472 power_desc[num] = _("攻撃魔法を使う (現在:ON)", "allow cast attack spell (now On)");
474 power_desc[num] = _("攻撃魔法を使う (現在:OFF)", "allow cast attack spell (now Off)");
476 powers[num++] = PET_ATTACK_SPELL;
478 if (creature_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
479 power_desc[num] = _("召喚魔法を使う (現在:ON)", "allow cast summon spell (now On)");
481 power_desc[num] = _("召喚魔法を使う (現在:OFF)", "allow cast summon spell (now Off)");
483 powers[num++] = PET_SUMMON_SPELL;
485 if (creature_ptr->pet_extra_flags & PF_BALL_SPELL) {
486 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:ON)", "allow involve player in area spell (now On)");
488 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:OFF)", "allow involve player in area spell (now Off)");
490 powers[num++] = PET_BALL_SPELL;
492 if (creature_ptr->riding) {
493 power_desc[num] = _("ペットから降りる", "get off a pet");
495 power_desc[num] = _("ペットに乗る", "ride a pet");
497 powers[num++] = PET_RIDING;
498 power_desc[num] = _("ペットに名前をつける", "name pets");
499 powers[num++] = PET_NAME;
501 if (creature_ptr->riding) {
502 if ((can_attack_with_main_hand(creature_ptr) && (empty_hands(creature_ptr, false) == EMPTY_HAND_SUB)
503 && creature_ptr->inventory_list[INVEN_MAIN_HAND].allow_two_hands_wielding())
504 || (can_attack_with_sub_hand(creature_ptr) && (empty_hands(creature_ptr, false) == EMPTY_HAND_MAIN)
505 && creature_ptr->inventory_list[INVEN_SUB_HAND].allow_two_hands_wielding())) {
506 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
507 power_desc[num] = _("武器を片手で持つ", "use one hand to control the pet you are riding");
509 power_desc[num] = _("武器を両手で持つ", "use both hands for a weapon");
512 powers[num++] = PET_TWO_HANDS;
514 switch (creature_ptr->pclass) {
516 case CLASS_FORCETRAINER:
517 case CLASS_BERSERKER:
518 if (empty_hands(creature_ptr, false) == (EMPTY_HAND_MAIN | EMPTY_HAND_SUB)) {
519 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
520 power_desc[num] = _("片手で格闘する", "use one hand to control the pet you are riding");
522 power_desc[num] = _("両手で格闘する", "use both hands for melee");
525 powers[num++] = PET_TWO_HANDS;
526 } else if ((empty_hands(creature_ptr, false) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_MAIN_HAND)
527 && !has_melee_weapon(creature_ptr, INVEN_SUB_HAND)) {
528 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
529 power_desc[num] = _("格闘を行わない", "use one hand to control the pet you are riding");
531 power_desc[num] = _("格闘を行う", "use one hand for melee");
534 powers[num++] = PET_TWO_HANDS;
544 if (!(repeat_pull(&i) && (i >= 0) && (i < num))) {
550 strnfmt(out_val, 78, _("(コマンド、ESC=終了) コマンドを選んでください:", "(Command, ESC=exit) Choose command from menu."));
552 strnfmt(out_val, 78, _("(コマンド %c-%c、'*'=一覧、ESC=終了) コマンドを選んでください:", "(Command %c-%c, *=List, ESC=exit) Select a command: "),
553 I2A(0), I2A(num - 1));
556 choice = (always_show_list || use_menu) ? ESCAPE : 1;
558 /* Get a command from the user */
562 if (choice == ESCAPE)
564 else if (!get_com(out_val, &choice, true))
567 if (use_menu && (choice != ' ')) {
576 menu_line += (num - 1);
610 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask)) {
612 if (!redraw || use_menu) {
622 for (control = 0; control < num; control++) {
623 /* Letter/number for power selection */
625 sprintf(buf, "%c%s ", (control == command_idx) ? '*' : ' ', (control == (menu_line - 1)) ? _("》", "> ") : " ");
627 sprintf(buf, "%c%c) ", (control == command_idx) ? '*' : ' ', I2A(control));
629 strcat(buf, power_desc[control]);
631 prt(buf, y + control, x);
634 prt("", y + MIN(control, 17), x);
650 ask = (isupper(choice));
654 choice = (char)tolower(choice);
656 /* Extract request */
657 i = (islower(choice) ? A2I(choice) : -1);
660 /* Totally Illegal */
661 if ((i < 0) || (i >= num)) {
669 strnfmt(buf, 78, _("%sを使いますか? ", "Use %s? "), power_desc[i]);
671 /* Belay that order */
682 /* Abort if needed */
684 PlayerEnergy(creature_ptr).reset_player_turn();
691 case PET_DISMISS: /* Dismiss pets */
693 /* Check pets (backwards) */
694 for (pet_ctr = creature_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
696 if (is_pet(&creature_ptr->current_floor_ptr->m_list[pet_ctr]))
701 msg_print(_("ペットがいない!", "You have no pets!"));
704 do_cmd_pet_dismiss(creature_ptr);
705 (void)calculate_upkeep(creature_ptr);
710 if (!target_set(creature_ptr, TARGET_KILL))
711 creature_ptr->pet_t_m_idx = 0;
713 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[target_row][target_col];
714 if (g_ptr->m_idx && (creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
715 creature_ptr->pet_t_m_idx = creature_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
716 creature_ptr->pet_follow_distance = PET_DESTROY_DIST;
718 creature_ptr->pet_t_m_idx = 0;
725 case PET_STAY_CLOSE: {
726 creature_ptr->pet_follow_distance = PET_CLOSE_DIST;
727 creature_ptr->pet_t_m_idx = 0;
731 case PET_FOLLOW_ME: {
732 creature_ptr->pet_follow_distance = PET_FOLLOW_DIST;
733 creature_ptr->pet_t_m_idx = 0;
736 /* "Seek and destoy" */
737 case PET_SEEK_AND_DESTROY: {
738 creature_ptr->pet_follow_distance = PET_DESTROY_DIST;
741 /* "Give me space" */
742 case PET_ALLOW_SPACE: {
743 creature_ptr->pet_follow_distance = PET_SPACE_DIST;
747 case PET_STAY_AWAY: {
748 creature_ptr->pet_follow_distance = PET_AWAY_DIST;
751 /* flag - allow pets to open doors */
752 case PET_OPEN_DOORS: {
753 if (creature_ptr->pet_extra_flags & PF_OPEN_DOORS)
754 creature_ptr->pet_extra_flags &= ~(PF_OPEN_DOORS);
756 creature_ptr->pet_extra_flags |= (PF_OPEN_DOORS);
759 /* flag - allow pets to pickup items */
760 case PET_TAKE_ITEMS: {
761 if (creature_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
762 creature_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
763 for (pet_ctr = creature_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
764 m_ptr = &creature_ptr->current_floor_ptr->m_list[pet_ctr];
767 monster_drop_carried_objects(creature_ptr, m_ptr);
771 creature_ptr->pet_extra_flags |= (PF_PICKUP_ITEMS);
775 /* flag - allow pets to teleport */
777 if (creature_ptr->pet_extra_flags & PF_TELEPORT)
778 creature_ptr->pet_extra_flags &= ~(PF_TELEPORT);
780 creature_ptr->pet_extra_flags |= (PF_TELEPORT);
783 /* flag - allow pets to cast attack spell */
784 case PET_ATTACK_SPELL: {
785 if (creature_ptr->pet_extra_flags & PF_ATTACK_SPELL)
786 creature_ptr->pet_extra_flags &= ~(PF_ATTACK_SPELL);
788 creature_ptr->pet_extra_flags |= (PF_ATTACK_SPELL);
791 /* flag - allow pets to cast attack spell */
792 case PET_SUMMON_SPELL: {
793 if (creature_ptr->pet_extra_flags & PF_SUMMON_SPELL)
794 creature_ptr->pet_extra_flags &= ~(PF_SUMMON_SPELL);
796 creature_ptr->pet_extra_flags |= (PF_SUMMON_SPELL);
799 /* flag - allow pets to cast attack spell */
800 case PET_BALL_SPELL: {
801 if (creature_ptr->pet_extra_flags & PF_BALL_SPELL)
802 creature_ptr->pet_extra_flags &= ~(PF_BALL_SPELL);
804 creature_ptr->pet_extra_flags |= (PF_BALL_SPELL);
809 (void)do_cmd_riding(creature_ptr, false);
814 do_name_pet(creature_ptr);
818 case PET_TWO_HANDS: {
819 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
820 creature_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
822 creature_ptr->pet_extra_flags |= (PF_TWO_HANDS);
823 creature_ptr->update |= (PU_BONUS);
824 handle_stuff(creature_ptr);