| 1998 | } |
| 1999 | |
| 2000 | void M_TryM2MHit(int i, int mid, int hper, int mind, int maxd) |
| 2001 | { |
| 2002 | BOOL ret; |
| 2003 | |
| 2004 | if ((DWORD)mid >= MAXMONSTERS) { |
| 2005 | app_fatal("M_TryM2MHit: Invalid monster %d", mid); |
| 2006 | } |
| 2007 | if (monster[mid].MType == NULL) |
| 2008 | app_fatal("M_TryM2MHit: Monster %d \"%s\" MType NULL", mid, monster[mid].mName); |
| 2009 | if (monster[mid]._mhitpoints >> 6 > 0 && (monster[mid].MType->mtype != MT_ILLWEAV || monster[mid]._mgoal != MGOAL_RETREAT)) { |
| 2010 | int hit = random_(4, 100); |
| 2011 | if (monster[mid]._mmode == MM_STONE) |
| 2012 | hit = 0; |
| 2013 | if (!CheckMonsterHit(mid, &ret) && hit < hper) { |
| 2014 | int dam = (mind + random_(5, maxd - mind + 1)) << 6; |
| 2015 | monster[mid]._mhitpoints -= dam; |
| 2016 | if (monster[mid]._mhitpoints >> 6 <= 0) { |
| 2017 | if (monster[mid]._mmode == MM_STONE) { |
| 2018 | M2MStartKill(i, mid); |
| 2019 | monster[mid]._mmode = MM_STONE; |
| 2020 | } else { |
| 2021 | M2MStartKill(i, mid); |
| 2022 | } |
| 2023 | } else { |
| 2024 | if (monster[mid]._mmode == MM_STONE) { |
| 2025 | M2MStartHit(mid, i, dam); |
| 2026 | monster[mid]._mmode = MM_STONE; |
| 2027 | } else { |
| 2028 | M2MStartHit(mid, i, dam); |
| 2029 | } |
| 2030 | } |
| 2031 | } |
| 2032 | } |
| 2033 | } |
| 2034 | |
| 2035 | void M_TryH2HHit(int i, int pnum, int Hit, int MinDam, int MaxDam) |
| 2036 | { |
no test coverage detected