Home » SIRTECH CLASSICS » Jagged Alliance: Unfinished Business » Vanilla Modding » Effective strength; wrong code??
Effective strength; wrong code??[message #101227] Wed, 14 April 2004 02:47 Go to previous message
fpro is currently offline fpro

 
Messages:5
Registered:May 2003
When browsing through the SkillCheck.c file (in folder Tactical) I saw this function to calculate the effective strength:

INT8 EffectiveStrength( SOLDIERTYPE * pSoldier )
{
	INT8	bBandaged;
	INT32	iEffStrength;

	// Effective strength is:
	// 1/2 full strength
	// plus 1/2 strength scaled according to how hurt we are
  bBandaged = pSoldier->bLifeMax - pSoldier->bLife - pSoldier->bBleeding;
	iEffStrength = pSoldier->bStrength / 2;
	iEffStrength += (pSoldier->bStrength / 2) * (pSoldier->bLife + bBandaged / 2) / (pSoldier->bLifeMax);

	// ATE: Make sure at least 2...
	iEffStrength = __max( iEffStrength, 2 );

	return( (INT8) iEffStrength );
}
You would expect that at maximum current health a mercenary would have full effective strength, but according to the formula the effective strength would be 0.5*strength + 0.5*strength * [ (current life/2) / maxlife ] = 0.5*strength + 0.25*strength = 0.75*strength. Have I made any mistakes in interpreting the code?

Report message to a moderator

Private
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Finite Enemy Resources
Next Topic: JA2 AI main faults
Goto Forum:
  


Current Time: Fri Jan 10 17:02:50 GMT+2 2025

Total time taken to generate the page: 0.00650 seconds