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 next message
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?
Re: Effective strength; wrong code??[message #101228] Wed, 14 April 2004 03:01 Go to previous messageGo to next message
Shadow21

 
Messages:334
Registered:November 2001
Location: on route to San Hermanos
i think the /2 does only affect the bbandaged value. if its 0 (full health)you will have :
0.5*strength + 0.5*strength * [ (current life + 0/2) / maxlife ]
=0.5*strength + 0.5*strength * 1
=strength*1
Re: Effective strength; wrong code??[message #101229] Wed, 14 April 2004 03:09 Go to previous messageGo to next message
fpro

 
Messages:5
Registered:May 2003
Ok I understand now. I didn't look carefully enough.
Re: Effective strength; wrong code??[message #101230] Wed, 14 April 2004 03:12 Go to previous message
fpro

 
Messages:5
Registered:May 2003
This brings up a small idea. It'd be nice to see the effective stats in game. This would make effects of certain actions more clear, like drinking alcohol.
Previous Topic: Finite Enemy Resources
Next Topic: JA2 AI main faults
Goto Forum:
  


Current Time: Fri Mar 22 12:31:46 EET 2019

Total time taken to generate the page: 0.00670 seconds