Split out harmless-to-monster trap

Also make the code much easier to understand, and
more-or-less match hero trap triggering.
This commit is contained in:
Pasi Kallinen
2024-01-23 19:01:31 +02:00
parent 7fa74d0199
commit 829f9f65f7
3 changed files with 84 additions and 18 deletions

View File

@@ -2128,24 +2128,7 @@ mfndpos(
ttmp->ttyp);
continue;
}
if ((ttmp->ttyp != RUST_TRAP
|| mdat == &mons[PM_IRON_GOLEM])
&& ttmp->ttyp != STATUE_TRAP
&& ttmp->ttyp != VIBRATING_SQUARE
&& ((!is_pit(ttmp->ttyp) && !is_hole(ttmp->ttyp))
|| (!is_flyer(mdat) && !is_floater(mdat)
&& !is_clinger(mdat)) || Sokoban)
&& (ttmp->ttyp != SLP_GAS_TRAP || !resists_sleep(mon))
&& (ttmp->ttyp != BEAR_TRAP
|| (mdat->msize > MZ_SMALL && !amorphous(mdat)
&& !is_flyer(mdat) && !is_floater(mdat)
&& !is_whirly(mdat) && !unsolid(mdat)))
&& (ttmp->ttyp != FIRE_TRAP || !resists_fire(mon))
&& (ttmp->ttyp != SQKY_BOARD || !is_flyer(mdat))
&& (ttmp->ttyp != WEB
|| (!amorphous(mdat) && !webmaker(mdat)
&& !is_whirly(mdat) && !unsolid(mdat)))
&& (ttmp->ttyp != ANTI_MAGIC || !resists_magm(mon))) {
if (!m_harmless_trap(mon, ttmp)) {
if (!(flag & ALLOW_TRAPS)) {
if (mon_knows_traps(mon, ttmp->ttyp))
continue;