Skip to content

Commit 48c635d

Browse files
committed
Fix bug where PoisonedBehavior damage ignored POISON resistance
- In order to prevent an infinite self-poisoning loop, the damage being dealt was set to DAMAGE_UNRESISTABLE. - Adding a check for the source of the damage prevents us from restarting poison effects, thus we can safely use DAMAGE_POISON damage type once again.
1 parent 4ab2fc0 commit 48c635d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/PoisonedBehavior.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,10 @@ PoisonedBehavior::~PoisonedBehavior( void )
8585
//-------------------------------------------------------------------------------------------------
8686
void PoisonedBehavior::onDamage( DamageInfo *damageInfo )
8787
{
88-
if( damageInfo->in.m_damageType == DAMAGE_POISON )
89-
startPoisonedEffects( damageInfo );
88+
// @bugfix hanfield 01/08/2025 Check m_sourceID to see if we are causing damage. If we are - ignore.
89+
if( damageInfo->in.m_damageType == DAMAGE_POISON &&
90+
damageInfo->in.m_sourceID != INVALID_ID)
91+
startPoisonedEffects( damageInfo );
9092
}
9193

9294
// ------------------------------------------------------------------------------------------------
@@ -118,8 +120,8 @@ UpdateSleepTime PoisonedBehavior::update()
118120
DamageInfo damage;
119121
damage.in.m_amount = m_poisonDamageAmount;
120122
damage.in.m_sourceID = INVALID_ID;
121-
damage.in.m_damageType = DAMAGE_UNRESISTABLE; // Not poison, as that will infect us again
122-
damage.in.m_damageFXOverride = DAMAGE_POISON; // but this will ensure that the right effect is played
123+
damage.in.m_damageType = DAMAGE_POISON; // @bugfix hanfield 01/08/2025 Since we now check for sourceID, this damage will not cause an infinite poison loop
124+
damage.in.m_damageFXOverride = DAMAGE_POISON; // Not necessary anymore, but can help to make sure proper FX are used, if template is wonky
123125
damage.in.m_deathType = m_deathType;
124126
getObject()->attemptDamage( &damage );
125127

0 commit comments

Comments
 (0)