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/pattern-walk.h"
12 #include "game-option/input-options.h"
13 #include "game-option/play-record-options.h"
14 #include "game-option/text-display-options.h"
15 #include "game-option/map-screen-options.h"
16 #include "grid/feature.h"
17 #include "grid/grid.h"
18 #include "inventory/inventory-slot-types.h"
19 #include "io/command-repeater.h"
20 #include "io/cursor.h"
21 #include "io/input-key-acceptor.h"
22 #include "io/input-key-requester.h"
23 #include "io/write-diary.h"
24 #include "main/sound-of-music.h"
25 #include "monster-floor/monster-object.h"
26 #include "monster-floor/monster-remover.h"
27 #include "monster-race/monster-race.h"
28 #include "monster-race/race-flags1.h"
29 #include "monster-race/race-flags7.h"
30 #include "monster/monster-describer.h"
31 #include "monster/monster-description-types.h"
32 #include "monster/monster-info.h"
33 #include "monster/monster-status-setter.h"
34 #include "monster/monster-status.h"
35 #include "monster/smart-learn-types.h"
36 #include "object-hook/hook-weapon.h"
37 #include "pet/pet-util.h"
38 #include "player/attack-defense-types.h"
39 #include "player/player-class.h"
40 #include "player/player-damage.h"
41 #include "player/player-move.h"
42 #include "player/player-skill.h"
43 #include "player/player-status-flags.h"
44 #include "player/player-status.h"
45 #include "player/special-defense-types.h"
46 #include "status/action-setter.h"
47 #include "system/floor-type-definition.h"
48 #include "target/target-checker.h"
49 #include "target/target-getter.h"
50 #include "target/target-setter.h"
51 #include "target/target-types.h"
52 #include "term/screen-processor.h"
53 #include "util/bit-flags-calculator.h"
54 #include "util/int-char-converter.h"
55 #include "util/quarks.h"
56 #include "util/sort.h"
57 #include "view/display-messages.h"
58 #include "world/world.h"
60 int total_friends = 0;
63 * @brief ペットを開放するコマンドのメインルーチン
66 void do_cmd_pet_dismiss(player_type *creature_ptr)
69 bool all_pets = FALSE;
84 /* Allocate the "who" array */
85 C_MAKE(who, current_world_ptr->max_m_idx, MONSTER_IDX);
87 /* Process the monsters (backwards) */
88 for (pet_ctr = creature_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
89 if (is_pet(&creature_ptr->current_floor_ptr->m_list[pet_ctr]))
90 who[max_pet++] = pet_ctr;
93 ang_sort(creature_ptr, who, &dummy_why, max_pet, ang_sort_comp_pet_dismiss, ang_sort_swap_hook);
95 /* Process the monsters (backwards) */
96 for (i = 0; i < max_pet; i++) {
98 GAME_TEXT friend_name[MAX_NLEN];
102 m_ptr = &creature_ptr->current_floor_ptr->m_list[pet_ctr];
105 kakunin = ((pet_ctr == creature_ptr->riding) || (m_ptr->nickname));
106 monster_desc(creature_ptr, friend_name, m_ptr, MD_ASSUME_VISIBLE);
109 /* Hack -- health bar for this monster */
110 health_track(creature_ptr, pet_ctr);
111 handle_stuff(creature_ptr);
113 msg_format(_("%sを放しますか? [Yes/No/Unnamed (%d体)]", "Dismiss %s? [Yes/No/Unnamed (%d remain)]"), friend_name, max_pet - i);
116 move_cursor_relative(m_ptr->fy, m_ptr->fx);
121 if (ch == 'Y' || ch == 'y') {
125 msg_format(_("本当によろしいですか? (%s) ", "Are you sure? (%s) "), friend_name);
127 if (ch != 'Y' && ch != 'y')
133 if (ch == 'U' || ch == 'u') {
138 if (ch == ESCAPE || ch == 'N' || ch == 'n')
145 if ((all_pets && !kakunin) || (!all_pets && delete_this)) {
146 if (record_named_pet && m_ptr->nickname) {
147 GAME_TEXT m_name[MAX_NLEN];
149 monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
150 exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_DISMISS, m_name);
153 if (pet_ctr == creature_ptr->riding) {
154 msg_format(_("%sから降りた。", "You dismount from %s. "), friend_name);
156 creature_ptr->riding = 0;
158 creature_ptr->update |= (PU_MONSTERS);
159 creature_ptr->redraw |= (PR_EXTRA | PR_UHEALTH);
162 /* HACK : Add the line to message buffer */
163 msg_format(_("%s を放した。", "Dismissed %s."), friend_name);
164 creature_ptr->update |= (PU_BONUS);
165 creature_ptr->window_flags |= (PW_MESSAGE);
167 delete_monster_idx(creature_ptr, pet_ctr);
177 C_KILL(who, current_world_ptr->max_m_idx, MONSTER_IDX);
180 msg_format("%d 体のペットを放しました。", Dismissed);
182 msg_format("You have dismissed %d pet%s.", Dismissed, (Dismissed == 1 ? "" : "s"));
184 if (Dismissed == 0 && all_pets)
185 msg_print(_("'U'nnamed は、乗馬以外の名前のないペットだけを全て解放します。", "'U'nnamed means all your pets except named pets and your mount."));
187 handle_stuff(creature_ptr);
191 * @brief ペットから騎乗/下馬するコマンドのメインルーチン /
192 * @param force 強制的に騎乗/下馬するならばTRUE
193 * @return 騎乗/下馬できたらTRUE
195 bool do_cmd_riding(player_type *creature_ptr, bool force)
202 if (!get_direction(creature_ptr, &dir, FALSE, FALSE))
204 y = creature_ptr->y + ddy[dir];
205 x = creature_ptr->x + ddx[dir];
206 g_ptr = &creature_ptr->current_floor_ptr->grid_array[y][x];
208 if (creature_ptr->special_defense & KATA_MUSOU)
209 set_action(creature_ptr, ACTION_NONE);
211 if (creature_ptr->riding) {
212 /* Skip non-empty grids */
213 if (!can_player_ride_pet(creature_ptr, g_ptr, FALSE)) {
214 msg_print(_("そちらには降りられません。", "You cannot go that direction."));
218 if (!pattern_seq(creature_ptr, creature_ptr->y, creature_ptr->x, y, x))
222 take_turn(creature_ptr, 100);
224 msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
226 do_cmd_attack(creature_ptr, y, x, 0);
230 creature_ptr->riding = 0;
231 creature_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
232 creature_ptr->riding_ryoute = creature_ptr->old_riding_ryoute = FALSE;
234 if (cmd_limit_confused(creature_ptr))
237 m_ptr = &creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx];
239 if (!g_ptr->m_idx || !m_ptr->ml) {
240 msg_print(_("その場所にはモンスターはいません。", "There is no monster here."));
243 if (!is_pet(m_ptr) && !force) {
244 msg_print(_("そのモンスターはペットではありません。", "That monster is not a pet."));
247 if (!(r_info[m_ptr->r_idx].flags7 & RF7_RIDING)) {
248 msg_print(_("そのモンスターには乗れなさそうだ。", "This monster doesn't seem suitable for riding."));
252 if (!pattern_seq(creature_ptr, creature_ptr->y, creature_ptr->x, y, x))
255 if (!can_player_ride_pet(creature_ptr, g_ptr, TRUE)) {
256 /* Feature code (applying "mimic" field) */
257 feature_type *f_ptr = &f_info[get_feat_mimic(g_ptr)];
259 msg_format("そのモンスターは%sの%sにいる。", f_name + f_ptr->name,
260 ((!has_flag(f_ptr->flags, FF_MOVE) && !has_flag(f_ptr->flags, FF_CAN_FLY))
261 || (!has_flag(f_ptr->flags, FF_LOS) && !has_flag(f_ptr->flags, FF_TREE)))
265 msg_format("This monster is %s the %s.",
266 ((!has_flag(f_ptr->flags, FF_MOVE) && !has_flag(f_ptr->flags, FF_CAN_FLY))
267 || (!has_flag(f_ptr->flags, FF_LOS) && !has_flag(f_ptr->flags, FF_TREE)))
270 f_name + f_ptr->name);
275 if (r_info[m_ptr->r_idx].level > randint1((creature_ptr->skill_exp[GINOU_RIDING] / 50 + creature_ptr->lev / 2 + 20))) {
276 msg_print(_("うまく乗れなかった。", "You failed to ride."));
277 take_turn(creature_ptr, 100);
281 if (monster_csleep_remaining(m_ptr)) {
282 GAME_TEXT m_name[MAX_NLEN];
283 monster_desc(creature_ptr, m_name, m_ptr, 0);
284 (void)set_monster_csleep(creature_ptr, g_ptr->m_idx, 0);
285 msg_format(_("%sを起こした。", "You have woken %s up."), m_name);
288 if (creature_ptr->action == ACTION_KAMAE)
289 set_action(creature_ptr, ACTION_NONE);
291 creature_ptr->riding = g_ptr->m_idx;
293 /* Hack -- remove tracked monster */
294 if (creature_ptr->riding == creature_ptr->health_who)
295 health_track(creature_ptr, 0);
298 take_turn(creature_ptr, 100);
300 /* Mega-Hack -- Forget the view and lite */
301 creature_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
302 creature_ptr->update |= (PU_BONUS);
303 creature_ptr->redraw |= (PR_MAP | PR_EXTRA);
304 creature_ptr->redraw |= (PR_UHEALTH);
306 (void)move_player_effect(creature_ptr, y, x, MPE_HANDLE_STUFF | MPE_ENERGY_USE | MPE_DONT_PICKUP | MPE_DONT_SWAP_MON);
312 * @brief ペットに名前をつけるコマンドのメインルーチン
315 static void do_name_pet(player_type *creature_ptr)
319 GAME_TEXT m_name[MAX_NLEN];
320 bool old_name = FALSE;
321 bool old_target_pet = target_pet;
324 if (!target_set(creature_ptr, TARGET_KILL)) {
325 target_pet = old_target_pet;
329 target_pet = old_target_pet;
331 if (creature_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx) {
332 m_ptr = &creature_ptr->current_floor_ptr->m_list[creature_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx];
334 if (!is_pet(m_ptr)) {
335 msg_print(_("そのモンスターはペットではない。", "This monster is not a pet."));
338 if (r_info[m_ptr->r_idx].flags1 & RF1_UNIQUE) {
339 msg_print(_("そのモンスターの名前は変えられない!", "You cannot change the name of this monster!"));
342 monster_desc(creature_ptr, m_name, m_ptr, 0);
344 msg_format(_("%sに名前をつける。", "Name %s."), m_name);
347 /* Start with nothing */
350 /* Use old inscription */
351 if (m_ptr->nickname) {
352 /* Start with the old inscription */
353 strcpy(out_val, quark_str(m_ptr->nickname));
357 /* Get a new inscription (possibly empty) */
358 if (get_string(_("名前: ", "Name: "), out_val, 15)) {
360 /* Save the inscription */
361 m_ptr->nickname = quark_add(out_val);
362 if (record_named_pet) {
363 monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
364 exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_NAME, m_name);
367 if (record_named_pet && old_name) {
368 monster_desc(creature_ptr, m_name, m_ptr, MD_INDEF_VISIBLE);
369 exe_write_diary(creature_ptr, DIARY_NAMED_PET, RECORD_NAMED_PET_UNNAME, m_name);
378 * @brief ペットに関するコマンドリストのメインルーチン /
379 * Issue a pet command
382 void do_cmd_pet(player_type *creature_ptr)
387 concptr power_desc[36];
394 PET_COMMAND_IDX mode = 0;
397 char target_buf[160];
399 int menu_line = use_menu ? 1 : 0;
403 if (creature_ptr->wild_mode)
406 power_desc[num] = _("ペットを放す", "dismiss pets");
407 powers[num++] = PET_DISMISS;
410 sprintf(target_buf, "ペットのターゲットを指定 (現在:%s)",
411 (creature_ptr->pet_t_m_idx
412 ? (creature_ptr->image ? "何か奇妙な物" : (r_name + r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name))
415 sprintf(target_buf, "specify a target of pet (now:%s)",
416 (creature_ptr->pet_t_m_idx ? (
417 creature_ptr->image ? "something strange" : (r_name + r_info[creature_ptr->current_floor_ptr->m_list[creature_ptr->pet_t_m_idx].ap_r_idx].name))
420 power_desc[num] = target_buf;
421 powers[num++] = PET_TARGET;
422 power_desc[num] = _("近くにいろ", "stay close");
424 if (creature_ptr->pet_follow_distance == PET_CLOSE_DIST)
426 powers[num++] = PET_STAY_CLOSE;
427 power_desc[num] = _("ついて来い", "follow me");
429 if (creature_ptr->pet_follow_distance == PET_FOLLOW_DIST)
431 powers[num++] = PET_FOLLOW_ME;
432 power_desc[num] = _("敵を見つけて倒せ", "seek and destroy");
434 if (creature_ptr->pet_follow_distance == PET_DESTROY_DIST)
436 powers[num++] = PET_SEEK_AND_DESTROY;
437 power_desc[num] = _("少し離れていろ", "give me space");
439 if (creature_ptr->pet_follow_distance == PET_SPACE_DIST)
441 powers[num++] = PET_ALLOW_SPACE;
442 power_desc[num] = _("離れていろ", "stay away");
444 if (creature_ptr->pet_follow_distance == PET_AWAY_DIST)
446 powers[num++] = PET_STAY_AWAY;
448 if (creature_ptr->pet_extra_flags & PF_OPEN_DOORS) {
449 power_desc[num] = _("ドアを開ける (現在:ON)", "pets open doors (now On)");
451 power_desc[num] = _("ドアを開ける (現在:OFF)", "pets open doors (now Off)");
453 powers[num++] = PET_OPEN_DOORS;
455 if (creature_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
456 power_desc[num] = _("アイテムを拾う (現在:ON)", "pets pick up items (now On)");
458 power_desc[num] = _("アイテムを拾う (現在:OFF)", "pets pick up items (now Off)");
460 powers[num++] = PET_TAKE_ITEMS;
462 if (creature_ptr->pet_extra_flags & PF_TELEPORT) {
463 power_desc[num] = _("テレポート系魔法を使う (現在:ON)", "allow teleport (now On)");
465 power_desc[num] = _("テレポート系魔法を使う (現在:OFF)", "allow teleport (now Off)");
467 powers[num++] = PET_TELEPORT;
469 if (creature_ptr->pet_extra_flags & PF_ATTACK_SPELL) {
470 power_desc[num] = _("攻撃魔法を使う (現在:ON)", "allow cast attack spell (now On)");
472 power_desc[num] = _("攻撃魔法を使う (現在:OFF)", "allow cast attack spell (now Off)");
474 powers[num++] = PET_ATTACK_SPELL;
476 if (creature_ptr->pet_extra_flags & PF_SUMMON_SPELL) {
477 power_desc[num] = _("召喚魔法を使う (現在:ON)", "allow cast summon spell (now On)");
479 power_desc[num] = _("召喚魔法を使う (現在:OFF)", "allow cast summon spell (now Off)");
481 powers[num++] = PET_SUMMON_SPELL;
483 if (creature_ptr->pet_extra_flags & PF_BALL_SPELL) {
484 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:ON)", "allow involve player in area spell (now On)");
486 power_desc[num] = _("プレイヤーを巻き込む範囲魔法を使う (現在:OFF)", "allow involve player in area spell (now Off)");
488 powers[num++] = PET_BALL_SPELL;
490 if (creature_ptr->riding) {
491 power_desc[num] = _("ペットから降りる", "get off a pet");
493 power_desc[num] = _("ペットに乗る", "ride a pet");
495 powers[num++] = PET_RIDING;
496 power_desc[num] = _("ペットに名前をつける", "name pets");
497 powers[num++] = PET_NAME;
499 if (creature_ptr->riding) {
500 if ((can_attack_with_main_hand(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_SUB)
501 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_MAIN_HAND]))
502 || (can_attack_with_sub_hand(creature_ptr) && (empty_hands(creature_ptr, FALSE) == EMPTY_HAND_MAIN)
503 && object_allow_two_hands_wielding(&creature_ptr->inventory_list[INVEN_SUB_HAND]))) {
504 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
505 power_desc[num] = _("武器を片手で持つ", "use one hand to control the pet you are riding");
507 power_desc[num] = _("武器を両手で持つ", "use both hands for a weapon");
510 powers[num++] = PET_TWO_HANDS;
512 switch (creature_ptr->pclass) {
514 case CLASS_FORCETRAINER:
515 case CLASS_BERSERKER:
516 if (empty_hands(creature_ptr, FALSE) == (EMPTY_HAND_MAIN | EMPTY_HAND_SUB)) {
517 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS) {
518 power_desc[num] = _("片手で格闘する", "use one hand to control the pet you are riding");
520 power_desc[num] = _("両手で格闘する", "use both hands for melee");
523 powers[num++] = PET_TWO_HANDS;
524 } else if ((empty_hands(creature_ptr, FALSE) != EMPTY_HAND_NONE) && !has_melee_weapon(creature_ptr, INVEN_MAIN_HAND)
525 && !has_melee_weapon(creature_ptr, INVEN_SUB_HAND)) {
526 if (creature_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;
539 if (!(repeat_pull(&i) && (i >= 0) && (i < num))) {
545 strnfmt(out_val, 78, _("(コマンド、ESC=終了) コマンドを選んでください:", "(Command, ESC=exit) Choose command from menu."));
547 strnfmt(out_val, 78, _("(コマンド %c-%c、'*'=一覧、ESC=終了) コマンドを選んでください:", "(Command %c-%c, *=List, ESC=exit) Select a command: "),
548 I2A(0), I2A(num - 1));
551 choice = (always_show_list || use_menu) ? ESCAPE : 1;
553 /* Get a command from the user */
557 if (choice == ESCAPE)
559 else if (!get_com(out_val, &choice, TRUE))
562 if (use_menu && (choice != ' ')) {
571 menu_line += (num - 1);
605 if ((choice == ' ') || (choice == '*') || (choice == '?') || (use_menu && ask)) {
607 if (!redraw || use_menu) {
609 PET_COMMAND_IDX ctr = 0;
617 for (ctr = 0; ctr < num; ctr++) {
618 /* Letter/number for power selection */
620 sprintf(buf, "%c%s ", (ctr == mode) ? '*' : ' ', (ctr == (menu_line - 1)) ? _("》", "> ") : " ");
622 sprintf(buf, "%c%c) ", (ctr == mode) ? '*' : ' ', I2A(ctr));
624 strcat(buf, power_desc[ctr]);
626 prt(buf, y + ctr, x);
629 prt("", y + MIN(ctr, 17), x);
645 ask = (isupper(choice));
649 choice = (char)tolower(choice);
651 /* Extract request */
652 i = (islower(choice) ? A2I(choice) : -1);
655 /* Totally Illegal */
656 if ((i < 0) || (i >= num)) {
664 strnfmt(buf, 78, _("%sを使いますか? ", "Use %s? "), power_desc[i]);
666 /* Belay that order */
677 /* Abort if needed */
679 free_turn(creature_ptr);
686 case PET_DISMISS: /* Dismiss pets */
688 /* Check pets (backwards) */
689 for (pet_ctr = creature_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
691 if (is_pet(&creature_ptr->current_floor_ptr->m_list[pet_ctr]))
696 msg_print(_("ペットがいない!", "You have no pets!"));
699 do_cmd_pet_dismiss(creature_ptr);
700 (void)calculate_upkeep(creature_ptr);
705 if (!target_set(creature_ptr, TARGET_KILL))
706 creature_ptr->pet_t_m_idx = 0;
708 grid_type *g_ptr = &creature_ptr->current_floor_ptr->grid_array[target_row][target_col];
709 if (g_ptr->m_idx && (creature_ptr->current_floor_ptr->m_list[g_ptr->m_idx].ml)) {
710 creature_ptr->pet_t_m_idx = creature_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx;
711 creature_ptr->pet_follow_distance = PET_DESTROY_DIST;
713 creature_ptr->pet_t_m_idx = 0;
720 case PET_STAY_CLOSE: {
721 creature_ptr->pet_follow_distance = PET_CLOSE_DIST;
722 creature_ptr->pet_t_m_idx = 0;
726 case PET_FOLLOW_ME: {
727 creature_ptr->pet_follow_distance = PET_FOLLOW_DIST;
728 creature_ptr->pet_t_m_idx = 0;
731 /* "Seek and destoy" */
732 case PET_SEEK_AND_DESTROY: {
733 creature_ptr->pet_follow_distance = PET_DESTROY_DIST;
736 /* "Give me space" */
737 case PET_ALLOW_SPACE: {
738 creature_ptr->pet_follow_distance = PET_SPACE_DIST;
742 case PET_STAY_AWAY: {
743 creature_ptr->pet_follow_distance = PET_AWAY_DIST;
746 /* flag - allow pets to open doors */
747 case PET_OPEN_DOORS: {
748 if (creature_ptr->pet_extra_flags & PF_OPEN_DOORS)
749 creature_ptr->pet_extra_flags &= ~(PF_OPEN_DOORS);
751 creature_ptr->pet_extra_flags |= (PF_OPEN_DOORS);
754 /* flag - allow pets to pickup items */
755 case PET_TAKE_ITEMS: {
756 if (creature_ptr->pet_extra_flags & PF_PICKUP_ITEMS) {
757 creature_ptr->pet_extra_flags &= ~(PF_PICKUP_ITEMS);
758 for (pet_ctr = creature_ptr->current_floor_ptr->m_max - 1; pet_ctr >= 1; pet_ctr--) {
759 m_ptr = &creature_ptr->current_floor_ptr->m_list[pet_ctr];
762 monster_drop_carried_objects(creature_ptr, m_ptr);
766 creature_ptr->pet_extra_flags |= (PF_PICKUP_ITEMS);
770 /* flag - allow pets to teleport */
772 if (creature_ptr->pet_extra_flags & PF_TELEPORT)
773 creature_ptr->pet_extra_flags &= ~(PF_TELEPORT);
775 creature_ptr->pet_extra_flags |= (PF_TELEPORT);
778 /* flag - allow pets to cast attack spell */
779 case PET_ATTACK_SPELL: {
780 if (creature_ptr->pet_extra_flags & PF_ATTACK_SPELL)
781 creature_ptr->pet_extra_flags &= ~(PF_ATTACK_SPELL);
783 creature_ptr->pet_extra_flags |= (PF_ATTACK_SPELL);
786 /* flag - allow pets to cast attack spell */
787 case PET_SUMMON_SPELL: {
788 if (creature_ptr->pet_extra_flags & PF_SUMMON_SPELL)
789 creature_ptr->pet_extra_flags &= ~(PF_SUMMON_SPELL);
791 creature_ptr->pet_extra_flags |= (PF_SUMMON_SPELL);
794 /* flag - allow pets to cast attack spell */
795 case PET_BALL_SPELL: {
796 if (creature_ptr->pet_extra_flags & PF_BALL_SPELL)
797 creature_ptr->pet_extra_flags &= ~(PF_BALL_SPELL);
799 creature_ptr->pet_extra_flags |= (PF_BALL_SPELL);
804 (void)do_cmd_riding(creature_ptr, FALSE);
809 do_name_pet(creature_ptr);
813 case PET_TWO_HANDS: {
814 if (creature_ptr->pet_extra_flags & PF_TWO_HANDS)
815 creature_ptr->pet_extra_flags &= ~(PF_TWO_HANDS);
817 creature_ptr->pet_extra_flags |= (PF_TWO_HANDS);
818 creature_ptr->update |= (PU_BONUS);
819 handle_stuff(creature_ptr);