Skip to content

Commit cd0f8bd

Browse files
authored
Fix targeting if other combatant leaves combat (#1559)
* Reset actarg1/2/3 only when I'm switching target, not when I'm fighting anybody else * Fix removing combat memory of wrong character
1 parent 9c7ca7e commit cd0f8bd

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/game/chars/CCharFight.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,19 +1365,20 @@ bool CChar::Fight_Clear(CChar *pChar, bool fForced)
13651365
if ( !pChar || !Attacker_Delete(pChar, fForced, ATTACKER_CLEAR_FORCED) )
13661366
return false;
13671367

1368-
m_atFight.m_iWarSwingState = WAR_SWING_EQUIPPING;
1369-
m_atFight.m_iRecoilDelay = 0;
1370-
m_atFight.m_iSwingAnimationDelay = 0;
1371-
m_atFight.m_iSwingAnimation = 0;
1372-
m_atFight.m_iSwingIgnoreLastHitTag = 0;
1373-
1374-
CItemMemory* pMemoryFight = Memory_FindObj(m_Fight_Targ_UID);
1368+
CItemMemory* pMemoryFight = Memory_FindObj(pChar->GetUID());
13751369
if ( pMemoryFight && ( pMemoryFight->IsMemoryTypes(MEMORY_FIGHT) || pMemoryFight->IsMemoryTypes(MEMORY_IRRITATEDBY) ) )
13761370
pMemoryFight->Delete();
13771371

13781372
// Go to my next target.
1379-
if (m_Fight_Targ_UID == pChar->GetUID())
1373+
if (m_Fight_Targ_UID == pChar->GetUID())
1374+
{
1375+
m_atFight.m_iWarSwingState = WAR_SWING_EQUIPPING;
1376+
m_atFight.m_iRecoilDelay = 0;
1377+
m_atFight.m_iSwingAnimationDelay = 0;
1378+
m_atFight.m_iSwingAnimation = 0;
1379+
m_atFight.m_iSwingIgnoreLastHitTag = 0;
13801380
m_Fight_Targ_UID.InitUID();
1381+
}
13811382

13821383
if ( m_pNPC )
13831384
{

0 commit comments

Comments
 (0)