From 842a6e3d7e70fbcd0fedda57f760de3386f568a2 Mon Sep 17 00:00:00 2001 From: k-bar <92504151+k-bar@users.noreply.github.com> Date: Sat, 4 Jun 2022 19:19:41 +0200 Subject: [PATCH] [Hellfire bug] fix Fire Ring trap MI_FireRing adds missiles MIS_FIREWALL with TARGET_BOTH and src equals to either player ID, or -1 if Fire Ring is casted as trap. This has consequences: 1. Because TARGET_BOTH MonsterMHit was called, as it usually called for Firewalls. During this calls reference to Player gets garbage data (id -1). This may miscalculate: - no heal flags - knockback flags (already fixed in this PR) - unsquelch position.last 2. drops ear for firewall flame originating from Fire Ring from trap Fix: - Separated TARGET_BOTH from IsTrap for monsters to ensure TryHitMonster will get passed TrapMissile (MonsterTrapHit) is called instead. - added additional condition for earflag --- Source/missiles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/missiles.cpp b/Source/missiles.cpp index ed6eb6503..c6802e964 100644 --- a/Source/missiles.cpp +++ b/Source/missiles.cpp @@ -418,7 +418,7 @@ void CheckMissileCol(Missile &missile, int minDamage, int maxDamage, bool isDama isPlayerHit = PlayerMHit(pid - 1, &monster, missile._midist, minDamage, maxDamage, missile._mitype, isDamageShifted, 0, &blocked); } } else { - int earflag = (missile._miAnimType == MFILE_FIREWAL || missile._miAnimType == MFILE_LGHNING) ? 1 : 0; + int earflag = (!missile.IsTrap() && (missile._miAnimType == MFILE_FIREWAL || missile._miAnimType == MFILE_LGHNING)) ? 1 : 0; isPlayerHit = PlayerMHit(pid - 1, nullptr, missile._midist, minDamage, maxDamage, missile._mitype, isDamageShifted, earflag, &blocked); } }