diff --git a/Strategic/Assignments.cpp b/Strategic/Assignments.cpp index 16ea468d..89561ce4 100644 --- a/Strategic/Assignments.cpp +++ b/Strategic/Assignments.cpp @@ -2723,7 +2723,11 @@ UINT16 CalculateHealingPointsForDoctor(SOLDIERTYPE *pDoctor, UINT16 *pusMaxPts, // calculate normal doctoring rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition) // and equipment was not a hindrance - *pusMaxPts = ( pDoctor->stats.bMedical * (( pDoctor->stats.bDexterity + pDoctor->stats.bWisdom ) / 2 ) * (100 + ( 5 * pDoctor->stats.bExpLevel) ) ) / gGameExternalOptions.ubDoctoringRateDivisor; + INT16 dexterity = (pDoctor->stats.bDexterity * (100 + pDoctor->GetBackgroundValue( BG_DEXTERITY ))) / 100; + INT16 medical = (pDoctor->stats.bMedical * (100 + pDoctor->GetBackgroundValue( BG_MEDICAL ))) / 100; + INT16 wisdom = (pDoctor->stats.bWisdom * (100 + pDoctor->GetBackgroundValue( BG_WISDOM ))) / 100; + + *pusMaxPts = (medical * ((dexterity + wisdom) / 2) * (100 + (5 * pDoctor->stats.bExpLevel))) / gGameExternalOptions.ubDoctoringRateDivisor; *pusMaxPts = __max(0,*pusMaxPts); // SANDRO - New Doctor Trait @@ -2820,7 +2824,9 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts // calculate normal repair rate - what it would be if his stats were "normal" (ignoring drugs, fatigue, equipment condition) // and equipment was not a hindrance - *pusMaxPts = ( pSoldier->stats.bMechanical * pSoldier->stats.bDexterity * (100 + ( 5 * pSoldier->stats.bExpLevel) ) ) / ( gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay ); + INT16 mechanical = (pSoldier->stats.bMechanical * (100 + pSoldier->GetBackgroundValue( BG_MECHANICAL ))) / 100; + INT16 dexterity = (pSoldier->stats.bDexterity * (100 + pSoldier->GetBackgroundValue( BG_DEXTERITY ))) / 100; + *pusMaxPts = (mechanical * dexterity * (100 + (5 * pSoldier->stats.bExpLevel))) / (gGameExternalOptions.ubRepairRateDivisor * gGameExternalOptions.ubAssignmentUnitsPerDay); // SANDRO - Technician trait gives a good bonus to repair items if ( gGameOptions.fNewTraitSystem ) @@ -2956,14 +2962,11 @@ UINT32 CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ) } // Flugente: calculate prison guard value -UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ) +UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier ) { // this is not an assignment. Simply being in the sector will allow us to be counted as guards UINT32 usValue = 0; - - // for max points we display the maximum amount of prisoners instead - *pusMaxPts = 0; - + if ( pSoldier->flags.fMercAsleep ) return 0; @@ -2991,14 +2994,11 @@ UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ) return( usValue ); } -UINT32 CalculateSnitchGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ) +UINT32 CalculateSnitchGuardValue(SOLDIERTYPE *pSoldier ) { // this is an assignment UINT32 usValue = 0; - - // for max points we display the maximum amount of prisoners instead - *pusMaxPts = 0; - + if ( pSoldier->flags.fMercAsleep ) return 0; @@ -3043,8 +3043,7 @@ UINT32 CalculateAllGuardsValueInPrison( INT16 sMapX, INT16 sMapY, INT8 bZ ) { if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) && !pSoldier->flags.fMercAsleep ) { - UINT16 tmp; - prisonguardvalue += CalculatePrisonGuardValue(pSoldier, &tmp ); + prisonguardvalue += CalculatePrisonGuardValue(pSoldier ); } } @@ -3067,8 +3066,7 @@ UINT32 CalculateAllSnitchesGuardValueInPrison( INT16 sMapX, INT16 sMapY, INT8 bZ { if( pSoldier->bActive && ( pSoldier->sSectorX == sMapX ) && ( pSoldier->sSectorY == sMapY ) && ( pSoldier->bSectorZ == bZ) && pSoldier->flags.fMercAsleep == FALSE ) { - UINT16 tmp; - prisonguardvalue += CalculateSnitchGuardValue(pSoldier, &tmp ); + prisonguardvalue += CalculateSnitchGuardValue(pSoldier ); } } @@ -3174,41 +3172,6 @@ UINT32 CalculateSnitchInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPt return( usInterrogationPoints ); } -// anv: totally not a copy of CalculatePrisonGuardValue -UINT32 CalculateSnitchPrisonGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ) -{ - UINT32 usValue = 0; - - // for max points we display the maximum amount of prisoners instead - *pusMaxPts = 0; - - if ( pSoldier->flags.fMercAsleep ) - return 0; - - if ( !CanCharacterSnitchInPrison(pSoldier) ) - return 0; - - usValue = ( 15 * EffectiveExpLevel( pSoldier ) + 2 * EffectiveLeadership( pSoldier ) + EffectiveWisdom( pSoldier ) ); - - // no bonuses for snitch trait, as merc has to have it to take this assignment anyway - if (gGameOptions.fNewTraitSystem) - { - usValue += 25 * NUM_SKILL_TRAITS( pSoldier, COVERT_NT ) + 10 * HAS_SKILL_TRAIT( pSoldier, STEALTHY_NT ); - } - else - { - usValue += 10 * HAS_SKILL_TRAIT( pSoldier, STEALTHY_OT ); - } - - usValue = (UINT32)(gSkillTraitValues.fSNTPrisonSnitchGuardStrengthMultiplier * usValue); - - // adjust for fatigue - ReducePointsForFatigue( pSoldier, &usValue ); - - // return current repair pts - return( usValue ); -} - // Flugente: Determine the best cth with SAMs in a sector, and which merc has that cth if present FLOAT GetBestSAMOperatorCTH_Player( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ, UINT16 *pubID ) { @@ -7418,7 +7381,10 @@ INT16 GetTownTrainPtsForCharacter( SOLDIERTYPE *pTrainer, UINT16 *pusMaxPts ) // UINT8 ubTownId = 0; // calculate normal training pts - what it would be if his stats were "normal" (ignoring drugs, fatigue) - *pusMaxPts = ( pTrainer->stats.bWisdom + pTrainer->stats.bLeadership + ( 10 * pTrainer->stats.bExpLevel ) ) * gGameExternalOptions.ubTownMilitiaTrainingRate; + INT16 wisdom = (pTrainer->stats.bWisdom * (100 + pTrainer->GetBackgroundValue( BG_WISDOM ))) / 100; + INT16 leadership = (pTrainer->stats.bLeadership * (100 + pTrainer->GetBackgroundValue( BG_LEADERSHIP ))) / 100; + + *pusMaxPts = (wisdom + leadership + (10 * pTrainer->stats.bExpLevel)) * gGameExternalOptions.ubTownMilitiaTrainingRate; // calculate effective training points (this is hundredths of pts / hour) // typical: 300/hr, maximum: 600/hr diff --git a/Strategic/Assignments.h b/Strategic/Assignments.h index c4353e79..c14c4abb 100644 --- a/Strategic/Assignments.h +++ b/Strategic/Assignments.h @@ -256,7 +256,7 @@ UINT8 CalculateRepairPointsForRepairman(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts // Flugente: calculate interrogation and prison guard values UINT32 CalculateInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ); -UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ); +UINT32 CalculatePrisonGuardValue(SOLDIERTYPE *pSoldier ); UINT32 CalculateSnitchInterrogationValue(SOLDIERTYPE *pSoldier, UINT16 *pusMaxPts ); diff --git a/Strategic/Hourly Update.cpp b/Strategic/Hourly Update.cpp index 64bf4635..3aa33c48 100644 --- a/Strategic/Hourly Update.cpp +++ b/Strategic/Hourly Update.cpp @@ -22,6 +22,7 @@ #include "DynamicDialogue.h" // added by Flugente for HandleDynamicOpinions() #include "Drugs And Alcohol.h" // added by Flugente for HourlyDrugUpdate() #include "Interface.h" // added by Flugente + #include "SkillCheck.h" // added by Flugente #endif #include "Luaglobal.h" diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index f59f1839..380aff94 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -49,6 +49,7 @@ #include "message.h" #include "CampaignStats.h" // added by Flugente #include "militiasquads.h" // added by Flugente + #include "SkillCheck.h" // added by Flugente #endif #ifdef JA2UB diff --git a/Tactical/Interface.cpp b/Tactical/Interface.cpp index 2bc59cd4..d6bcb6e0 100644 --- a/Tactical/Interface.cpp +++ b/Tactical/Interface.cpp @@ -65,6 +65,7 @@ // sevenfm: needed for _KeyDown(SHIFT) #include "english.h" #include "DisplayCover.h" + #include "SkillCheck.h" // added by Flugente #endif #include "InterfaceItemImages.h" diff --git a/Tactical/LOS.cpp b/Tactical/LOS.cpp index c4ac9666..d1147f55 100644 --- a/Tactical/LOS.cpp +++ b/Tactical/LOS.cpp @@ -54,6 +54,7 @@ #include "Soldier Functions.h" // added by Flugente for DoesSoldierWearGasMask(...) #include "CampaignStats.h" // added by Flugente #include "AIInternals.h"//dnl ch61 180813 +#include "SkillCheck.h" // added by Flugente #include "GameInitOptionsScreen.h" diff --git a/Tactical/LOS.h b/Tactical/LOS.h index 18f0340a..a6f202d5 100644 --- a/Tactical/LOS.h +++ b/Tactical/LOS.h @@ -245,13 +245,4 @@ void CalcRecoilOffset( SOLDIERTYPE *pShooter, FLOAT *dMuzzleOffsetX, FLOAT *dMuz // HEADROCK HAM 5: New function, completely replaces the Counter Force Frequency check. FLOAT CalcCounterForceChange( SOLDIERTYPE * pShooter, UINT32 uiCounterForceAccuracy, FLOAT dCounterForceMax, FLOAT dMuzzleOffset, FLOAT bRecoil, FLOAT dPrevCounterForce, UINT32 uiIntendedBullets ); -// HEADROCK HAM 4: Required for shooting mechanic -extern INT8 EffectiveMarksmanship( SOLDIERTYPE * pSoldier ); -extern INT16 EffectiveWisdom( SOLDIERTYPE * pSoldier ); -extern INT8 EffectiveExpLevel( SOLDIERTYPE * pSoldier ); -extern INT16 EffectiveDexterity( SOLDIERTYPE * pSoldier, BOOLEAN fTrainer ); -extern INT16 EffectiveStrength( SOLDIERTYPE * pSoldier, BOOLEAN fTrainer ); -extern INT16 EffectiveAgility( SOLDIERTYPE * pSoldier, BOOLEAN fTrainer ); -extern INT8 EffectiveLeadership( SOLDIERTYPE * pSoldier ); // anv: and passed to Hourly Update.cpp apparently, so added this one too - #endif \ No newline at end of file diff --git a/Tactical/SkillCheck.h b/Tactical/SkillCheck.h index b7955f2d..51e41ea3 100644 --- a/Tactical/SkillCheck.h +++ b/Tactical/SkillCheck.h @@ -1,27 +1,24 @@ #ifndef __SKILL_CHECK_H #define __SKILL_CHECK_H - #include "types.h" #include "Soldier Control.h" -extern void ReducePointsForFatigue( SOLDIERTYPE *pSoldier, UINT32 *pusPoints ); -extern INT32 GetSkillCheckPenaltyForFatigue( SOLDIERTYPE *pSoldier, INT32 iSkill ); -extern INT32 SkillCheck( SOLDIERTYPE *pSoldier, INT8 bReason, INT8 bDifficulty ); -extern INT16 CalcTrapDetectLevel( SOLDIERTYPE *pSoldier, BOOLEAN fExamining ); - - -extern INT16 EffectiveStrength( SOLDIERTYPE *pSoldier, BOOLEAN fTrainer ); -extern INT16 EffectiveWisdom( SOLDIERTYPE *pSoldier ); -extern INT16 EffectiveAgility( SOLDIERTYPE *pSoldier, BOOLEAN fTrainer ); -extern INT8 EffectiveMechanical( SOLDIERTYPE *pSoldier ); -extern INT8 EffectiveExplosive( SOLDIERTYPE *pSoldier ); -extern INT8 EffectiveLeadership( SOLDIERTYPE *pSoldier ); -extern INT8 EffectiveMarksmanship( SOLDIERTYPE *pSoldier ); -extern INT16 EffectiveDexterity( SOLDIERTYPE *pSoldier, BOOLEAN fTrainer ); -extern INT8 EffectiveExpLevel( SOLDIERTYPE *pSoldier ); -extern INT8 EffectiveMedical( SOLDIERTYPE *pSoldier ); +void ReducePointsForFatigue( SOLDIERTYPE *pSoldier, UINT32 *pusPoints ); +INT32 GetSkillCheckPenaltyForFatigue( SOLDIERTYPE *pSoldier, INT32 iSkill ); +INT32 SkillCheck( SOLDIERTYPE *pSoldier, INT8 bReason, INT8 bDifficulty ); +INT16 CalcTrapDetectLevel( SOLDIERTYPE *pSoldier, BOOLEAN fExamining ); +INT16 EffectiveStrength( SOLDIERTYPE *pSoldier, BOOLEAN fTrainer ); +INT16 EffectiveWisdom( SOLDIERTYPE *pSoldier ); +INT16 EffectiveAgility( SOLDIERTYPE *pSoldier, BOOLEAN fTrainer ); +INT8 EffectiveMechanical( SOLDIERTYPE *pSoldier ); +INT8 EffectiveExplosive( SOLDIERTYPE *pSoldier ); +INT8 EffectiveLeadership( SOLDIERTYPE *pSoldier ); +INT8 EffectiveMarksmanship( SOLDIERTYPE *pSoldier ); +INT16 EffectiveDexterity( SOLDIERTYPE *pSoldier, BOOLEAN fTrainer ); +INT8 EffectiveExpLevel( SOLDIERTYPE *pSoldier ); +INT8 EffectiveMedical( SOLDIERTYPE *pSoldier ); enum SkillChecks {