Special (passive) attacks on you by monsters done here. */
| 5862 | /* Special (passive) attacks on you by monsters done here. |
| 5863 | */ |
| 5864 | int |
| 5865 | passive( |
| 5866 | struct monst *mon, |
| 5867 | struct obj *weapon, /* uwep or uswapwep or uarmg or uarmf or Null */ |
| 5868 | boolean mhitb, |
| 5869 | boolean maliveb, |
| 5870 | uchar aatyp, |
| 5871 | boolean wep_was_destroyed) |
| 5872 | { |
| 5873 | struct permonst *ptr = mon->data; |
| 5874 | int i, tmp; |
| 5875 | int mhit = mhitb ? M_ATTK_HIT : M_ATTK_MISS; |
| 5876 | int malive = maliveb ? M_ATTK_HIT : M_ATTK_MISS; |
| 5877 | |
| 5878 | for (i = 0;; i++) { |
| 5879 | if (i >= NATTK) |
| 5880 | return (malive | mhit); /* no passive attacks */ |
| 5881 | if (ptr->mattk[i].aatyp == AT_NONE) |
| 5882 | break; /* try this one */ |
| 5883 | } |
| 5884 | /* Note: tmp not always used */ |
| 5885 | if (ptr->mattk[i].damn) |
| 5886 | tmp = d((int) ptr->mattk[i].damn, (int) ptr->mattk[i].damd); |
| 5887 | else if (ptr->mattk[i].damd) |
| 5888 | tmp = d((int) mon->m_lev + 1, (int) ptr->mattk[i].damd); |
| 5889 | else |
| 5890 | tmp = 0; |
| 5891 | |
| 5892 | /* These affect you even if they just died. |
| 5893 | */ |
| 5894 | switch (ptr->mattk[i].adtyp) { |
| 5895 | case AD_FIRE: |
| 5896 | if (mhitb && !mon->mcan && weapon) { |
| 5897 | if (aatyp == AT_KICK) { |
| 5898 | if (uarmf && !rn2(6)) |
| 5899 | (void) erode_obj(uarmf, xname(uarmf), ERODE_BURN, |
| 5900 | EF_GREASE | EF_VERBOSE); |
| 5901 | } else if (aatyp == AT_WEAP || aatyp == AT_CLAW |
| 5902 | || aatyp == AT_MAGC || aatyp == AT_TUCH) |
| 5903 | passive_obj(mon, weapon, &(ptr->mattk[i])); |
| 5904 | } |
| 5905 | break; |
| 5906 | case AD_ACID: |
| 5907 | if (mhitb && rn2(2)) { |
| 5908 | if (Blind || !flags.verbose) |
| 5909 | You("are splashed!"); |
| 5910 | else |
| 5911 | You("are splashed by %s %s!", s_suffix(mon_nam(mon)), |
| 5912 | hliquid("acid")); |
| 5913 | |
| 5914 | if (!Acid_resistance) { |
| 5915 | mdamageu(mon, tmp); |
| 5916 | monstunseesu(M_SEEN_ACID); |
| 5917 | } else { |
| 5918 | monstseesu(M_SEEN_ACID); |
| 5919 | } |
| 5920 | if (!rn2(30)) |
| 5921 | erode_armor(&gy.youmonst, ERODE_CORRODE); |
no test coverage detected