2 #include "effect/effect-player-util.h"
3 #include "effect/effect-player-resist-hurt.h"
4 #include "player-damage.h"
5 #include "world/world.h"
6 #include "object/object-broken.h"
8 #include "player-effects.h"
9 #include "mutation/mutation.h"
10 #include "monster-spell.h"
11 #include "spells-status.h"
12 #include "spell/spells3.h"
15 void effect_player_elements(player_type *target_ptr, effect_player_type *ep_ptr,
16 concptr attack_message,
17 HIT_POINT (*damage_func)(player_type *, HIT_POINT,
18 concptr, int, bool)) {
19 if (target_ptr->blind)
20 msg_print(attack_message);
22 ep_ptr->get_damage = (*damage_func)(target_ptr, ep_ptr->dam, ep_ptr->killer,
23 ep_ptr->monspell, FALSE);
26 void effect_player_poison(player_type *target_ptr, effect_player_type *ep_ptr) {
27 bool double_resist = is_oppose_pois(target_ptr);
28 if (target_ptr->blind)
29 msg_print(_("毒で攻撃された!", "You are hit by poison!"));
31 if (target_ptr->resist_pois)
32 ep_ptr->dam = (ep_ptr->dam + 2) / 3;
34 ep_ptr->dam = (ep_ptr->dam + 2) / 3;
36 if ((!(double_resist || target_ptr->resist_pois)) && one_in_(HURT_CHANCE) &&
37 !CHECK_MULTISHADOW(target_ptr)) {
38 do_dec_stat(target_ptr, A_CON);
41 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
42 ep_ptr->killer, ep_ptr->monspell);
44 if (!(double_resist || target_ptr->resist_pois) &&
45 !CHECK_MULTISHADOW(target_ptr))
46 set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
49 void effect_player_nuke(player_type *target_ptr, effect_player_type *ep_ptr) {
50 bool double_resist = is_oppose_pois(target_ptr);
51 if (target_ptr->blind)
52 msg_print(_("放射能で攻撃された!", "You are hit by radiation!"));
54 if (target_ptr->resist_pois)
55 ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
57 ep_ptr->dam = (2 * ep_ptr->dam + 2) / 5;
59 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
60 ep_ptr->killer, ep_ptr->monspell);
61 if ((double_resist || target_ptr->resist_pois) ||
62 CHECK_MULTISHADOW(target_ptr))
65 set_poisoned(target_ptr, target_ptr->poisoned + randint0(ep_ptr->dam) + 10);
66 if (one_in_(5)) /* 6 */
69 _("奇形的な変身を遂げた!", "You undergo a freakish metamorphosis!"));
70 if (one_in_(4)) /* 4 */
71 do_poly_self(target_ptr);
73 status_shuffle(target_ptr);
77 inventory_damage(target_ptr, set_acid_destroy, 2);
80 void effect_player_missile(player_type *target_ptr,
81 effect_player_type *ep_ptr) {
82 if (target_ptr->blind)
83 msg_print(_("何かで攻撃された!", "You are hit by something!"));
85 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
86 ep_ptr->killer, ep_ptr->monspell);
89 void effect_player_holy_fire(player_type *target_ptr,
90 effect_player_type *ep_ptr) {
91 if (target_ptr->blind)
92 msg_print(_("何かで攻撃された!", "You are hit by something!"));
94 if (target_ptr->align > 10)
96 else if (target_ptr->align < -10)
99 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
100 ep_ptr->killer, ep_ptr->monspell);
103 void effect_player_hell_fire(player_type *target_ptr,
104 effect_player_type *ep_ptr) {
105 if (target_ptr->blind)
106 msg_print(_("何かで攻撃された!", "You are hit by something!"));
108 if (target_ptr->align > 10)
111 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
112 ep_ptr->killer, ep_ptr->monspell);
115 void effect_player_arrow(player_type *target_ptr, effect_player_type *ep_ptr) {
116 if (target_ptr->blind) {
118 _("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
119 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
120 ep_ptr->killer, ep_ptr->monspell);
124 if ((target_ptr->inventory_list[INVEN_RARM].name1 == ART_ZANTETSU) ||
125 (target_ptr->inventory_list[INVEN_LARM].name1 == ART_ZANTETSU)) {
126 msg_print(_("矢を斬り捨てた!", "You cut down the arrow!"));
130 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
131 ep_ptr->killer, ep_ptr->monspell);
134 void effect_player_plasma(player_type *target_ptr, effect_player_type *ep_ptr) {
135 if (target_ptr->blind)
136 msg_print(_("何かとても熱いもので攻撃された!",
137 "You are hit by something *HOT*!"));
139 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
140 ep_ptr->killer, ep_ptr->monspell);
142 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr)) {
144 (randint1((ep_ptr->dam > 40) ? 35 : (ep_ptr->dam * 3 / 4 + 5)));
145 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
148 if (!(target_ptr->resist_fire || is_oppose_fire(target_ptr) ||
149 target_ptr->immune_fire))
150 inventory_damage(target_ptr, set_acid_destroy, 3);
153 void effect_player_nether(player_type *target_ptr, effect_player_type *ep_ptr) {
154 if (target_ptr->blind)
155 msg_print(_("地獄の力で攻撃された!", "You are hit by nether forces!"));
157 if (target_ptr->resist_neth) {
158 if (!PRACE_IS_(target_ptr, RACE_SPECTRE))
160 ep_ptr->dam /= (randint1(4) + 7);
161 } else if (!CHECK_MULTISHADOW(target_ptr))
162 drain_exp(target_ptr, 200 + (target_ptr->exp / 100),
163 200 + (target_ptr->exp / 1000), 75);
165 if (!PRACE_IS_(target_ptr, RACE_SPECTRE) || CHECK_MULTISHADOW(target_ptr)) {
166 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
167 ep_ptr->killer, ep_ptr->monspell);
171 msg_print(_("気分がよくなった。", "You feel invigorated!"));
172 hp_player(target_ptr, ep_ptr->dam / 4);
173 learn_spell(target_ptr, ep_ptr->monspell);
176 void effect_player_water(player_type *target_ptr, effect_player_type *ep_ptr) {
177 if (target_ptr->blind)
179 _("何か湿ったもので攻撃された!", "You are hit by something wet!"));
180 if (CHECK_MULTISHADOW(target_ptr)) {
181 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
182 ep_ptr->killer, ep_ptr->monspell);
186 if (!target_ptr->resist_sound && !target_ptr->resist_water) {
187 set_stun(target_ptr, target_ptr->stun + randint1(40));
189 if (!target_ptr->resist_conf && !target_ptr->resist_water) {
190 set_confused(target_ptr, target_ptr->confused + randint1(5) + 5);
193 if (one_in_(5) && !target_ptr->resist_water) {
194 inventory_damage(target_ptr, set_cold_destroy, 3);
197 if (target_ptr->resist_water)
198 ep_ptr->get_damage /= 4;
200 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
201 ep_ptr->killer, ep_ptr->monspell);
204 void effect_player_chaos(player_type *target_ptr, effect_player_type *ep_ptr) {
205 if (target_ptr->blind)
207 _("無秩序の波動で攻撃された!", "You are hit by a wave of anarchy!"));
208 if (target_ptr->resist_chaos) {
210 ep_ptr->dam /= (randint1(4) + 7);
213 if (CHECK_MULTISHADOW(target_ptr)) {
214 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
215 ep_ptr->killer, ep_ptr->monspell);
219 if (!target_ptr->resist_conf) {
220 (void)set_confused(target_ptr, target_ptr->confused + randint0(20) + 10);
222 if (!target_ptr->resist_chaos) {
223 (void)set_image(target_ptr, target_ptr->image + randint1(10));
225 msg_print(_("あなたの身体はカオスの力で捻じ曲げられた!",
226 "Your body is twisted by chaos!"));
227 (void)gain_mutation(target_ptr, 0);
230 if (!target_ptr->resist_neth && !target_ptr->resist_chaos) {
231 drain_exp(target_ptr, 5000 + (target_ptr->exp / 100),
232 500 + (target_ptr->exp / 1000), 75);
235 if (!target_ptr->resist_chaos || one_in_(9)) {
236 inventory_damage(target_ptr, set_elec_destroy, 2);
237 inventory_damage(target_ptr, set_fire_destroy, 2);
240 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
241 ep_ptr->killer, ep_ptr->monspell);
244 void effect_player_shards(player_type *target_ptr, effect_player_type *ep_ptr) {
245 if (target_ptr->blind)
247 _("何か鋭いもので攻撃された!", "You are hit by something sharp!"));
248 if (target_ptr->resist_shard) {
250 ep_ptr->dam /= (randint1(4) + 7);
251 } else if (!CHECK_MULTISHADOW(target_ptr)) {
252 (void)set_cut(target_ptr, target_ptr->cut + ep_ptr->dam);
255 if (!target_ptr->resist_shard || one_in_(13))
256 inventory_damage(target_ptr, set_cold_destroy, 2);
258 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
259 ep_ptr->killer, ep_ptr->monspell);
262 void effect_player_sound(player_type *target_ptr, effect_player_type *ep_ptr) {
263 if (target_ptr->blind)
264 msg_print(_("轟音で攻撃された!", "You are hit by a loud noise!"));
265 if (target_ptr->resist_sound) {
267 ep_ptr->dam /= (randint1(4) + 7);
268 } else if (!CHECK_MULTISHADOW(target_ptr)) {
269 int plus_stun = (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
270 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
273 if (!target_ptr->resist_sound || one_in_(13))
274 inventory_damage(target_ptr, set_cold_destroy, 2);
276 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
277 ep_ptr->killer, ep_ptr->monspell);
280 void effect_player_confusion(player_type *target_ptr,
281 effect_player_type *ep_ptr) {
282 if (target_ptr->blind)
283 msg_print(_("何か混乱するもので攻撃された!",
284 "You are hit by something puzzling!"));
285 if (target_ptr->resist_conf) {
287 ep_ptr->dam /= (randint1(4) + 7);
288 } else if (!CHECK_MULTISHADOW(target_ptr)) {
289 (void)set_confused(target_ptr, target_ptr->confused + randint1(20) + 10);
292 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
293 ep_ptr->killer, ep_ptr->monspell);
296 void effect_player_disenchant(player_type *target_ptr,
297 effect_player_type *ep_ptr) {
298 if (target_ptr->blind)
299 msg_print(_("何かさえないもので攻撃された!",
300 "You are hit by something static!"));
301 if (target_ptr->resist_disen) {
303 ep_ptr->dam /= (randint1(4) + 7);
304 } else if (!CHECK_MULTISHADOW(target_ptr)) {
305 (void)apply_disenchant(target_ptr, 0);
308 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
309 ep_ptr->killer, ep_ptr->monspell);
312 void effect_player_nexus(player_type *target_ptr, effect_player_type *ep_ptr) {
313 if (target_ptr->blind)
315 _("何か奇妙なもので攻撃された!", "You are hit by something strange!"));
316 if (target_ptr->resist_nexus) {
318 ep_ptr->dam /= (randint1(4) + 7);
319 } else if (!CHECK_MULTISHADOW(target_ptr)) {
320 apply_nexus(ep_ptr->m_ptr, target_ptr);
323 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
324 ep_ptr->killer, ep_ptr->monspell);
327 void effect_player_force(player_type *target_ptr, effect_player_type *ep_ptr) {
328 if (target_ptr->blind)
330 _("運動エネルギーで攻撃された!", "You are hit by kinetic force!"));
331 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr)) {
332 (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
335 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
336 ep_ptr->killer, ep_ptr->monspell);
339 void effect_player_rocket(player_type *target_ptr, effect_player_type *ep_ptr) {
340 if (target_ptr->blind)
341 msg_print(_("爆発があった!", "There is an explosion!"));
342 if (!target_ptr->resist_sound && !CHECK_MULTISHADOW(target_ptr)) {
343 (void)set_stun(target_ptr, target_ptr->stun + randint1(20));
346 if (target_ptr->resist_shard) {
348 } else if (!CHECK_MULTISHADOW(target_ptr)) {
349 (void)set_cut(target_ptr, target_ptr->cut + (ep_ptr->dam / 2));
352 if (!target_ptr->resist_shard || one_in_(12)) {
353 inventory_damage(target_ptr, set_cold_destroy, 3);
356 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
357 ep_ptr->killer, ep_ptr->monspell);
360 void effect_player_inertial(player_type *target_ptr,
361 effect_player_type *ep_ptr) {
362 if (target_ptr->blind)
364 _("何か遅いもので攻撃された!", "You are hit by something slow!"));
365 if (!CHECK_MULTISHADOW(target_ptr))
366 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
368 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
369 ep_ptr->killer, ep_ptr->monspell);
372 void effect_player_lite(player_type *target_ptr, effect_player_type *ep_ptr) {
373 if (target_ptr->blind)
374 msg_print(_("何かで攻撃された!", "You are hit by something!"));
375 if (target_ptr->resist_lite) {
377 ep_ptr->dam /= (randint1(4) + 7);
378 } else if (!target_ptr->blind && !target_ptr->resist_blind &&
379 !CHECK_MULTISHADOW(target_ptr)) {
380 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
383 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) ||
384 (target_ptr->mimic_form == MIMIC_VAMPIRE)) {
385 if (!CHECK_MULTISHADOW(target_ptr))
386 msg_print(_("光で肉体が焦がされた!", "The light scorches your flesh!"));
388 } else if (PRACE_IS_(target_ptr, RACE_S_FAIRY)) {
389 ep_ptr->dam = ep_ptr->dam * 4 / 3;
392 if (target_ptr->wraith_form)
394 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
395 ep_ptr->killer, ep_ptr->monspell);
397 if (!target_ptr->wraith_form || CHECK_MULTISHADOW(target_ptr))
400 target_ptr->wraith_form = 0;
401 msg_print(_("閃光のため非物質的な影の存在でいられなくなった。",
402 "The light forces you out of your incorporeal shadow form."));
404 target_ptr->redraw |= (PR_MAP | PR_STATUS);
405 target_ptr->update |= (PU_MONSTERS);
406 target_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
409 void effect_player_dark(player_type *target_ptr, effect_player_type *ep_ptr) {
410 if (target_ptr->blind)
411 msg_print(_("何かで攻撃された!", "You are hit by something!"));
412 if (target_ptr->resist_dark) {
414 ep_ptr->dam /= (randint1(4) + 7);
416 if (PRACE_IS_(target_ptr, RACE_VAMPIRE) ||
417 (target_ptr->mimic_form == MIMIC_VAMPIRE) || target_ptr->wraith_form)
419 } else if (!target_ptr->blind && !target_ptr->resist_blind &&
420 !CHECK_MULTISHADOW(target_ptr)) {
421 (void)set_blind(target_ptr, target_ptr->blind + randint1(5) + 2);
424 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
425 ep_ptr->killer, ep_ptr->monspell);
428 static void effect_player_time_one_disability(player_type *target_ptr) {
431 switch (randint1(6)) {
434 act = _("強く", "strong");
438 act = _("聡明で", "bright");
442 act = _("賢明で", "wise");
446 act = _("器用で", "agile");
450 act = _("健康で", "hale");
454 act = _("美しく", "beautiful");
458 msg_format(_("あなたは以前ほど%sなくなってしまった...。",
459 "You're not as %s as you used to be..."),
461 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 3) / 4;
462 if (target_ptr->stat_cur[k] < 3)
463 target_ptr->stat_cur[k] = 3;
465 target_ptr->update |= (PU_BONUS);
468 static void effect_player_time_all_disabilities(player_type *target_ptr) {
469 msg_print(_("あなたは以前ほど力強くなくなってしまった...。",
470 "You're not as powerful as you used to be..."));
471 for (int k = 0; k < A_MAX; k++) {
472 target_ptr->stat_cur[k] = (target_ptr->stat_cur[k] * 7) / 8;
473 if (target_ptr->stat_cur[k] < 3)
474 target_ptr->stat_cur[k] = 3;
477 target_ptr->update |= (PU_BONUS);
480 static void effect_player_time_addition(player_type *target_ptr) {
481 switch (randint1(10)) {
487 if (target_ptr->prace == RACE_ANDROID)
490 msg_print(_("人生が逆戻りした気がする。",
491 "You feel like a chunk of the past has been ripped away."));
492 lose_exp(target_ptr, 100 + (target_ptr->exp / 100) * MON_DRAIN_LIFE);
499 effect_player_time_one_disability(target_ptr);
502 effect_player_time_all_disabilities(target_ptr);
507 void effect_player_time(player_type *target_ptr, effect_player_type *ep_ptr) {
508 if (target_ptr->blind)
509 msg_print(_("過去からの衝撃に攻撃された!",
510 "You are hit by a blast from the past!"));
512 if (target_ptr->resist_time) {
514 ep_ptr->dam /= (randint1(4) + 7);
515 msg_print(_("時間が通り過ぎていく気がする。",
516 "You feel as if time is passing you by."));
517 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
518 ep_ptr->killer, ep_ptr->monspell);
522 if (CHECK_MULTISHADOW(target_ptr)) {
523 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
524 ep_ptr->killer, ep_ptr->monspell);
528 effect_player_time_addition(target_ptr);
529 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
530 ep_ptr->killer, ep_ptr->monspell);
533 void effect_player_gravity(player_type *target_ptr,
534 effect_player_type *ep_ptr) {
535 if (target_ptr->blind)
537 _("何か重いもので攻撃された!", "You are hit by something heavy!"));
538 msg_print(_("周辺の重力がゆがんだ。", "Gravity warps around you."));
540 if (!CHECK_MULTISHADOW(target_ptr)) {
541 teleport_player(target_ptr, 5, TELEPORT_PASSIVE);
542 if (!target_ptr->levitation)
543 (void)set_slow(target_ptr, target_ptr->slow + randint0(4) + 4, FALSE);
544 if (!(target_ptr->resist_sound || target_ptr->levitation)) {
546 (randint1((ep_ptr->dam > 90) ? 35 : (ep_ptr->dam / 3 + 5)));
547 (void)set_stun(target_ptr, target_ptr->stun + plus_stun);
551 if (target_ptr->levitation) {
552 ep_ptr->dam = (ep_ptr->dam * 2) / 3;
555 if (!target_ptr->levitation || one_in_(13)) {
556 inventory_damage(target_ptr, set_cold_destroy, 2);
559 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
560 ep_ptr->killer, ep_ptr->monspell);
563 void effect_player_disintegration(player_type *target_ptr,
564 effect_player_type *ep_ptr) {
565 if (target_ptr->blind)
567 _("純粋なエネルギーで攻撃された!", "You are hit by pure energy!"));
569 ep_ptr->get_damage = take_hit(target_ptr, DAMAGE_ATTACK, ep_ptr->dam,
570 ep_ptr->killer, ep_ptr->monspell);