| 2623 | } |
| 2624 | |
| 2625 | void |
| 2626 | mhitm_ad_cold( |
| 2627 | struct monst *magr, struct attack *mattk, |
| 2628 | struct monst *mdef, struct mhitm_data *mhm) |
| 2629 | { |
| 2630 | const int orig_dmg = mhm->damage; |
| 2631 | |
| 2632 | if (magr == &gy.youmonst) { |
| 2633 | /* uhitm */ |
| 2634 | if (mhitm_mgc_atk_negated(magr, mdef, TRUE)) { |
| 2635 | mhm->damage = 0; |
| 2636 | return; |
| 2637 | } |
| 2638 | if (!Blind) |
| 2639 | pline("%s is covered in frost!", Monnam(mdef)); |
| 2640 | if (resists_cold(mdef) || defended(mdef, AD_COLD)) { |
| 2641 | shieldeff(mdef->mx, mdef->my); |
| 2642 | if (!Blind) |
| 2643 | pline_The("frost doesn't chill %s!", mon_nam(mdef)); |
| 2644 | golemeffects(mdef, AD_COLD, mhm->damage); |
| 2645 | mhm->damage = 0; |
| 2646 | } |
| 2647 | mhm->damage += destroy_items(mdef, AD_COLD, orig_dmg); |
| 2648 | } else if (mdef == &gy.youmonst) { |
| 2649 | /* mhitu */ |
| 2650 | hitmsg(magr, mattk); |
| 2651 | if (!mhitm_mgc_atk_negated(magr, mdef, TRUE)) { |
| 2652 | pline("You're covered in frost!"); |
| 2653 | if (Cold_resistance) { |
| 2654 | pline_The("frost doesn't seem cold!"); |
| 2655 | monstseesu(M_SEEN_COLD); |
| 2656 | mhm->damage = 0; |
| 2657 | } else { |
| 2658 | monstunseesu(M_SEEN_COLD); |
| 2659 | } |
| 2660 | if ((int) magr->m_lev > rn2(20)) |
| 2661 | (void) destroy_items(&gy.youmonst, AD_COLD, orig_dmg); |
| 2662 | } else |
| 2663 | mhm->damage = 0; |
| 2664 | } else { |
| 2665 | /* mhitm */ |
| 2666 | if (mhitm_mgc_atk_negated(magr, mdef, TRUE)) { |
| 2667 | mhm->damage = 0; |
| 2668 | return; |
| 2669 | } |
| 2670 | if (gv.vis && canseemon(mdef)) |
| 2671 | pline_mon(mdef, "%s is covered in frost!", Monnam(mdef)); |
| 2672 | if (resists_cold(mdef) || defended(mdef, AD_COLD)) { |
| 2673 | if (gv.vis && canseemon(mdef)) |
| 2674 | pline_The("frost doesn't seem to chill %s!", mon_nam(mdef)); |
| 2675 | shieldeff(mdef->mx, mdef->my); |
| 2676 | golemeffects(mdef, AD_COLD, mhm->damage); |
| 2677 | mhm->damage = 0; |
| 2678 | } |
| 2679 | mhm->damage += destroy_items(mdef, AD_COLD, orig_dmg); |
| 2680 | } |
| 2681 | } |
| 2682 |
no test coverage detected