OSDN Git Service

[Refactor] struct player_type を class PlayerType に置換。
[hengbandforosx/hengbandosx.git] / src / object-activation / activation-teleport.cpp
1 #include "object-activation/activation-teleport.h"
2 #include "cmd-io/cmd-save.h"
3 #include "core/asking-player.h"
4 #include "game-option/special-options.h"
5 #include "spell-kind/spells-grid.h"
6 #include "spell-kind/spells-launcher.h"
7 #include "spell-kind/spells-teleport.h"
8 #include "spell-kind/spells-world.h"
9 #include "effect/attribute-types.h"
10 #include "system/player-type-definition.h"
11 #include "target/target-getter.h"
12 #include "view/display-messages.h"
13
14 bool activate_teleport_away(PlayerType *player_ptr)
15 {
16     DIRECTION dir;
17     if (!get_aim_dir(player_ptr, &dir))
18         return false;
19
20     (void)fire_beam(player_ptr, AttributeType::AWAY_ALL, dir, player_ptr->lev);
21     return true;
22 }
23
24 bool activate_escape(PlayerType *player_ptr)
25 {
26     switch (randint1(13)) {
27     case 1:
28     case 2:
29     case 3:
30     case 4:
31     case 5:
32         teleport_player(player_ptr, 10, TELEPORT_SPONTANEOUS);
33         return true;
34     case 6:
35     case 7:
36     case 8:
37     case 9:
38     case 10:
39         teleport_player(player_ptr, 222, TELEPORT_SPONTANEOUS);
40         return true;
41     case 11:
42     case 12:
43         (void)stair_creation(player_ptr);
44         return true;
45     default:
46         if (!get_check(_("この階を去りますか?", "Leave this level? ")))
47             return true;
48
49         if (autosave_l)
50             do_cmd_save_game(player_ptr, true);
51
52         player_ptr->leaving = true;
53         return true;
54     }
55 }
56
57 bool activate_teleport_level(PlayerType *player_ptr)
58 {
59     if (!get_check(_("本当に他の階にテレポートしますか?", "Are you sure? (Teleport Level)")))
60         return false;
61
62     teleport_level(player_ptr, 0);
63     return true;
64 }
65
66 bool activate_dimension_door(PlayerType *player_ptr)
67 {
68     msg_print(_("次元の扉が開いた。目的地を選んで下さい。", "You open a dimensional gate. Choose a destination."));
69     return dimension_door(player_ptr);
70 }
71
72 bool activate_teleport(PlayerType *player_ptr)
73 {
74     msg_print(_("周りの空間が歪んでいる...", "It twists space around you..."));
75     teleport_player(player_ptr, 100, TELEPORT_SPONTANEOUS);
76     return true;
77 }
78
79 bool activate_phase_door(PlayerType *player_ptr)
80 {
81     teleport_player(player_ptr, 10, TELEPORT_SPONTANEOUS);
82     return true;
83 }