Zombie Update (by Flugente)

- new variables for additional strength, dexterity, agility, wisdom and experience level due to drugs, traits etc.
- new flagmask for soldiers (so no new variables have to be added in the future)
- fix: stat-altering drugs work again and can now have a higher magnitude
- drug-altered stats now show up purple
- fix: option screen help texts were missing

WARING! This will break savegame compatibility

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5325 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-06-02 15:50:54 +00:00
parent defef00330
commit 4750b07f16
38 changed files with 339 additions and 326 deletions
+21 -21
View File
@@ -2386,8 +2386,8 @@ SOLDIERTYPE *AnyDoctorWhoCanHealThisPatient( SOLDIERTYPE *pPatient, BOOLEAN fThi
UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts, BOOLEAN fMakeSureKitIsInHand )
{
UINT16 usHealPts = 0;
UINT16 usKitPts = 0;
UINT32 usHealPts = 0;
UINT32 usKitPts = 0;
INT8 bMedFactor;
INT16 sSectorModifier = 100;
@@ -2413,7 +2413,7 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts,
}
// calculate effective doctoring rate (adjusted for drugs, alcohol, etc.)
usHealPts = (UINT16) (( EffectiveMedical( pDoctor ) * (( EffectiveDexterity( pDoctor ) + EffectiveWisdom( pDoctor ) ) / 2) * (100 + ( 5 * EffectiveExpLevel( pDoctor) ) ) ) / gGameExternalOptions.ubDoctoringRateDivisor);
usHealPts = (UINT32) (( EffectiveMedical( pDoctor ) * (( EffectiveDexterity( pDoctor, FALSE ) + EffectiveWisdom( pDoctor ) ) / 2) * (100 + ( 5 * EffectiveExpLevel( pDoctor) ) ) ) / gGameExternalOptions.ubDoctoringRateDivisor);
usHealPts = __max(0, (usHealPts * sSectorModifier)/100);
// calculate normal doctoring rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition)
@@ -2483,7 +2483,7 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts,
UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts, BOOLEAN fMakeSureKitIsInHand )
{
UINT16 usRepairPts;
UINT32 usRepairPts;
UINT16 usKitPts;
UINT8 ubKitEffectiveness;
// HEADROCK HAM 3.5: Modifier from local facilities
@@ -2503,7 +2503,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts
}
// calculate effective repair rate (adjusted for drugs, alcohol, etc.)
usRepairPts = (UINT16) ((EffectiveMechanical( pSoldier ) * EffectiveDexterity( pSoldier ) * (100 + ( 5 * EffectiveExpLevel( pSoldier) ) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay ));
usRepairPts = (UINT16) ((EffectiveMechanical( pSoldier ) * EffectiveDexterity( pSoldier, FALSE ) * (100 + ( 5 * EffectiveExpLevel( pSoldier) ) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay ));
// calculate normal repair rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition)
// and equipment was not a hindrance
@@ -4673,11 +4673,11 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE
{
// return the bonus training pts of this instructor with this student,...if student null, simply assignment student skill of 0 and student wisdom of 100
INT16 sTrainingPts = 0;
INT8 bTraineeEffWisdom = 0;
INT8 bTraineeNatWisdom = 0;
INT8 bTraineeSkill = 0;
INT8 bTrainerEffSkill = 0;
INT8 bTrainerNatSkill = 0;
INT16 bTraineeEffWisdom = 0;
INT16 bTraineeNatWisdom = 0;
INT16 bTraineeSkill = 0;
INT16 bTrainerEffSkill = 0;
INT16 bTrainerNatSkill = 0;
INT16 bTrainingBonus = 0;
INT8 bOpinionFactor;
@@ -4694,15 +4694,15 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE
switch( bTrainStat )
{
case( STRENGTH ):
bTrainerEffSkill = (INT8)EffectiveStrength ( pInstructor );
bTrainerEffSkill = EffectiveStrength ( pInstructor, TRUE );
bTrainerNatSkill = pInstructor->stats.bStrength;
break;
case( DEXTERITY ):
bTrainerEffSkill = EffectiveDexterity ( pInstructor );
bTrainerEffSkill = EffectiveDexterity ( pInstructor, TRUE );
bTrainerNatSkill = pInstructor->stats.bDexterity;
break;
case( AGILITY ):
bTrainerEffSkill = EffectiveAgility( pInstructor );
bTrainerEffSkill = EffectiveAgility( pInstructor, TRUE );
bTrainerNatSkill = pInstructor->stats.bAgility;
break;
case( HEALTH ):
@@ -4743,9 +4743,9 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE
if( pStudent == NULL )
{
// assume these default values
bTraineeEffWisdom = 100;
bTraineeNatWisdom = 100;
bTraineeSkill = 0;
bTraineeEffWisdom = 100;
bTraineeNatWisdom = 100;
bTraineeSkill = 0;
bOpinionFactor = 0;
}
else
@@ -4815,7 +4815,7 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE
// SANDRO - Teaching Skill now increases the effective skill to determine if we can instruct other mercs
if( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pInstructor, TEACHING_NT ))
{
if( bTraineeSkill >= (bTrainerEffSkill + gSkillTraitValues.ubTGEffectiveSkillValueForTeaching) )
if( bTraineeSkill >= (bTrainerEffSkill + (INT16)(gSkillTraitValues.ubTGEffectiveSkillValueForTeaching)) )
return ( 0 );
}
else if( bTraineeSkill >= bTrainerEffSkill )
@@ -4882,7 +4882,7 @@ INT16 GetBonusTrainingPtsDueToInstructor( SOLDIERTYPE *pInstructor, SOLDIERTYPE
sTrainingPts += ( ( ( bTrainingBonus + (bFacilityModifier-100) + bOpinionFactor ) * sTrainingPts ) / 100 );
// adjust for instructor fatigue
ReducePointsForFatigue( pInstructor, (UINT16 *)&sTrainingPts );
ReducePointsForFatigue( pInstructor, (UINT32 *)&sTrainingPts );
return( sTrainingPts );
}
@@ -4994,7 +4994,7 @@ INT16 GetSoldierTrainingPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, UINT16 *pus
sTrainingPts += ( ( bTrainingBonus * sTrainingPts ) / 100 );
// adjust for fatigue
ReducePointsForFatigue( pSoldier, (UINT16 *)&sTrainingPts );
ReducePointsForFatigue( pSoldier, (UINT32 *)&sTrainingPts );
return( sTrainingPts );
}
@@ -5110,7 +5110,7 @@ INT16 GetSoldierStudentPts( SOLDIERTYPE *pSoldier, INT8 bTrainStat, UINT16 *pusM
sTrainingPts += ( ( bTrainingBonus * sTrainingPts ) / 100 );
// adjust for fatigue
ReducePointsForFatigue( pSoldier, (UINT16 *)&sTrainingPts );
ReducePointsForFatigue( pSoldier, (UINT32 *)&sTrainingPts );
// now add in stuff for trainer
@@ -5378,7 +5378,7 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts )
// adjust for fatigue of trainer
ReducePointsForFatigue( pTrainer, (UINT16 *)&sTotalTrainingPts );
ReducePointsForFatigue( pTrainer, (UINT32 *)&sTotalTrainingPts );
/* ARM: Decided this didn't make much sense - the guys I'm training damn well BETTER be loyal - and screw the rest!
+2 -2
View File
@@ -1442,14 +1442,14 @@ UINT32 VirtualSoldierDressWound( SOLDIERTYPE *pSoldier, SOLDIERTYPE *pVictim, OB
uiDressSkill = ( ( 7 * EffectiveMedical( pSoldier ) ) + // medical knowledge
( sStatus) + // state of medical kit
(10 * EffectiveExpLevel( pSoldier ) ) + // battle injury experience
EffectiveDexterity( pSoldier ) ) / 10; // general "handiness"
EffectiveDexterity( pSoldier, FALSE ) ) / 10; // general "handiness"
}
else
{
uiDressSkill = ( ( 3 * EffectiveMedical( pSoldier ) ) + // medical knowledge
( 2 * sStatus) + // state of medical kit
(10 * EffectiveExpLevel( pSoldier ) ) + // battle injury experience
EffectiveDexterity( pSoldier ) ) / 7; // general "handiness"
EffectiveDexterity( pSoldier, FALSE ) ) / 7; // general "handiness"
}
// try to use every AP that the merc has left
+23 -23
View File
@@ -912,8 +912,8 @@ INT16 FacilityRiskResult( SOLDIERTYPE *pSoldier, UINT8 ubRiskType, UINT8 ubFacil
INT16 Result = 0;
INT32 iChance;
INT8 bBaseEffect;
UINT8 ubRange;
INT16 bBaseEffect;
UINT16 ubRange;
// Read risk data directly from facility array.
iChance = gFacilityTypes[ubFacilityType].AssignmentData[ubAssignmentType].Risk[ubRiskType].usChance;
@@ -922,11 +922,11 @@ INT16 FacilityRiskResult( SOLDIERTYPE *pSoldier, UINT8 ubRiskType, UINT8 ubFacil
// For now, only these variables can effect risk outcome. In the future there may be more effects, like traits
// and personality, or even sex.
UINT8 ubStrength = EffectiveStrength( pSoldier );
UINT8 ubAgility = EffectiveAgility( pSoldier );
UINT8 ubDexterity = EffectiveDexterity( pSoldier );
INT16 ubStrength = EffectiveStrength( pSoldier, FALSE );
INT16 ubAgility = EffectiveAgility( pSoldier, FALSE );
INT16 ubDexterity = EffectiveDexterity( pSoldier, FALSE );
UINT8 ubHealth = __min(pSoldier->stats.bLife, pSoldier->stats.bLifeMax);
UINT8 ubWisdom = EffectiveWisdom( pSoldier );
INT16 ubWisdom = EffectiveWisdom( pSoldier );
UINT8 ubLeadership = EffectiveLeadership( pSoldier );
UINT8 ubExplosives = EffectiveExplosive( pSoldier );
UINT8 ubExpLevel = EffectiveExpLevel( pSoldier );
@@ -961,7 +961,7 @@ INT16 FacilityRiskResult( SOLDIERTYPE *pSoldier, UINT8 ubRiskType, UINT8 ubFacil
sAbsoluteMinResult = bBaseEffect - ubRange;
}
INT8 bCombinedStats;
INT16 bCombinedStats;
// Begin calculating the effect of skills on increasing/reducing final result. Use a mix of stats to reach a range
// of 0 to 100.
@@ -969,52 +969,52 @@ INT16 FacilityRiskResult( SOLDIERTYPE *pSoldier, UINT8 ubRiskType, UINT8 ubFacil
switch (ubRiskType)
{
case RISK_STRENGTH:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.2) + (ubAgility * 0.3) + (ubExpLevel * 5));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.2) + (ubAgility * 0.3) + (ubExpLevel * 5));
break;
case RISK_DEXTERITY:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.4) + (ubExpLevel * 6));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.4) + (ubExpLevel * 6));
break;
case RISK_AGILITY:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.2) + (ubExpLevel * 8));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.2) + (ubExpLevel * 8));
break;
case RISK_HEALTH:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.5) + (ubExpLevel * 5));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.5) + (ubExpLevel * 5));
break;
case RISK_WISDOM:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.6) + (ubExpLevel * 4));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.6) + (ubExpLevel * 4));
break;
case RISK_MARKSMANSHIP:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.2) + (ubAgility * 0.4) + (ubExpLevel * 4));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.2) + (ubAgility * 0.4) + (ubExpLevel * 4));
break;
case RISK_MEDICAL:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.3) + (ubDexterity * 0.4) + (ubExpLevel * 3));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.3) + (ubDexterity * 0.4) + (ubExpLevel * 3));
break;
case RISK_MECHANICAL:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.3) + (ubDexterity * 0.5) + (ubExpLevel * 2));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.3) + (ubDexterity * 0.5) + (ubExpLevel * 2));
break;
case RISK_LEADERSHIP:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.4) + (ubLeadership * 0.3) + (ubExpLevel * 3));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.4) + (ubLeadership * 0.3) + (ubExpLevel * 3));
break;
case RISK_EXPLOSIVES:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.2) + (ubAgility * 0.3) + (ubDexterity * 0.3) + (ubExpLevel * 2));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.2) + (ubAgility * 0.3) + (ubDexterity * 0.3) + (ubExpLevel * 2));
break;
case RISK_INJURY:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.2) + (ubDexterity * 0.2) + (ubAgility * 0.4) + (ubExpLevel * 2));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.2) + (ubDexterity * 0.2) + (ubAgility * 0.4) + (ubExpLevel * 2));
break;
case RISK_MORALE:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.2) + (ubLeadership * 0.4) + (ubExpLevel * 4));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.2) + (ubLeadership * 0.4) + (ubExpLevel * 4));
break;
case RISK_FATIGUE:
bCombinedStats = (INT8)__min(100, (ubAgility * 0.1) + (ubStrength * 0.3) + (ubHealth * 0.2) + (ubExpLevel * 4));
bCombinedStats = (INT16)__min(100, (ubAgility * 0.1) + (ubStrength * 0.3) + (ubHealth * 0.2) + (ubExpLevel * 4));
break;
case RISK_DRUNK:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.5) + (ubHealth * 0.3) + (ubExpLevel * 2));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.5) + (ubHealth * 0.3) + (ubExpLevel * 2));
break;
case RISK_LOYALTY_LOCAL:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.2) + (ubLeadership * 0.3) + (ubStrength * 0.1) + (ubExpLevel * 2) + (ubLocalLoyalty * 0.2) );
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.2) + (ubLeadership * 0.3) + (ubStrength * 0.1) + (ubExpLevel * 2) + (ubLocalLoyalty * 0.2) );
break;
case RISK_LOYALTY_GLOBAL:
bCombinedStats = (INT8)__min(100, (ubWisdom * 0.3) + (ubLeadership * 0.3) + (ubExpLevel * 2) + (ubLocalLoyalty * 0.2));
bCombinedStats = (INT16)__min(100, (ubWisdom * 0.3) + (ubLeadership * 0.3) + (ubExpLevel * 2) + (ubLocalLoyalty * 0.2));
break;
}
+1 -1
View File
@@ -1291,7 +1291,7 @@ INT32 GetStrategicMvtSpeed( SOLDIERTYPE *pCharacter )
// avg of strength and agility * percentage health..very simple..replace later
iSpeed = ( INT32 )( ( pCharacter->stats.bAgility + pCharacter->stats.bStrength ) / 2 );
iSpeed = ( INT32 )( ( pCharacter->stats.bAgility + pCharacter->stats.bStrength + pCharacter->bExtraStrength ) / 2 );
iSpeed *= ( INT32 )(( pCharacter->stats.bLife ) );
iSpeed /= ( INT32 )pCharacter->stats.bLifeMax;