mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
Updated Merc Random Stats Feature (Jenilee)
- tweaked the stats generation so should see less super high level marks/agi, especially on low level mercs - randomization will now only affect AIM/MERC mercs. - randomized gear kits are now an ini setting: MERCS_RANDOM_GEAR_KITS = TRUE/FALSE. I made the gear randomization optional because it seems to cause trouble for people that don't use AIMNAS. SO hopefully this still lets them enjoy the random merc feature! git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6686 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -873,6 +873,7 @@ void LoadGameExternalOptions()
|
|||||||
gGameExternalOptions.fShowSkillsInHirePage = iniReader.ReadBoolean("Recruitment Settings", "SHOW_SKILLS_IN_HIRING_PAGE", FALSE);
|
gGameExternalOptions.fShowSkillsInHirePage = iniReader.ReadBoolean("Recruitment Settings", "SHOW_SKILLS_IN_HIRING_PAGE", FALSE);
|
||||||
|
|
||||||
gGameExternalOptions.ubMercRandomStats = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_STATS", 0, 0, 4);
|
gGameExternalOptions.ubMercRandomStats = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_STATS", 0, 0, 4);
|
||||||
|
gGameExternalOptions.fMercRandomGearKits = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_GEAR_KITS", FALSE); //Jenilee
|
||||||
gGameExternalOptions.fMercRandomBellDistribution = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_BELL_DISTRIBUTION", TRUE);
|
gGameExternalOptions.fMercRandomBellDistribution = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_BELL_DISTRIBUTION", TRUE);
|
||||||
gGameExternalOptions.ubMercRandomStatsRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_STAT_RANGE", 10, 0, 50);
|
gGameExternalOptions.ubMercRandomStatsRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_STAT_RANGE", 10, 0, 50);
|
||||||
gGameExternalOptions.ubMercRandomExpRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_EXP_RANGE", 1, 0, 4);
|
gGameExternalOptions.ubMercRandomExpRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_EXP_RANGE", 1, 0, 4);
|
||||||
|
|||||||
@@ -1210,6 +1210,8 @@ typedef struct
|
|||||||
|
|
||||||
UINT8 ubMercRandomStatsRange;
|
UINT8 ubMercRandomStatsRange;
|
||||||
|
|
||||||
|
BOOLEAN fMercRandomGearKits;
|
||||||
|
|
||||||
UINT8 ubMercRandomExpRange;
|
UINT8 ubMercRandomExpRange;
|
||||||
|
|
||||||
BOOLEAN fMercRandomStartSalary;
|
BOOLEAN fMercRandomStartSalary;
|
||||||
|
|||||||
+7
-15
@@ -13,8 +13,6 @@
|
|||||||
#include "Campaign.h"
|
#include "Campaign.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include "XML.h"
|
#include "XML.h"
|
||||||
|
|
||||||
//Jenilee: full randomization of mercs, including traits, gear kits and all statistics.
|
//Jenilee: full randomization of mercs, including traits, gear kits and all statistics.
|
||||||
@@ -77,7 +75,7 @@ bool GenerateRoleSet(UINT8 role_name, UINT8 hlt, UINT8 dex, UINT8 agi, UINT8 str
|
|||||||
void InitRandomMercs()
|
void InitRandomMercs()
|
||||||
{
|
{
|
||||||
// HLT DEX AGI STR WIS MRK LDR MEC EXP MED
|
// HLT DEX AGI STR WIS MRK LDR MEC EXP MED
|
||||||
GenerateRoleSet(ROLE_GENERIC, 15, 12, 17, 12, 11, 16, 4, 4, 4, 5);
|
GenerateRoleSet(ROLE_GENERIC, 14, 13, 13, 14, 13, 13, 5, 5, 5, 5);
|
||||||
|
|
||||||
GenerateRoleSet(ROLE_MEDIC, 8, 18, 16, 5, 14, 15, 3, 2, 2, 17);
|
GenerateRoleSet(ROLE_MEDIC, 8, 18, 16, 5, 14, 15, 3, 2, 2, 17);
|
||||||
GenerateRoleSet(ROLE_MECHANIC, 9, 17, 15, 5, 15, 17, 1, 18, 1, 2);
|
GenerateRoleSet(ROLE_MECHANIC, 9, 17, 15, 5, 15, 17, 1, 18, 1, 2);
|
||||||
@@ -780,11 +778,8 @@ INVTYPE* LBEFindSuitableLBE(std::map<UINT16, UINT16> storage, UINT16 lbe_type)
|
|||||||
return candidates[Random(candidates.size())];
|
return candidates[Random(candidates.size())];
|
||||||
}
|
}
|
||||||
|
|
||||||
//sort helper function
|
|
||||||
BOOL sort_cmp(UINT16 i, UINT16 j) { return (i < j); }
|
|
||||||
|
|
||||||
//this is the main randomization function that calls almost all the other functions.
|
//this is the main randomization function that calls almost all the other functions.
|
||||||
void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc)
|
void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc, BOOL random_gear_kits)
|
||||||
{
|
{
|
||||||
//reset merc's stats to basic values so we can increase them
|
//reset merc's stats to basic values so we can increase them
|
||||||
merc->bExpLevel = 1;
|
merc->bExpLevel = 1;
|
||||||
@@ -802,7 +797,7 @@ void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc)
|
|||||||
|
|
||||||
//determine character level and points (absolute maximum = 666 points)
|
//determine character level and points (absolute maximum = 666 points)
|
||||||
merc->bExpLevel = Random(9) + 1;
|
merc->bExpLevel = Random(9) + 1;
|
||||||
INT16 points = 350 + (merc->bExpLevel * 20) + Random(150);
|
INT16 points = 300 + (merc->bExpLevel * 10) + Random(20);
|
||||||
|
|
||||||
//determine roles and traits
|
//determine roles and traits
|
||||||
UINT8 roles_to_grant = 1 + Random((UINT16)((float)merc->bExpLevel / 2.0f));
|
UINT8 roles_to_grant = 1 + Random((UINT16)((float)merc->bExpLevel / 2.0f));
|
||||||
@@ -815,13 +810,8 @@ void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc)
|
|||||||
std::vector<UINT8> traits;
|
std::vector<UINT8> traits;
|
||||||
|
|
||||||
//spend our points budget
|
//spend our points budget
|
||||||
UINT16 tries = 0;
|
while (points > 0)
|
||||||
|
|
||||||
while (tries++ < 1000)
|
|
||||||
{
|
{
|
||||||
if (points < 1)
|
|
||||||
break;
|
|
||||||
|
|
||||||
UINT8 decider = Random(100);
|
UINT8 decider = Random(100);
|
||||||
|
|
||||||
if (decider < 30) //30% chance to assign a totally random stat
|
if (decider < 30) //30% chance to assign a totally random stat
|
||||||
@@ -897,6 +887,8 @@ void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc)
|
|||||||
merc->sMedicalDepositAmount = 0; //disabled now.
|
merc->sMedicalDepositAmount = 0; //disabled now.
|
||||||
merc->bMedicalDeposit = false;
|
merc->bMedicalDeposit = false;
|
||||||
|
|
||||||
|
if (random_gear_kits)
|
||||||
|
{
|
||||||
//generate gear kits for the merc
|
//generate gear kits for the merc
|
||||||
for (UINT8 kit_id = 0;kit_id < 5; kit_id++)
|
for (UINT8 kit_id = 0;kit_id < 5; kit_id++)
|
||||||
{
|
{
|
||||||
@@ -1073,4 +1065,4 @@ void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc)
|
|||||||
merc->usOptionalGearCost = kit_cost;
|
merc->usOptionalGearCost = kit_cost;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -108,7 +108,7 @@ void RandomStats();
|
|||||||
void RandomStartSalary();
|
void RandomStartSalary();
|
||||||
|
|
||||||
//Jenilee
|
//Jenilee
|
||||||
extern void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc);
|
extern void RandomizeMerc(UINT8 profile_id, MERCPROFILESTRUCT* merc, BOOL random_gear_kits);
|
||||||
extern void InitRandomMercs();
|
extern void InitRandomMercs();
|
||||||
extern void ExitRandomMercs();
|
extern void ExitRandomMercs();
|
||||||
|
|
||||||
@@ -596,13 +596,15 @@ void RandomStats()
|
|||||||
InitRandomMercs();
|
InitRandomMercs();
|
||||||
|
|
||||||
for ( cnt = 0; cnt < NUM_PROFILES; cnt++ )
|
for ( cnt = 0; cnt < NUM_PROFILES; cnt++ )
|
||||||
|
{
|
||||||
|
if (IsProfileIdAnAimOrMERCMerc(cnt)) //affect only AIM and MERC mercs
|
||||||
{
|
{
|
||||||
pProfile = &(gMercProfiles[cnt]);
|
pProfile = &(gMercProfiles[cnt]);
|
||||||
RandomizeMerc(cnt, pProfile);
|
RandomizeMerc(cnt, pProfile, gGameExternalOptions.fMercRandomGearKits);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExitRandomMercs();
|
ExitRandomMercs(); }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RandomStartSalary()
|
void RandomStartSalary()
|
||||||
|
|||||||
Reference in New Issue
Block a user