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/monster-race-definition.h"
52 #include "system/monster-type-definition.h"
53 #include "system/object-type-definition.h"
54 #include "system/player-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 "util/bit-flags-calculator.h"
61 #include "util/int-char-converter.h"
62 #include "util/quarks.h"
63 #include "util/sort.h"
64 #include "view/display-messages.h"
65 #include "world/world.h"
68 * @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).update_player_turn_energy(100, update_turn_type::ENERGY_SUBSTITUTION);
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[get_feat_mimic(g_ptr)];
263 msg_format("そのモンスターは%sの%sにいる。", f_ptr->name.c_str(),
264 ((!has_flag(f_ptr->flags, FF_MOVE) && !has_flag(f_ptr->flags, FF_CAN_FLY))
265 || (!has_flag(f_ptr->flags, FF_LOS) && !has_flag(f_ptr->flags, FF_TREE)))
269 msg_format("This monster is %s the %s.",
270 ((!has_flag(f_ptr->flags, FF_MOVE) && !has_flag(f_ptr->flags, FF_CAN_FLY))
271 || (!has_flag(f_ptr->flags, FF_LOS) && !has_flag(f_ptr->flags, FF_TREE)))
274 f_ptr->name.c_str());
279 if (r_info[m_ptr->r_idx].level > randint1((creature_ptr->skill_exp[GINOU_RIDING] / 50 + creature_ptr->lev / 2 + 20))) {
280 msg_print(_("うまく乗れなかった。", "You failed to ride."));
281 PlayerEnergy(creature_ptr).update_player_turn_energy(100, update_turn_type::ENERGY_SUBSTITUTION);
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).update_player_turn_energy(100, update_turn_type::ENERGY_SUBSTITUTION);
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 ペットに名前をつけるコマンドのメインルーチン
319 static void do_name_pet(player_type *creature_ptr)
323 GAME_TEXT m_name[MAX_NLEN];
324 bool old_name = FALSE;
325 bool old_target_pet = target_pet;
328 if (!target_set(creature_ptr, TARGET_KILL)) {
329 target_pet = old_target_pet;
333 target_pet = old_target_pet;
335 if (creature_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) {
336 m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
338 if (!is_pet(m_ptr)) {
339 msg_print(_("そのモンスターはペットではない。", "This monster is not a pet."));
342 if (r_info[m_ptr->r_idx].flags1 & RF1_UNIQUE) {
343 msg_print(_("そのモンスターの名前は変えられない!", "You cannot change the name of this monster!"));
346 monster_desc(creature_ptr, m_name, m_ptr, 0);
348 msg_format(_("%sに名前をつける。", "Name %s."), m_name);
351 /* Start with nothing */
354 /* Use old inscription */
355 if (m_ptr->nickname) {
356 /* Start with the old inscription */
357 strcpy(out_val, quark_str(m_ptr->nickname));
361 /* Get a new inscription (possibly empty) */
362 if (get_string(_("名前: ", "Name: "), out_val, 15)) {
364 /* Save the inscription */
365 m_ptr->nickname = quark_add(out_val);
366 if (record_named_pet) {
367 monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
368 exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_NAME, m_name);
371 if (record_named_pet && old_name) {
372 monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
373 exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_UNNAME, m_name);
382 * @brief ペットに関するコマンドリストのメインルーチン /
383 * Issue a pet command
386 void do_cmd_pet(player_type *creature_ptr)
391 concptr power_desc[36];
398 PET_COMMAND_IDX mode = 0;
401 char target_buf[160];
403 int menu_line = use_menu ? 1 : 0;
407 if (creature_ptr->wild_mode)
410 power_desc[num] = _("ペットを放す", "dismiss pets");
411 powers[num++] = PET_DISMISS;
414 sprintf(target_buf, "ペットのターゲットを指定 (現在:%s)",
415 (creature_ptr->pet_t_m_idx
416 ? (creature_ptr->image ? "何か奇妙な物" : r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name.c_str())
419 sprintf(target_buf, "specify a target of pet (now:%s)",
420 (creature_ptr->pet_t_m_idx
421 ? (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())
424 power_desc[num] = target_buf;
425 powers[num++] = PET_TARGET;
426 power_desc[num] = _("近くにいろ", "stay close");
428 if (creature_ptr->pet_follow_distance == PET_CLOSE_DIST)
430 powers[num++] = PET_STAY_CLOSE;
431 power_desc[num] = _("ついて来い", "follow me");
433 if (creature_ptr->pet_follow_distance == PET_FOLLOW_DIST)
435 powers[num++] = PET_FOLLOW_ME;
436 power_desc[num] = _("敵を見つけて倒せ", "seek and destroy");
438 if (creature_ptr->pet_follow_distance == PET_DESTROY_DIST)
440 powers[num++] = PET_SEEK_AND_DESTROY;
441 power_desc[num] = _("少し離れていろ", "give me space");
443 if (creature_ptr->pet_follow_distance == PET_SPACE_DIST)
445 powers[num++] = PET_ALLOW_SPACE;
446 power_desc[num] = _("離れていろ", "stay away");
448 if (creature_ptr->pet_follow_distance == PET_AWAY_DIST)
450 powers[num++] = PET_STAY_AWAY;
452 if (creature_ptr->pet_extra_flags & PF_OPEN_DOORS) {
453 power_desc[num] = _("ドアを開ける (現在:ON)", "pets open doors (now On)");
455 power_desc[num] = _("ドアを開ける (現在:OFF)", "pets open doors (now Off)");
457 powers[num++] = PET_OPEN_DOORS;
459 if (creature_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
460 power_desc[num] = _("アイテムを拾う (現在:ON)", "pets pick up items (now On)");
462 power_desc[num] = _("アイテムを拾う (現在:OFF)", "pets pick up items (now Off)");
464 powers[num++] = PET_TAKE_ITEMS;
466 if (creature_ptr->pet_extra_flags & PF_TELEPORT) {
467 power_desc[num] = _("テレポート系魔法を使う (現在:ON)", "allow teleport (now On)");
469 power_desc[num] = _("テレポート系魔法を使う (現在:OFF)", "allow teleport (now Off)");
471 powers[num++] = PET_TELEPORT;
473 if (creature_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
474 power_desc[num] = _("攻撃魔法を使う (現在:ON)", "allow cast attack spell (now On)");
476 power_desc[num] = _("攻撃魔法を使う (現在:OFF)", "allow cast attack spell (now Off)");
478 powers[num++] = PET_ATTACK_SPELL;
480 if (creature_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
481 power_desc[num] = _("召喚魔法を使う (現在:ON)", "allow cast summon spell (now On)");
483 power_desc[num] = _("召喚魔法を使う (現在:OFF)", "allow cast summon spell (now Off)");
485 powers[num++] = PET_SUMMON_SPELL;
487 if (creature_ptr->pet_extra_flags & PF_BALL_SPELL) {
488 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:ON)", "allow involve player in area spell (now On)");
490 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:OFF)", "allow involve player in area spell (now Off)");
492 powers[num++] = PET_BALL_SPELL;
494 if (creature_ptr->riding) {
495 power_desc[num] = _("ペットから降りる", "get off a pet");
497 power_desc[num] = _("ペットに乗る", "ride a pet");
499 powers[num++] = PET_RIDING;
500 power_desc[num] = _("ペットに名前をつける", "name pets");
501 powers[num++] = PET_NAME;
503 if (creature_ptr->riding) {
504 if ((can_attack_with_main_hand(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_SUB)
505 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_MAIN_HAND]))
506 || (can_attack_with_sub_hand(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_MAIN)
507 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_SUB_HAND]))) {
508 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
509 power_desc[num] = _("武器を片手で持つ", "use one hand to control the pet you are riding");
511 power_desc[num] = _("武器を両手で持つ", "use both hands for a weapon");
514 powers[num++] = PET_TWO_HANDS;
516 switch (creature_ptr->pclass) {
518 case CLASS_FORCETRAINER:
519 case CLASS_BERSERKER:
520 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_MAIN | EMPTY_HAND_SUB)) {
521 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
522 power_desc[num] = _("片手で格闘する", "use one hand to control the pet you are riding");
524 power_desc[num] = _("両手で格闘する", "use both hands for melee");
527 powers[num++] = PET_TWO_HANDS;
528 } else if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_MAIN_HAND)
529 && !has_melee_weapon(creature_ptr, INVEN_SUB_HAND)) {
530 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
531 power_desc[num] = _("格闘を行わない", "use one hand to control the pet you are riding");
533 power_desc[num] = _("格闘を行う", "use one hand for melee");
536 powers[num++] = PET_TWO_HANDS;
546 if (!(repeat_pull(&i) && (i >= 0) && (i < num))) {
552 strnfmt(out_val, 78, _("(コマンド、ESC=終了) コマンドを選んでください:", "(Command, ESC=exit) Choose command from menu."));
554 strnfmt(out_val, 78, _("(コマンド %c-%c、'*'=一覧、ESC=終了) コマンドを選んでください:", "(Command %c-%c, *=List, ESC=exit) Select a command: "),
555 I2A(0), I2A(num - 1));
558 choice = (always_show_list || use_menu) ? ESCAPE : 1;
560 /* Get a command from the user */
564 if (choice == ESCAPE)
566 else if (!get_com(out_val, &choice, TRUE))
569 if (use_menu && (choice != ' ')) {
578 menu_line += (num - 1);
612 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask)) {
614 if (!redraw || use_menu) {
616 PET_COMMAND_IDX ctr = 0;
624 for (ctr = 0; ctr < num; ctr++) {
625 /* Letter/number for power selection */
627 sprintf(buf, "%c%s ", (ctr == mode) ? '*' : ' ', (ctr == (menu_line - 1)) ? _("》", "> ") : " ");
629 sprintf(buf, "%c%c) ", (ctr == mode) ? '*' : ' ', I2A(ctr));
631 strcat(buf, power_desc[ctr]);
633 prt(buf, y + ctr, x);
636 prt("", y + MIN(ctr, 17), x);
652 ask = (isupper(choice));
656 choice = (char)tolower(choice);
658 /* Extract request */
659 i = (islower(choice) ? A2I(choice) : -1);
662 /* Totally Illegal */
663 if ((i < 0) || (i >= num)) {
671 strnfmt(buf, 78, _("%sを使いますか? ", "Use %s? "), power_desc[i]);
673 /* Belay that order */
684 /* Abort if needed */
686 PlayerEnergy(creature_ptr).reset_player_turn();
693 case PET_DISMISS: /* Dismiss pets */
695 /* Check pets (backwards) */
696 for (pet_ctr = creature_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
698 if (is_pet(&creature_ptr->current_floor_ptr->m_list[pet_ctr]))
703 msg_print(_("ペットがいない!", "You have no pets!"));
706 do_cmd_pet_dismiss(creature_ptr);
707 (void)calculate_upkeep(creature_ptr);
712 if (!target_set(creature_ptr, TARGET_KILL))
713 creature_ptr->pet_t_m_idx = 0;
715 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[target_row][target_col];
716 if (g_ptr->m_idx && (creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
717 creature_ptr->pet_t_m_idx = creature_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
718 creature_ptr->pet_follow_distance = PET_DESTROY_DIST;
720 creature_ptr->pet_t_m_idx = 0;
727 case PET_STAY_CLOSE: {
728 creature_ptr->pet_follow_distance = PET_CLOSE_DIST;
729 creature_ptr->pet_t_m_idx = 0;
733 case PET_FOLLOW_ME: {
734 creature_ptr->pet_follow_distance = PET_FOLLOW_DIST;
735 creature_ptr->pet_t_m_idx = 0;
738 /* "Seek and destoy" */
739 case PET_SEEK_AND_DESTROY: {
740 creature_ptr->pet_follow_distance = PET_DESTROY_DIST;
743 /* "Give me space" */
744 case PET_ALLOW_SPACE: {
745 creature_ptr->pet_follow_distance = PET_SPACE_DIST;
749 case PET_STAY_AWAY: {
750 creature_ptr->pet_follow_distance = PET_AWAY_DIST;
753 /* flag - allow pets to open doors */
754 case PET_OPEN_DOORS: {
755 if (creature_ptr->pet_extra_flags & PF_OPEN_DOORS)
756 creature_ptr->pet_extra_flags &= ~(PF_OPEN_DOORS);
758 creature_ptr->pet_extra_flags |= (PF_OPEN_DOORS);
761 /* flag - allow pets to pickup items */
762 case PET_TAKE_ITEMS: {
763 if (creature_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
764 creature_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
765 for (pet_ctr = creature_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
766 m_ptr = &creature_ptr->current_floor_ptr->m_list[pet_ctr];
769 monster_drop_carried_objects(creature_ptr, m_ptr);
773 creature_ptr->pet_extra_flags |= (PF_PICKUP_ITEMS);
777 /* flag - allow pets to teleport */
779 if (creature_ptr->pet_extra_flags & PF_TELEPORT)
780 creature_ptr->pet_extra_flags &= ~(PF_TELEPORT);
782 creature_ptr->pet_extra_flags |= (PF_TELEPORT);
785 /* flag - allow pets to cast attack spell */
786 case PET_ATTACK_SPELL: {
787 if (creature_ptr->pet_extra_flags & PF_ATTACK_SPELL)
788 creature_ptr->pet_extra_flags &= ~(PF_ATTACK_SPELL);
790 creature_ptr->pet_extra_flags |= (PF_ATTACK_SPELL);
793 /* flag - allow pets to cast attack spell */
794 case PET_SUMMON_SPELL: {
795 if (creature_ptr->pet_extra_flags & PF_SUMMON_SPELL)
796 creature_ptr->pet_extra_flags &= ~(PF_SUMMON_SPELL);
798 creature_ptr->pet_extra_flags |= (PF_SUMMON_SPELL);
801 /* flag - allow pets to cast attack spell */
802 case PET_BALL_SPELL: {
803 if (creature_ptr->pet_extra_flags & PF_BALL_SPELL)
804 creature_ptr->pet_extra_flags &= ~(PF_BALL_SPELL);
806 creature_ptr->pet_extra_flags |= (PF_BALL_SPELL);
811 (void)do_cmd_riding(creature_ptr, FALSE);
816 do_name_pet(creature_ptr);
820 case PET_TWO_HANDS: {
821 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
822 creature_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
824 creature_ptr->pet_extra_flags |= (PF_TWO_HANDS);
825 creature_ptr->update |= (PU_BONUS);
826 handle_stuff(creature_ptr);