OSDN Git Service

Merge branch 'master' of git.osdn.net:/gitroot/hengband/hengband
[hengband/hengband.git] / src / spell-realm / spells-trump.c
1 #include "spell-realm/spells-trump.h"
2 #include "monster-floor/monster-summon.h"
3 #include "monster-floor/place-monster-types.h"
4 #include "mutation/mutation-investor-remover.h"
5 #include "player-info/avatar.h"
6 #include "spell-kind/earthquake.h"
7 #include "spell-kind/spells-charm.h"
8 #include "spell-kind/spells-floor.h"
9 #include "spell-kind/spells-lite.h"
10 #include "spell-kind/spells-neighbor.h"
11 #include "spell-kind/spells-random.h"
12 #include "spell-kind/spells-sight.h"
13 #include "spell-kind/spells-teleport.h"
14 #include "spell/spells-status.h"
15 #include "spell/spells-summon.h"
16 #include "spell/summon-types.h"
17 #include "status/base-status.h"
18 #include "status/buff-setter.h"
19 #include "status/experience.h"
20 #include "system/floor-type-definition.h"
21 #include "target/target-getter.h"
22 #include "view/display-messages.h"
23
24 /*!
25  * @brief トランプ領域の「シャッフル」の効果をランダムに決めて処理する。
26  * @param caster_ptr プレーヤーへの参照ポインタ
27  * @return なし
28  */
29 void cast_shuffle(player_type *caster_ptr)
30 {
31     PLAYER_LEVEL plev = caster_ptr->lev;
32     DIRECTION dir;
33     int die;
34     int vir = virtue_number(caster_ptr, V_CHANCE);
35     int i;
36
37     if ((caster_ptr->pclass == CLASS_ROGUE) || (caster_ptr->pclass == CLASS_HIGH_MAGE) || (caster_ptr->pclass == CLASS_SORCERER))
38         die = (randint1(110)) + plev / 5;
39     else
40         die = randint1(120);
41
42     if (vir) {
43         if (caster_ptr->virtues[vir - 1] > 0) {
44             while (randint1(400) < caster_ptr->virtues[vir - 1])
45                 die++;
46         } else {
47             while (randint1(400) < (0 - caster_ptr->virtues[vir - 1]))
48                 die--;
49         }
50     }
51
52     msg_print(_("あなたはカードを切って一枚引いた...", "You shuffle the deck and draw a card..."));
53
54     if (die < 30) {
55         chg_virtue(caster_ptr, V_CHANCE, 1);
56     }
57
58     floor_type *floor_ptr = caster_ptr->current_floor_ptr;
59     if (die < 7) {
60         msg_print(_("なんてこった!《死》だ!", "Oh no! It's Death!"));
61
62         for (i = 0; i < randint1(3); i++) {
63             activate_hi_summon(caster_ptr, caster_ptr->y, caster_ptr->x, FALSE);
64         }
65
66         return;
67     }
68
69     if (die < 14) {
70         msg_print(_("なんてこった!《悪魔》だ!", "Oh no! It's the Devil!"));
71         summon_specific(caster_ptr, 0, caster_ptr->y, caster_ptr->x, floor_ptr->dun_level, SUMMON_DEMON, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE | PM_NO_PET));
72         return;
73     }
74
75     if (die < 18) {
76         int count = 0;
77         msg_print(_("なんてこった!《吊られた男》だ!", "Oh no! It's the Hanged Man."));
78         activate_ty_curse(caster_ptr, FALSE, &count);
79         return;
80     }
81
82     if (die < 22) {
83         msg_print(_("《不調和の剣》だ。", "It's the swords of discord."));
84         aggravate_monsters(caster_ptr, 0);
85         return;
86     }
87
88     if (die < 26) {
89         msg_print(_("《愚者》だ。", "It's the Fool."));
90         do_dec_stat(caster_ptr, A_INT);
91         do_dec_stat(caster_ptr, A_WIS);
92         return;
93     }
94
95     if (die < 30) {
96         msg_print(_("奇妙なモンスターの絵だ。", "It's the picture of a strange monster."));
97         trump_summoning(
98             caster_ptr, 1, FALSE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), (32 + randint1(6)), PM_ALLOW_GROUP | PM_ALLOW_UNIQUE);
99         return;
100     }
101
102     if (die < 33) {
103         msg_print(_("《月》だ。", "It's the Moon."));
104         unlite_area(caster_ptr, 10, 3);
105         return;
106     }
107
108     if (die < 38) {
109         msg_print(_("《運命の輪》だ。", "It's the Wheel of Fortune."));
110         wild_magic(caster_ptr, randint0(32));
111         return;
112     }
113
114     if (die < 40) {
115         msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
116         teleport_player(caster_ptr, 10, TELEPORT_PASSIVE);
117         return;
118     }
119
120     if (die < 42) {
121         msg_print(_("《正義》だ。", "It's Justice."));
122         set_blessed(caster_ptr, caster_ptr->lev, FALSE);
123         return;
124     }
125
126     if (die < 47) {
127         msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
128         teleport_player(caster_ptr, 100, TELEPORT_PASSIVE);
129         return;
130     }
131
132     if (die < 52) {
133         msg_print(_("テレポート・カードだ。", "It's a teleport trump card."));
134         teleport_player(caster_ptr, 200, TELEPORT_PASSIVE);
135         return;
136     }
137
138     if (die < 60) {
139         msg_print(_("《塔》だ。", "It's the Tower."));
140         wall_breaker(caster_ptr);
141         return;
142     }
143
144     if (die < 72) {
145         msg_print(_("《節制》だ。", "It's Temperance."));
146         sleep_monsters_touch(caster_ptr);
147         return;
148     }
149
150     if (die < 80) {
151         msg_print(_("《塔》だ。", "It's the Tower."));
152         earthquake(caster_ptr, caster_ptr->y, caster_ptr->x, 5, 0);
153         return;
154     }
155
156     if (die < 82) {
157         msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
158         trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_MOLD, 0L);
159         return;
160     }
161
162     if (die < 84) {
163         msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
164         trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_BAT, 0L);
165         return;
166     }
167
168     if (die < 86) {
169         msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
170         trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_VORTEX, 0L);
171         return;
172     }
173
174     if (die < 88) {
175         msg_print(_("友好的なモンスターの絵だ。", "It's the picture of a friendly monster."));
176         trump_summoning(caster_ptr, 1, TRUE, caster_ptr->y, caster_ptr->x, (floor_ptr->dun_level * 3 / 2), SUMMON_COIN_MIMIC, 0L);
177         return;
178     }
179
180     if (die < 96) {
181         msg_print(_("《恋人》だ。", "It's the Lovers."));
182
183         if (get_aim_dir(caster_ptr, &dir)) {
184             charm_monster(caster_ptr, dir, MIN(caster_ptr->lev, 20));
185         }
186
187         return;
188     }
189
190     if (die < 101) {
191         msg_print(_("《隠者》だ。", "It's the Hermit."));
192         wall_stone(caster_ptr);
193         return;
194     }
195
196     if (die < 111) {
197         msg_print(_("《審判》だ。", "It's the Judgement."));
198         roll_hitdice(caster_ptr, 0L);
199         lose_all_mutations(caster_ptr);
200         return;
201     }
202
203     if (die < 120) {
204         msg_print(_("《太陽》だ。", "It's the Sun."));
205         chg_virtue(caster_ptr, V_KNOWLEDGE, 1);
206         chg_virtue(caster_ptr, V_ENLIGHTEN, 1);
207         wiz_lite(caster_ptr, FALSE);
208         return;
209     }
210
211     msg_print(_("《世界》だ。", "It's the World."));
212     if (caster_ptr->exp >= PY_MAX_EXP) {
213         return;
214     }
215
216     s32b ee = (caster_ptr->exp / 25) + 1;
217     if (ee > 5000)
218         ee = 5000;
219     msg_print(_("更に経験を積んだような気がする。", "You feel more experienced."));
220     gain_exp(caster_ptr, ee);
221 }
222
223 void become_living_trump(player_type *creature_ptr)
224 {
225     /* 1/7 Teleport control and 6/7 Random teleportation (uncontrolled) */
226     MUTATION_IDX mutation = one_in_(7) ? 12 : 77;
227     if (gain_mutation(creature_ptr, mutation))
228         msg_print(_("あなたは生きているカードに変わった。", "You have turned into a Living Trump."));
229 }