Replace evolution with growth rates (#201)

This commit is contained in:
rftrdev
2023-08-09 18:36:44 -07:00
committed by GitHub
parent 43c6943399
commit aaeea9aac8
24 changed files with 685 additions and 161 deletions
+32 -38
View File
@@ -167,25 +167,14 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh
INT8 bCurrentRating;
UINT16 *psStatGainPtr;
BOOLEAN fAffectedByWisdom = TRUE;
INT8 evolution = NORMAL_EVOLUTION;
Assert(pProfile != NULL);
if ( !gGameExternalOptions.bDisableEvolution )
evolution = pProfile->bEvolution;
if ( evolution == NO_EVOLUTION )
return; // No change possible, quit right away
// if this is a Reverse-Evolving merc who attempting to train
if ( ( ubReason == FROM_TRAINING ) && ( evolution == DEVOLVE ) )
return; // he doesn't get any benefit, but isn't penalized either
if (usNumChances == 0)
return;
usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile->bExpLevel);
usSubpointsPerLevel = SubpointsPerPoint(EXPERAMT, pProfile->bExpLevel);
usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile);
usSubpointsPerLevel = SubpointsPerPoint(EXPERAMT, pProfile);
switch (ubStat)
{
@@ -255,7 +244,6 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh
return;
}
if (ubReason == FROM_TRAINING)
{
// training always affected by wisdom
@@ -271,7 +259,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh
// loop once for each chance to improve
for (uiCnt = 0; uiCnt < usNumChances; ++uiCnt)
{
if ( evolution != DEVOLVE) // Evolves!
if (pProfile->fRegresses == FALSE) // Evolves!
{
// if this is improving from a failure, and a successful roll would give us enough to go up a point
if ((ubReason == FROM_FAILURE) && ((*psStatGainPtr + 1) >= usSubpointsPerPoint))
@@ -302,7 +290,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh
// if there IS a usChance, adjust it for high or low wisdom (50 is avg)
if (usChance > 0 && fAffectedByWisdom)
{
usChance += (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile->bExpLevel)) - 50)) / 100;
usChance += (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile)) - 50)) / 100;
}
// rftr: reduced growth rates at 80+ and 90+ (to make mercs with higher base stats more valuable)
@@ -315,14 +303,6 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh
usChance = min(gGameExternalOptions.ubMaxGrowthChanceAt80, usChance);
}
/*
// if the stat is Marksmanship, and the guy is a hopeless shot
if ((ubStat == MARKAMT) && (pProfile->bSpecialTrait == HOPELESS_SHOT))
{
usChance /= 5; // MUCH slower to improve, divide usChance by 5
}
*/
// SANDRO - penalty for primitive people, they get lesser chance to gain point for certain skills
if ( gGameOptions.fNewTraitSystem && (usChance > 10) && (ubStat != EXPERAMT) && (pProfile->bCharacterTrait == CHAR_TRAIT_PRIMITIVE) )
{
@@ -338,14 +318,6 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh
}
}
// Buggler: more evolution rate choices
if ( evolution == THREEQUARTER_EVOLUTION)
usChance = max(1, usChance * 0.75);
else if ( evolution == HALF_EVOLUTION)
usChance = max(1, usChance * 0.5);
else if ( evolution == ONEQUARTER_EVOLUTION)
usChance = max(1, usChance * 0.25);
// maximum possible usChance is 99%
if (usChance > 99)
{
@@ -413,7 +385,7 @@ void ProcessStatChange(MERCPROFILESTRUCT *pProfile, UINT8 ubStat, UINT16 usNumCh
// if there IS a usChance, adjust it for high or low wisdom (50 is avg)
if (usChance > 0 && fAffectedByWisdom)
{
usChance -= (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile->bExpLevel)) - 50)) / 100;
usChance -= (usChance * (pProfile->bWisdom + (pProfile->sWisdomGain / SubpointsPerPoint(WISDOMAMT, pProfile)) - 50)) / 100;
}
// if there's ANY usChance, minimum usChance is 1% regardless of wisdom
@@ -497,7 +469,7 @@ void ChangeStat( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UINT8 ubSta
UINT16 usSubpointsPerPoint;
INT8 bDamagedStatToRaise = -1; // added by SANDRO
usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile->bExpLevel );
usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile );
// build ptrs to appropriate profiletype stat fields
switch( ubStat )
@@ -923,7 +895,7 @@ void ProcessUpdateStats( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UIN
// set default min & max, subpoints/pt.
bMinStatValue = 1;
bMaxStatValue = MAX_STAT_VALUE;
usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile->bExpLevel);
usSubpointsPerPoint = SubpointsPerPoint(ubStat, pProfile);
// build ptrs to appropriate profiletype stat fields
switch( ubStat )
@@ -1166,7 +1138,7 @@ UINT32 RoundOffSalary(UINT32 uiSalary)
}
UINT16 SubpointsPerPoint(UINT8 ubStat, INT8 bExpLevel)
UINT16 SubpointsPerPoint(UINT8 ubStat, MERCPROFILESTRUCT* pProfile)
{
UINT16 usSubpointsPerPoint;
@@ -1187,40 +1159,62 @@ UINT16 SubpointsPerPoint(UINT8 ubStat, INT8 bExpLevel)
// Attributes
case HEALTHAMT:
usSubpointsPerPoint = HEALTH_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierLife;
usSubpointsPerPoint = max(usSubpointsPerPoint, HEALTH_SUBPOINTS_TO_IMPROVE/2);
break;
case AGILAMT:
usSubpointsPerPoint = AGILITY_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierAgility;
usSubpointsPerPoint = max(usSubpointsPerPoint, AGILITY_SUBPOINTS_TO_IMPROVE/2);
break;
case DEXTAMT:
usSubpointsPerPoint = DEXTERITY_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierDexterity;
usSubpointsPerPoint = max(usSubpointsPerPoint, DEXTERITY_SUBPOINTS_TO_IMPROVE/2);
break;
case WISDOMAMT:
usSubpointsPerPoint = WISDOM_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierWisdom;
usSubpointsPerPoint = max(usSubpointsPerPoint, WISDOM_SUBPOINTS_TO_IMPROVE/2);
break;
case STRAMT:
usSubpointsPerPoint = STRENGTH_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierStrength;
usSubpointsPerPoint = max(usSubpointsPerPoint, STRENGTH_SUBPOINTS_TO_IMPROVE/2);
break;
// Skills
case MEDICALAMT:
usSubpointsPerPoint = MEDICAL_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierMedical;
usSubpointsPerPoint = max(usSubpointsPerPoint, MEDICAL_SUBPOINTS_TO_IMPROVE/2);
break;
case EXPLODEAMT:
usSubpointsPerPoint = EXPLOSIVES_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierExplosive;
usSubpointsPerPoint = max(usSubpointsPerPoint, EXPLOSIVES_SUBPOINTS_TO_IMPROVE/2);
break;
case MECHANAMT:
usSubpointsPerPoint = MECHANICAL_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierMechanical;
usSubpointsPerPoint = max(usSubpointsPerPoint, MECHANICAL_SUBPOINTS_TO_IMPROVE/2);
break;
case MARKAMT:
usSubpointsPerPoint = MARKSMANSHIP_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierMarksmanship;
usSubpointsPerPoint = max(usSubpointsPerPoint, MARKSMANSHIP_SUBPOINTS_TO_IMPROVE/2);
break;
case LDRAMT:
usSubpointsPerPoint = LEADERSHIP_SUBPOINTS_TO_IMPROVE;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierLeadership;
usSubpointsPerPoint = max(usSubpointsPerPoint, LEADERSHIP_SUBPOINTS_TO_IMPROVE/2);
break;
// Experience
case EXPERAMT:
usSubpointsPerPoint = LEVEL_SUBPOINTS_TO_IMPROVE * bExpLevel;
usSubpointsPerPoint = LEVEL_SUBPOINTS_TO_IMPROVE * pProfile->bExpLevel;
if (gGameExternalOptions.fMercGrowthModifiersEnabled) usSubpointsPerPoint += pProfile->bGrowthModifierExpLevel;
usSubpointsPerPoint = max(usSubpointsPerPoint, LEVEL_SUBPOINTS_TO_IMPROVE * pProfile->bExpLevel / 2);
break;
default:
@@ -1797,7 +1791,7 @@ void TestDumpStatChanges(void)
// print days served
fprintf(FDump, "%3d ", pProfile->usTotalDaysServed);
// print evolution type
fprintf(FDump, "%c ", cEvolutionChars[ pProfile->bEvolution ]);
fprintf(FDump, "%c ", cEvolutionChars[ pProfile->fRegresses ]);
// now print all non-zero stats
for( ubStat = FIRST_CHANGEABLE_STAT; ubStat <= LAST_CHANGEABLE_STAT; ubStat++ )
+2 -2
View File
@@ -73,7 +73,7 @@ void ProcessUpdateStats( MERCPROFILESTRUCT *pProfile, SOLDIERTYPE *pSoldier, UIN
UINT32 CalcNewSalary(UINT32 uiOldSalary, BOOLEAN fIncrease, UINT32 uiMaxLimit, UINT32 uiIncreaseCap);
UINT32 RoundOffSalary(UINT32 uiSalary);
UINT16 SubpointsPerPoint(UINT8 ubStat, INT8 bExpLevel);
UINT16 SubpointsPerPoint(UINT8 ubStat, MERCPROFILESTRUCT* pProfile);
void HandleUnhiredMercImprovement( MERCPROFILESTRUCT *pProfile );
void HandleUnhiredMercDeaths( INT32 iProfileID );
@@ -92,4 +92,4 @@ void BuildStatChangeString( STR16 wString, STR16 wName, BOOLEAN fIncrease, INT16
void MERCMercWentUpALevelSendEmail( UINT8 ubMercMercIdValue );
#endif
#endif
+10 -10
View File
@@ -2598,7 +2598,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// AGI
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sAgilityGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT,0);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sAgilityGain+1)) / SubpointsPerPoint(AGILAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_AGI_Y-1);
ClipRect.iBottom = (SM_AGI_Y-1) + SM_STATS_HEIGHT;
@@ -2610,7 +2610,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// DEX
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sDexterityGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT,0);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sDexterityGain+1)) / SubpointsPerPoint(DEXTAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_DEX_Y-1);
ClipRect.iBottom = (SM_DEX_Y-1) + SM_STATS_HEIGHT;
@@ -2622,7 +2622,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// STR
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sStrengthGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT,0);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sStrengthGain+1)) / SubpointsPerPoint(STRAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_STR_Y-1);
ClipRect.iBottom = (SM_STR_Y-1) + SM_STATS_HEIGHT;
@@ -2634,7 +2634,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// WIS
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sWisdomGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT,0);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sWisdomGain+1)) / SubpointsPerPoint(WISDOMAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_WIS_Y-1);
ClipRect.iBottom = (SM_WIS_Y-1) + SM_STATS_HEIGHT;
@@ -2646,7 +2646,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// MRK
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMarksmanshipGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT,0);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMarksmanshipGain+1)) / SubpointsPerPoint(MARKAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_MRKM_Y-1);
ClipRect.iBottom = (SM_MRKM_Y-1) + SM_STATS_HEIGHT;
@@ -2658,7 +2658,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// LDR
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sLeadershipGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT,0);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sLeadershipGain+1)) / SubpointsPerPoint(LDRAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_CHAR_Y-1);
ClipRect.iBottom = (SM_CHAR_Y-1) + SM_STATS_HEIGHT;
@@ -2670,7 +2670,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// MECH
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMechanicGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT,0);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMechanicGain+1)) / SubpointsPerPoint(MECHANAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_MECH_Y-1);
ClipRect.iBottom = (SM_MECH_Y-1) + SM_STATS_HEIGHT;
@@ -2682,7 +2682,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// EXPLO
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExplosivesGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT,0);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExplosivesGain+1)) / SubpointsPerPoint(EXPLODEAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_EXPL_Y-1);
ClipRect.iBottom = (SM_EXPL_Y-1) + SM_STATS_HEIGHT;
@@ -2694,7 +2694,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// MED
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMedicalGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT,0);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sMedicalGain+1)) / SubpointsPerPoint(MEDICALAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_MED_Y-1);
ClipRect.iBottom = (SM_MED_Y-1) + SM_STATS_HEIGHT;
@@ -2706,7 +2706,7 @@ void RenderSMPanel( BOOLEAN *pfDirty )
// EXPLEVEL
if (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExpLevelGain)
{
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, gpSMCurrentMerc->stats.bExpLevel);
ubBarWidth = (SM_STATS_WIDTH * (gMercProfiles[ gpSMCurrentMerc->ubProfile ].sExpLevelGain+1)) / SubpointsPerPoint(EXPERAMT, &gMercProfiles[gpSMCurrentMerc->ubProfile]);
ubBarWidth = __max(0, __min(ubBarWidth, SM_STATS_WIDTH));
ClipRect.iTop = (SM_EXPLVL_Y-1);
ClipRect.iBottom = (SM_EXPLVL_Y-1) + SM_STATS_HEIGHT;
+1 -1
View File
@@ -1339,7 +1339,7 @@ MERCPROFILESTRUCT& MERCPROFILESTRUCT::operator=(const OLD_MERCPROFILESTRUCT_101&
this->bSex = src.bSex;
this->bArmourAttractiveness = src.bArmourAttractiveness;
this->ubMiscFlags2 = src.ubMiscFlags2;
this->bEvolution = src.bEvolution;
this->fRegresses = src.bEvolution == 2; // formerly, 2 == CharacterEvolution::DEVOLVES
this->ubMiscFlags = src.ubMiscFlags;
this->bSexist = src.bSexist;
this->bLearnToHate = src.bLearnToHate;
+46 -1
View File
@@ -98,6 +98,7 @@ extern UINT8 gubItemDroppableFlag[NUM_INV_SLOTS];
//Random Stats
RANDOM_STATS_VALUES gRandomStatsValue[NUM_PROFILES];
void RandomStats();
void RandomGrowthModifiers();
void RandomStartSalary();
//Jenilee
@@ -459,6 +460,35 @@ void RandomStats()
ExitRandomMercs(); }
}
void RandomGrowthModifiers()
{
UINT32 cnt;
MERCPROFILESTRUCT * pProfile;
BOOLEAN useBellCurve = TRUE;
if (gGameExternalOptions.fMercRandomGrowthModifiers == TRUE)
{
for (cnt = 0; cnt < NUM_PROFILES; cnt++)
{
pProfile = &(gMercProfiles[cnt]);
// cap minimum growth modifier to negative half subpoints. this is effectively double speed using default values (subpoints = 50)
// cap maximum growth modifier to 30000. this would make a merc take 600x as long to level up a stat using default values
pProfile->bGrowthModifierExpLevel = RandomAbsoluteRange( pProfile->bGrowthModifierExpLevel, -gGameExternalOptions.usLevelSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierLife = RandomAbsoluteRange( pProfile->bGrowthModifierLife, -gGameExternalOptions.usHealthSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierAgility = RandomAbsoluteRange( pProfile->bGrowthModifierAgility, -gGameExternalOptions.usAgilitySubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierDexterity = RandomAbsoluteRange( pProfile->bGrowthModifierDexterity, -gGameExternalOptions.usDexteritySubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierStrength = RandomAbsoluteRange( pProfile->bGrowthModifierStrength, -gGameExternalOptions.usStrengthSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierLeadership = RandomAbsoluteRange( pProfile->bGrowthModifierLeadership, -gGameExternalOptions.usLeadershipSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierWisdom = RandomAbsoluteRange( pProfile->bGrowthModifierWisdom, -gGameExternalOptions.usWisdomSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierMarksmanship = RandomAbsoluteRange( pProfile->bGrowthModifierMarksmanship, -gGameExternalOptions.usMarksmanshipSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierMechanical = RandomAbsoluteRange( pProfile->bGrowthModifierMechanical, -gGameExternalOptions.usMechanicalSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierExplosive = RandomAbsoluteRange( pProfile->bGrowthModifierExplosive, -gGameExternalOptions.usExplosivesSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
pProfile->bGrowthModifierMedical = RandomAbsoluteRange( pProfile->bGrowthModifierMedical, -gGameExternalOptions.usMedicalSubpointsToImprove/2, 30000, gGameExternalOptions.iMercRandomGrowthModifiersRange, useBellCurve );
}
}
}
void RandomStartSalary()
{
UINT32 cnt;
@@ -996,6 +1026,8 @@ for( int i = 0; i < NUM_PROFILES; i++ )
// ---------------
RandomStats (); //random stats by Jazz
RandomGrowthModifiers();
// Buggler: random starting salary
RandomStartSalary ();
@@ -2522,7 +2554,7 @@ void OverwriteMercProfileWithXMLData( UINT32 uiLoop )
gMercProfiles[ uiLoop ].bMechanical = tempProfiles[ uiLoop ].bMechanical ;
gMercProfiles[ uiLoop ].bExpLevel = tempProfiles[ uiLoop ].bExpLevel ;
gMercProfiles[ uiLoop ].bEvolution = tempProfiles[ uiLoop ].bEvolution ;
gMercProfiles[uiLoop].fRegresses = tempProfiles[ uiLoop ].fRegresses;
//////////////////////////////////////////////////////////////////////////////////////
// SANDRO - Check old/new traits and repair possible errors
if (gGameOptions.fNewTraitSystem)
@@ -2637,6 +2669,19 @@ void OverwriteMercProfileWithXMLData( UINT32 uiLoop )
gMercProfiles[ uiLoop ].usVoiceIndex = tempProfiles[uiLoop].usVoiceIndex;
gMercProfiles[ uiLoop ].Type = tempProfiles[uiLoop].Type;
gMercProfiles[uiLoop].fRegresses = tempProfiles[uiLoop].fRegresses;
gMercProfiles[uiLoop].bGrowthModifierLife = tempProfiles[uiLoop].bGrowthModifierLife;
gMercProfiles[uiLoop].bGrowthModifierStrength = tempProfiles[uiLoop].bGrowthModifierStrength;
gMercProfiles[uiLoop].bGrowthModifierAgility = tempProfiles[uiLoop].bGrowthModifierAgility;
gMercProfiles[uiLoop].bGrowthModifierDexterity = tempProfiles[uiLoop].bGrowthModifierDexterity;
gMercProfiles[uiLoop].bGrowthModifierWisdom = tempProfiles[uiLoop].bGrowthModifierWisdom;
gMercProfiles[uiLoop].bGrowthModifierMarksmanship = tempProfiles[uiLoop].bGrowthModifierMarksmanship;
gMercProfiles[uiLoop].bGrowthModifierExplosive = tempProfiles[uiLoop].bGrowthModifierExplosive;
gMercProfiles[uiLoop].bGrowthModifierLeadership = tempProfiles[uiLoop].bGrowthModifierLeadership;
gMercProfiles[uiLoop].bGrowthModifierMedical = tempProfiles[uiLoop].bGrowthModifierMedical;
gMercProfiles[uiLoop].bGrowthModifierMechanical = tempProfiles[uiLoop].bGrowthModifierMechanical;
gMercProfiles[uiLoop].bGrowthModifierExpLevel = tempProfiles[uiLoop].bGrowthModifierExpLevel;
gProfileType[uiLoop] = gMercProfiles[uiLoop].Type;
switch ( tempProfiles[uiLoop].Type )
+12 -1
View File
@@ -314,7 +314,18 @@ typedef struct
INT8 bExpLevel;
INT8 bEvolution;
BOOLEAN fRegresses;
INT16 bGrowthModifierLife;
INT16 bGrowthModifierStrength;
INT16 bGrowthModifierAgility;
INT16 bGrowthModifierDexterity;
INT16 bGrowthModifierWisdom;
INT16 bGrowthModifierMarksmanship;
INT16 bGrowthModifierExplosive;
INT16 bGrowthModifierLeadership;
INT16 bGrowthModifierMedical;
INT16 bGrowthModifierMechanical;
INT16 bGrowthModifierExpLevel;
// changed by SANDRO
INT8 bOldSkillTrait;
INT8 bOldSkillTrait2;
+88 -6
View File
@@ -101,7 +101,19 @@ profileStartElementHandle(void *userData, const XML_Char *name, const XML_Char *
strcmp(name, "bMedical") == 0 ||
strcmp(name, "bMechanical") == 0 ||
strcmp(name, "bExpLevel") == 0 ||
strcmp(name, "bEvolution") == 0 ||
strcmp(name, "fRegresses") == 0 ||
// rftr: growth rates are intended to replace the <bEvolution> tag, letting each stat have its own growth modifier
strcmp(name, "bGrowthModifierLife") == 0 ||
strcmp(name, "bGrowthModifierStrength") == 0 ||
strcmp(name, "bGrowthModifierAgility") == 0 ||
strcmp(name, "bGrowthModifierDexterity") == 0 ||
strcmp(name, "bGrowthModifierWisdom") == 0 ||
strcmp(name, "bGrowthModifierMarksmanship") == 0 ||
strcmp(name, "bGrowthModifierExplosive") == 0 ||
strcmp(name, "bGrowthModifierLeadership") == 0 ||
strcmp(name, "bGrowthModifierMedical") == 0 ||
strcmp(name, "bGrowthModifierMechanical") == 0 ||
strcmp(name, "bGrowthModifierExpLevel") == 0 ||
// added by SANDRO
strcmp(name, "bOldSkillTrait") == 0 ||
strcmp(name, "bOldSkillTrait2") == 0 ||
@@ -280,7 +292,18 @@ profileEndElementHandle(void *userData, const XML_Char *name)
tempProfiles[pData->curIndex].bMechanical = pData->curProfile.bMechanical;
tempProfiles[pData->curIndex].bExpLevel = pData->curProfile.bExpLevel;
tempProfiles[pData->curIndex].bEvolution = pData->curProfile.bEvolution;
tempProfiles[pData->curIndex].fRegresses = pData->curProfile.fRegresses;
tempProfiles[pData->curIndex].bGrowthModifierLife = pData->curProfile.bGrowthModifierLife;
tempProfiles[pData->curIndex].bGrowthModifierStrength = pData->curProfile.bGrowthModifierStrength;
tempProfiles[pData->curIndex].bGrowthModifierAgility = pData->curProfile.bGrowthModifierAgility;
tempProfiles[pData->curIndex].bGrowthModifierDexterity = pData->curProfile.bGrowthModifierDexterity;
tempProfiles[pData->curIndex].bGrowthModifierWisdom = pData->curProfile.bGrowthModifierWisdom;
tempProfiles[pData->curIndex].bGrowthModifierMarksmanship = pData->curProfile.bGrowthModifierMarksmanship;
tempProfiles[pData->curIndex].bGrowthModifierExplosive = pData->curProfile.bGrowthModifierExplosive;
tempProfiles[pData->curIndex].bGrowthModifierLeadership = pData->curProfile.bGrowthModifierLeadership;
tempProfiles[pData->curIndex].bGrowthModifierMedical = pData->curProfile.bGrowthModifierMedical;
tempProfiles[pData->curIndex].bGrowthModifierMechanical = pData->curProfile.bGrowthModifierMechanical;
tempProfiles[pData->curIndex].bGrowthModifierExpLevel = pData->curProfile.bGrowthModifierExpLevel;
// added by SANDRO
tempProfiles[pData->curIndex].bOldSkillTrait = pData->curProfile.bOldSkillTrait;
tempProfiles[pData->curIndex].bOldSkillTrait2 = pData->curProfile.bOldSkillTrait2;
@@ -586,11 +609,70 @@ profileEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curProfile.bExpLevel = (UINT32) strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bEvolution") == 0)
else if(strcmp(name, "fRegresses") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bEvolution = (UINT32) strtoul(pData->szCharData, NULL, 0);
pData->curProfile.fRegresses = (BOOLEAN) strtoul(pData->szCharData, NULL, 0);
}
else if (strncmp(name, "bGrowthModifier", 11) == 0) // doing this to avoid C1061
{
if (strcmp(name, "bGrowthModifierLife") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierLife = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierStrength") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierStrength = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierAgility") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierAgility = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierDexterity") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierDexterity = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierWisdom") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierWisdom = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierMarksmanship") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierMarksmanship = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierExplosive") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierExplosive = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierLeadership") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierLeadership = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierMedical") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierMedical = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierMechanical") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierMechanical = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
else if(strcmp(name, "bGrowthModifierExpLevel") == 0)
{
pData->curElement = ELEMENT;
pData->curProfile.bGrowthModifierExpLevel = (UINT32)strtoul(pData->szCharData, NULL, 0);
}
}
////////////////////////////////////////////////////////////////////////////
// SANDRO was here - messed this a bit
@@ -1600,7 +1682,7 @@ BOOLEAN WriteMercProfiles()
FilePrintf(hFile,"\t\t<bMedical>%d</bMedical>\r\n", gMercProfiles[ cnt ].bMedical);
FilePrintf(hFile,"\t\t<bMechanical>%d</bMechanical>\r\n", gMercProfiles[ cnt ].bMechanical);
FilePrintf(hFile,"\t\t<bExpLevel>%d</bExpLevel>\r\n", gMercProfiles[ cnt ].bExpLevel);
FilePrintf(hFile,"\t\t<bEvolution>%d</bEvolution>\r\n", gMercProfiles[ cnt ].bEvolution);
FilePrintf(hFile,"\t\t<fRegresses>%d</fRegresses>\r\n", gMercProfiles[ cnt ].fRegresses);
////////////////////////////////////////////////////////////////////////////////////////////
// SANDRO - old/new traits
if (gGameOptions.fNewTraitSystem)
+15 -13
View File
@@ -402,18 +402,7 @@ typedef enum
NUM_SEXIST
} SexistLevels;
// training defines for evolution, no stat increase, stat decrease( de-evolve )
typedef enum
{
NORMAL_EVOLUTION =0,
NO_EVOLUTION,
DEVOLVE,
THREEQUARTER_EVOLUTION,
HALF_EVOLUTION,
ONEQUARTER_EVOLUTION,
} CharacterEvolution;
// rftr: removed the CharacterEvolution enum as it was replaced by growth modifiers
#define BUDDY_MERC( prof, bud ) ((prof)->bBuddy[0] == (bud) || (prof)->bBuddy[1] == (bud) || (prof)->bBuddy[2] == (bud) || (prof)->bBuddy[3] == (bud) || (prof)->bBuddy[4] == (bud) || ( (prof)->bLearnToLike == (bud) && (prof)->bLearnToLikeCount == 0 ) )
#define HATED_MERC( prof, hat ) ((prof)->bHated[0] == (hat) || (prof)->bHated[1] == (hat) || (prof)->bHated[2] == (hat) || (prof)->bHated[3] == (hat) || (prof)->bHated[4] == (hat) || ( (prof)->bLearnToHate == (hat) && (prof)->bLearnToHateCount == 0 ) )
@@ -789,7 +778,7 @@ public:
INT8 bSex;
INT8 bArmourAttractiveness;
UINT8 ubMiscFlags2;
INT8 bEvolution;
BOOLEAN fRegresses;
UINT8 ubMiscFlags;
UINT8 bSexist;
UINT8 bLearnToHate;
@@ -1009,6 +998,19 @@ public:
// Flugente: type of profile
UINT32 Type;
// rftr: growth modifiers - ignored if fRegresses is TRUE
INT16 bGrowthModifierLife;
INT16 bGrowthModifierStrength;
INT16 bGrowthModifierAgility;
INT16 bGrowthModifierDexterity;
INT16 bGrowthModifierWisdom;
INT16 bGrowthModifierMarksmanship;
INT16 bGrowthModifierExplosive;
INT16 bGrowthModifierLeadership;
INT16 bGrowthModifierMedical;
INT16 bGrowthModifierMechanical;
INT16 bGrowthModifierExpLevel;
}; // MERCPROFILESTRUCT;
// WANNE - BMP: DONE!