1 #include "effect/effect-player-resist-hurt.h"
2 #include "inventory/inventory-damage.h"
3 #include "mind/racial-mirror-master.h"
4 #include "mspell/monster-spell.h"
5 #include "mutation/mutation.h"
6 #include "object-enchant/artifact.h"
7 #include "object/object-broken.h"
8 #include "player/player-damage.h"
9 #include "player/player-effects.h"
10 #include "player/player-races-table.h"
11 #include "spell/spells-status.h"
12 #include "spell/spells-teleport.h"
13 #include "spell/spells3.h"
14 #include "world/world.h"
17 void effect_player_elements(player_type *target_ptr, effect_player_type *ep_ptr,
18 concptr attack_message,
19 HIT_POINT (*damage_func)(player_type *, HIT_POINT,
20 concptr, int, bool)) {
21 if (target_ptr->blind)
22 msg_print(attack_message);
24 ep_ptr->get_damage = (*damage_func)(target_ptr, ep_ptr->dam, ep_ptr->killer,
25 ep_ptr->monspell, FALSE);
28 void effect_player_poison(player_type *target_ptr, effect_player_type *ep_ptr) {
29 bool double_resist = is_oppose_pois(target_ptr);
30 if (target_ptr->blind)
31 msg_print(_("毒で攻撃された!", "You are hit by poison!"));
33 if (target_ptr->resist_pois)
34 ep_ptr->dam = (ep_ptr->dam + 2) / 3;
36 ep_ptr->dam = (ep_ptr->dam + 2) / 3;
38 if ((!(double_resist || target_ptr->resist_pois)) && one_in_(HURT_CHANCE) &&
39 !check_multishadow(target_ptr)) {
40 do_dec_stat(target_ptr, A_CON);
43 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
44 ep_ptr->killer, ep_ptr->monspell);
46 if (!(double_resist || target_ptr->resist_pois) &&
47 !check_multishadow(target_ptr))
48 set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
51 void effect_player_nuke(player_type *target_ptr, effect_player_type *ep_ptr) {
52 bool double_resist = is_oppose_pois(target_ptr);
53 if (target_ptr->blind)
54 msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
56 if (target_ptr->resist_pois)
57 ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
59 ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
61 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
62 ep_ptr->killer, ep_ptr->monspell);
63 if ((double_resist || target_ptr->resist_pois) ||
64 check_multishadow(target_ptr))
67 set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
68 if (one_in_(5)) /* 6 */
71 _("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
72 if (one_in_(4)) /* 4 */
73 do_poly_self(target_ptr);
75 status_shuffle(target_ptr);
79 inventory_damage(target_ptr, set_acid_destroy, 2);
82 void effect_player_missile(player_type *target_ptr,
83 effect_player_type *ep_ptr) {
84 if (target_ptr->blind)
85 msg_print(_("何かで攻撃された!", "You are hit by something!"));
87 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
88 ep_ptr->killer, ep_ptr->monspell);
91 void effect_player_holy_fire(player_type *target_ptr,
92 effect_player_type *ep_ptr) {
93 if (target_ptr->blind)
94 msg_print(_("何かで攻撃された!", "You are hit by something!"));
96 if (target_ptr->align > 10)
98 else if (target_ptr->align < -10)
101 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
102 ep_ptr->killer, ep_ptr->monspell);
105 void effect_player_hell_fire(player_type *target_ptr,
106 effect_player_type *ep_ptr) {
107 if (target_ptr->blind)
108 msg_print(_("何かで攻撃された!", "You are hit by something!"));
110 if (target_ptr->align > 10)
113 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
114 ep_ptr->killer, ep_ptr->monspell);
117 void effect_player_arrow(player_type *target_ptr, effect_player_type *ep_ptr) {
118 if (target_ptr->blind) {
120 _("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
121 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
122 ep_ptr->killer, ep_ptr->monspell);
126 if ((target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) ||
127 (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU)) {
128 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
132 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
133 ep_ptr->killer, ep_ptr->monspell);
136 void effect_player_plasma(player_type *target_ptr, effect_player_type *ep_ptr) {
137 if (target_ptr->blind)
138 msg_print(_("何かとても熱いもので攻撃された!",
139 "You are hit by something *HOT*!"));
141 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
142 ep_ptr->killer, ep_ptr->monspell);
144 if (!target_ptr->resist_sound && !check_multishadow(target_ptr)) {
146 (randint1((ep_ptr->dam > 40) ? 35 : (ep_ptr->dam * 3 / 4 + 5)));
147 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
150 if (!(target_ptr->resist_fire || is_oppose_fire(target_ptr) ||
151 target_ptr->immune_fire))
152 inventory_damage(target_ptr, set_acid_destroy, 3);
155 void effect_player_nether(player_type *target_ptr, effect_player_type *ep_ptr) {
156 if (target_ptr->blind)
157 msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
159 if (target_ptr->resist_neth) {
160 if (!PRACE_IS_(target_ptr, RACE_SPECTRE))
162 ep_ptr->dam /= (randint1(4) + 7);
163 } else if (!check_multishadow(target_ptr))
164 drain_exp(target_ptr, 200 + (target_ptr->exp / 100),
165 200 + (target_ptr->exp / 1000), 75);
167 if (!PRACE_IS_(target_ptr, RACE_SPECTRE) || check_multishadow(target_ptr)) {
168 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
169 ep_ptr->killer, ep_ptr->monspell);
173 msg_print(_("気分がよくなった。", "You feel invigorated!"));
174 hp_player(target_ptr, ep_ptr->dam / 4);
175 learn_spell(target_ptr, ep_ptr->monspell);
178 void effect_player_water(player_type *target_ptr, effect_player_type *ep_ptr) {
179 if (target_ptr->blind)
181 _("何か湿ったもので攻撃された!", "You are hit by something wet!"));
182 if (check_multishadow(target_ptr)) {
183 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
184 ep_ptr->killer, ep_ptr->monspell);
188 if (!target_ptr->resist_sound && !target_ptr->resist_water) {
189 set_stun(target_ptr, target_ptr->stun + randint1(40));
191 if (!target_ptr->resist_conf && !target_ptr->resist_water) {
192 set_confused(target_ptr, target_ptr->confused + randint1(5) + 5);
195 if (one_in_(5) && !target_ptr->resist_water) {
196 inventory_damage(target_ptr, set_cold_destroy, 3);
199 if (target_ptr->resist_water)
200 ep_ptr->get_damage /= 4;
202 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
203 ep_ptr->killer, ep_ptr->monspell);
206 void effect_player_chaos(player_type *target_ptr, effect_player_type *ep_ptr) {
207 if (target_ptr->blind)
209 _("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
210 if (target_ptr->resist_chaos) {
212 ep_ptr->dam /= (randint1(4) + 7);
215 if (check_multishadow(target_ptr)) {
216 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
217 ep_ptr->killer, ep_ptr->monspell);
221 if (!target_ptr->resist_conf) {
222 (void)set_confused(target_ptr, target_ptr->confused + randint0(20) + 10);
224 if (!target_ptr->resist_chaos) {
225 (void)set_image(target_ptr, target_ptr->image + randint1(10));
227 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!",
228 "Your body is twisted by chaos!"));
229 (void)gain_mutation(target_ptr, 0);
232 if (!target_ptr->resist_neth && !target_ptr->resist_chaos) {
233 drain_exp(target_ptr, 5000 + (target_ptr->exp / 100),
234 500 + (target_ptr->exp / 1000), 75);
237 if (!target_ptr->resist_chaos || one_in_(9)) {
238 inventory_damage(target_ptr, set_elec_destroy, 2);
239 inventory_damage(target_ptr, set_fire_destroy, 2);
242 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
243 ep_ptr->killer, ep_ptr->monspell);
246 void effect_player_shards(player_type *target_ptr, effect_player_type *ep_ptr) {
247 if (target_ptr->blind)
249 _("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
250 if (target_ptr->resist_shard) {
252 ep_ptr->dam /= (randint1(4) + 7);
253 } else if (!check_multishadow(target_ptr)) {
254 (void)set_cut(target_ptr, target_ptr->cut + ep_ptr->dam);
257 if (!target_ptr->resist_shard || one_in_(13))
258 inventory_damage(target_ptr, set_cold_destroy, 2);
260 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
261 ep_ptr->killer, ep_ptr->monspell);
264 void effect_player_sound(player_type *target_ptr, effect_player_type *ep_ptr) {
265 if (target_ptr->blind)
266 msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
267 if (target_ptr->resist_sound) {
269 ep_ptr->dam /= (randint1(4) + 7);
270 } else if (!check_multishadow(target_ptr)) {
271 int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
272 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
275 if (!target_ptr->resist_sound || one_in_(13))
276 inventory_damage(target_ptr, set_cold_destroy, 2);
278 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
279 ep_ptr->killer, ep_ptr->monspell);
282 void effect_player_confusion(player_type *target_ptr,
283 effect_player_type *ep_ptr) {
284 if (target_ptr->blind)
285 msg_print(_("何か混乱するもので攻撃された!",
286 "You are hit by something puzzling!"));
287 if (target_ptr->resist_conf) {
289 ep_ptr->dam /= (randint1(4) + 7);
290 } else if (!check_multishadow(target_ptr)) {
291 (void)set_confused(target_ptr, target_ptr->confused + randint1(20) + 10);
294 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
295 ep_ptr->killer, ep_ptr->monspell);
298 void effect_player_disenchant(player_type *target_ptr,
299 effect_player_type *ep_ptr) {
300 if (target_ptr->blind)
301 msg_print(_("何かさえないもので攻撃された!",
302 "You are hit by something static!"));
303 if (target_ptr->resist_disen) {
305 ep_ptr->dam /= (randint1(4) + 7);
306 } else if (!check_multishadow(target_ptr)) {
307 (void)apply_disenchant(target_ptr, 0);
310 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
311 ep_ptr->killer, ep_ptr->monspell);
314 void effect_player_nexus(player_type *target_ptr, effect_player_type *ep_ptr) {
315 if (target_ptr->blind)
317 _("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
318 if (target_ptr->resist_nexus) {
320 ep_ptr->dam /= (randint1(4) + 7);
321 } else if (!check_multishadow(target_ptr)) {
322 apply_nexus(ep_ptr->m_ptr, target_ptr);
325 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
326 ep_ptr->killer, ep_ptr->monspell);
329 void effect_player_force(player_type *target_ptr, effect_player_type *ep_ptr) {
330 if (target_ptr->blind)
332 _("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
333 if (!target_ptr->resist_sound && !check_multishadow(target_ptr)) {
334 (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
337 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
338 ep_ptr->killer, ep_ptr->monspell);
341 void effect_player_rocket(player_type *target_ptr, effect_player_type *ep_ptr) {
342 if (target_ptr->blind)
343 msg_print(_("爆発があった!", "There is an explosion!"));
344 if (!target_ptr->resist_sound && !check_multishadow(target_ptr)) {
345 (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
348 if (target_ptr->resist_shard) {
350 } else if (!check_multishadow(target_ptr)) {
351 (void)set_cut(target_ptr, target_ptr->cut + (ep_ptr->dam / 2));
354 if (!target_ptr->resist_shard || one_in_(12)) {
355 inventory_damage(target_ptr, set_cold_destroy, 3);
358 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
359 ep_ptr->killer, ep_ptr->monspell);
362 void effect_player_inertial(player_type *target_ptr,
363 effect_player_type *ep_ptr) {
364 if (target_ptr->blind)
366 _("何か遅いもので攻撃された!", "You are hit by something slow!"));
367 if (!check_multishadow(target_ptr))
368 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
370 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
371 ep_ptr->killer, ep_ptr->monspell);
374 void effect_player_lite(player_type *target_ptr, effect_player_type *ep_ptr) {
375 if (target_ptr->blind)
376 msg_print(_("何かで攻撃された!", "You are hit by something!"));
377 if (target_ptr->resist_lite) {
379 ep_ptr->dam /= (randint1(4) + 7);
380 } else if (!target_ptr->blind && !target_ptr->resist_blind &&
381 !check_multishadow(target_ptr)) {
382 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
385 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) ||
386 (target_ptr->mimic_form == MIMIC_VAMPIRE)) {
387 if (!check_multishadow(target_ptr))
388 msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
390 } else if (PRACE_IS_(target_ptr, RACE_S_FAIRY)) {
391 ep_ptr->dam = ep_ptr->dam * 4 / 3;
394 if (target_ptr->wraith_form)
396 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
397 ep_ptr->killer, ep_ptr->monspell);
399 if (!target_ptr->wraith_form || check_multishadow(target_ptr))
402 target_ptr->wraith_form = 0;
403 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
404 "The light forces you out of your incorporeal shadow form."));
406 target_ptr->redraw |= (PR_MAP | PR_STATUS);
407 target_ptr->update |= (PU_MONSTERS);
408 target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
411 void effect_player_dark(player_type *target_ptr, effect_player_type *ep_ptr) {
412 if (target_ptr->blind)
413 msg_print(_("何かで攻撃された!", "You are hit by something!"));
414 if (target_ptr->resist_dark) {
416 ep_ptr->dam /= (randint1(4) + 7);
418 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) ||
419 (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form)
421 } else if (!target_ptr->blind && !target_ptr->resist_blind &&
422 !check_multishadow(target_ptr)) {
423 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
426 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
427 ep_ptr->killer, ep_ptr->monspell);
430 static void effect_player_time_one_disability(player_type *target_ptr) {
433 switch (randint1(6)) {
436 act = _("強く", "strong");
440 act = _("聡明で", "bright");
444 act = _("賢明で", "wise");
448 act = _("器用で", "agile");
452 act = _("健康で", "hale");
456 act = _("美しく", "beautiful");
460 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
461 "You're not as %s as you used to be..."),
463 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 3) / 4;
464 if (target_ptr->stat_cur[k] < 3)
465 target_ptr->stat_cur[k] = 3;
467 target_ptr->update |= (PU_BONUS);
470 static void effect_player_time_all_disabilities(player_type *target_ptr) {
471 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
472 "You're not as powerful as you used to be..."));
473 for (int k = 0; k < A_MAX; k++) {
474 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
475 if (target_ptr->stat_cur[k] < 3)
476 target_ptr->stat_cur[k] = 3;
479 target_ptr->update |= (PU_BONUS);
482 static void effect_player_time_addition(player_type *target_ptr) {
483 switch (randint1(10)) {
489 if (target_ptr->prace == RACE_ANDROID)
492 msg_print(_("人生が逆戻りした気がする。",
493 "You feel like a chunk of the past has been ripped away."));
494 lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
501 effect_player_time_one_disability(target_ptr);
504 effect_player_time_all_disabilities(target_ptr);
509 void effect_player_time(player_type *target_ptr, effect_player_type *ep_ptr) {
510 if (target_ptr->blind)
511 msg_print(_("過去からの衝撃に攻撃された!",
512 "You are hit by a blast from the past!"));
514 if (target_ptr->resist_time) {
516 ep_ptr->dam /= (randint1(4) + 7);
517 msg_print(_("時間が通り過ぎていく気がする。",
518 "You feel as if time is passing you by."));
519 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
520 ep_ptr->killer, ep_ptr->monspell);
524 if (check_multishadow(target_ptr)) {
525 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
526 ep_ptr->killer, ep_ptr->monspell);
530 effect_player_time_addition(target_ptr);
531 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
532 ep_ptr->killer, ep_ptr->monspell);
535 void effect_player_gravity(player_type *target_ptr,
536 effect_player_type *ep_ptr) {
537 if (target_ptr->blind)
539 _("何か重いもので攻撃された!", "You are hit by something heavy!"));
540 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
542 if (!check_multishadow(target_ptr)) {
543 teleport_player(target_ptr, 5, TELEPORT_PASSIVE);
544 if (!target_ptr->levitation)
545 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
546 if (!(target_ptr->resist_sound || target_ptr->levitation)) {
548 (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
549 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
553 if (target_ptr->levitation) {
554 ep_ptr->dam = (ep_ptr->dam * 2) / 3;
557 if (!target_ptr->levitation || one_in_(13)) {
558 inventory_damage(target_ptr, set_cold_destroy, 2);
561 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
562 ep_ptr->killer, ep_ptr->monspell);
565 void effect_player_disintegration(player_type *target_ptr,
566 effect_player_type *ep_ptr) {
567 if (target_ptr->blind)
569 _("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
571 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
572 ep_ptr->killer, ep_ptr->monspell);