OSDN Git Service

Merge remote-tracking branch 'remotes/hengband-osx/For2.2.2-Refactoring-English-New...
[hengband/hengband.git] / src / monster-attack / monster-attack-status.c
1 /*!
2  * @brief プレーヤーのステータス (麻痺等)に影響を与えるモンスターの打撃処理
3  * @date 2020/05/31
4  * @author Hourier
5  */
6
7 #include "monster-attack/monster-attack-status.h"
8 #include "core/player-update-types.h"
9 #include "mind/mind-mirror-master.h"
10 #include "monster-race/monster-race.h"
11 #include "monster-race/race-indice-types.h"
12 #include "status/bad-status-setter.h"
13 #include "status/base-status.h"
14 #include "status/experience.h"
15 #include "view/display-messages.h"
16
17 void process_blind_attack(player_type *target_ptr, monap_type *monap_ptr)
18 {
19     if (target_ptr->resist_blind || check_multishadow(target_ptr))
20         return;
21
22     if (!set_blind(target_ptr, target_ptr->blind + 10 + randint1(monap_ptr->rlev)))
23         return;
24
25     if (monap_ptr->m_ptr->r_idx == MON_DIO)
26         msg_print(_("どうだッ!この血の目潰しはッ!", "How is it! This blood-blinding!"));
27
28     monap_ptr->obvious = TRUE;
29 }
30
31 void process_terrify_attack(player_type *target_ptr, monap_type *monap_ptr)
32 {
33     if (check_multishadow(target_ptr))
34         return;
35
36     monster_race *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
37     if (target_ptr->resist_fear) {
38         msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
39         monap_ptr->obvious = TRUE;
40         return;
41     }
42
43     if (randint0(100 + r_ptr->level / 2) < target_ptr->skill_sav) {
44         msg_print(_("しかし恐怖に侵されなかった!", "You stand your ground!"));
45         monap_ptr->obvious = TRUE;
46         return;
47     }
48
49     if (set_afraid(target_ptr, target_ptr->afraid + 3 + randint1(monap_ptr->rlev)))
50         monap_ptr->obvious = TRUE;
51 }
52
53 void process_paralyze_attack(player_type *target_ptr, monap_type *monap_ptr)
54 {
55     if (check_multishadow(target_ptr))
56         return;
57
58     monster_race *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
59     if (target_ptr->free_act) {
60         msg_print(_("しかし効果がなかった!", "You are unaffected!"));
61         monap_ptr->obvious = TRUE;
62         return;
63     }
64
65     if (randint0(100 + r_ptr->level / 2) < target_ptr->skill_sav) {
66         msg_print(_("しかし効力を跳ね返した!", "You resist the effects!"));
67         monap_ptr->obvious = TRUE;
68         return;
69     }
70
71     if (!target_ptr->paralyzed && set_paralyzed(target_ptr, 3 + randint1(monap_ptr->rlev)))
72         monap_ptr->obvious = TRUE;
73 }
74
75 void process_lose_all_attack(player_type *target_ptr, monap_type *monap_ptr)
76 {
77     if (do_dec_stat(target_ptr, A_STR))
78         monap_ptr->obvious = TRUE;
79
80     if (do_dec_stat(target_ptr, A_DEX))
81         monap_ptr->obvious = TRUE;
82
83     if (do_dec_stat(target_ptr, A_CON))
84         monap_ptr->obvious = TRUE;
85
86     if (do_dec_stat(target_ptr, A_INT))
87         monap_ptr->obvious = TRUE;
88
89     if (do_dec_stat(target_ptr, A_WIS))
90         monap_ptr->obvious = TRUE;
91
92     if (do_dec_stat(target_ptr, A_CHR))
93         monap_ptr->obvious = TRUE;
94 }
95
96 void process_stun_attack(player_type *target_ptr, monap_type *monap_ptr)
97 {
98     if (target_ptr->resist_sound || check_multishadow(target_ptr))
99         return;
100
101     monster_race *r_ptr = &r_info[monap_ptr->m_ptr->r_idx];
102     if (set_stun(target_ptr, target_ptr->stun + 10 + randint1(r_ptr->level / 4)))
103         monap_ptr->obvious = TRUE;
104 }
105
106 /*!
107  * @brief 時間逆転攻撃による能力低下
108  * @param target_ptr プレーヤーへの参照ポインタ
109  * @monap_ptr モンスターからモンスターへの直接攻撃構造体への参照ポインタ
110  * @return なし
111  */
112 static void describe_disability(player_type *target_ptr, monap_type *monap_ptr)
113 {
114     int stat = randint0(6);
115     switch (stat) {
116     case A_STR:
117         monap_ptr->act = _("強く", "strong");
118         break;
119     case A_INT:
120         monap_ptr->act = _("聡明で", "bright");
121         break;
122     case A_WIS:
123         monap_ptr->act = _("賢明で", "wise");
124         break;
125     case A_DEX:
126         monap_ptr->act = _("器用で", "agile");
127         break;
128     case A_CON:
129         monap_ptr->act = _("健康で", "hale");
130         break;
131     case A_CHR:
132         monap_ptr->act = _("美しく", "beautiful");
133         break;
134     }
135
136     msg_format(_("あなたは以前ほど%sなくなってしまった...。", "You're not as %s as you used to be..."), monap_ptr->act);
137     target_ptr->stat_cur[stat] = (target_ptr->stat_cur[stat] * 3) / 4;
138     if (target_ptr->stat_cur[stat] < 3)
139         target_ptr->stat_cur[stat] = 3;
140 }
141
142 void process_monster_attack_time(player_type *target_ptr, monap_type *monap_ptr)
143 {
144     if (target_ptr->resist_time || check_multishadow(target_ptr))
145         return;
146
147     switch (randint1(10)) {
148     case 1:
149     case 2:
150     case 3:
151     case 4:
152     case 5: {
153         if (target_ptr->prace == RACE_ANDROID)
154             break;
155
156         msg_print(_("人生が逆戻りした気がする。", "You feel like a chunk of the past has been ripped away."));
157         lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
158         break;
159     }
160     case 6:
161     case 7:
162     case 8:
163     case 9: {
164         describe_disability(target_ptr, monap_ptr);
165         target_ptr->update |= (PU_BONUS);
166         break;
167     }
168     case 10: {
169         msg_print(_("あなたは以前ほど力強くなくなってしまった...。", "You're not as powerful as you used to be..."));
170         for (int i = 0; i < A_MAX; i++) {
171             target_ptr->stat_cur[i] = (target_ptr->stat_cur[i] * 7) / 8;
172             if (target_ptr->stat_cur[i] < 3)
173                 target_ptr->stat_cur[i] = 3;
174         }
175
176         target_ptr->update |= (PU_BONUS);
177         break;
178     }
179     }
180 }