1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

Hardcoded feature to allow new heroes always have 3 stacks like in HotA

This commit is contained in:
Dydzio 2023-02-02 22:28:14 +01:00
parent a5f51b21c4
commit 4f4660e82d
4 changed files with 18 additions and 9 deletions

@ -33,7 +33,8 @@
"ATTACK_POINT_DMG_MULTIPLIER": 0.05, //every 1 attack point damage influence in battle when attack points > defense points during creature attack
"ATTACK_POINTS_DMG_MULTIPLIER_CAP": 4.0, //limit of damage increase that can be achieved by overpowering attack points
"DEFENSE_POINT_DMG_MULTIPLIER": 0.025, //every 1 defense point damage influence in battle when defense points > attack points during creature attack
"DEFENSE_POINTS_DMG_MULTIPLIER_CAP": 0.7 //limit of damage reduction that can be achieved by overpowering defense points
"DEFENSE_POINTS_DMG_MULTIPLIER_CAP": 0.7, //limit of damage reduction that can be achieved by overpowering defense points
"NEW_HERO_ALWAYS_3_CREATURE_STACKS": false
},
"modules":
{

@ -766,6 +766,8 @@ void CModHandler::loadConfigFromFile (std::string name)
logMod->debug("\tDEFENSE_POINT_DMG_MULTIPLIER\t%f", settings.DEFENSE_POINT_DMG_MULTIPLIER);
settings.DEFENSE_POINTS_DMG_MULTIPLIER_CAP = hardcodedFeatures["DEFENSE_POINTS_DMG_MULTIPLIER_CAP"].Float();
logMod->debug("\tDEFENSE_POINTS_DMG_MULTIPLIER_CAP\t%f", settings.DEFENSE_POINTS_DMG_MULTIPLIER_CAP);
settings.NEW_HERO_ALWAYS_3_CREATURE_STACKS = hardcodedFeatures["NEW_HERO_ALWAYS_3_CREATURE_STACKS"].Bool();
logMod->debug("\tNEW_HERO_ALWAYS_3_CREATURE_STACKS\t%f", settings.NEW_HERO_ALWAYS_3_CREATURE_STACKS);
const JsonNode & gameModules = settings.data["modules"];
modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool();

@ -363,6 +363,7 @@ public:
double ATTACK_POINTS_DMG_MULTIPLIER_CAP;
double DEFENSE_POINT_DMG_MULTIPLIER;
double DEFENSE_POINTS_DMG_MULTIPLIER_CAP;
bool NEW_HERO_ALWAYS_3_CREATURE_STACKS;
template <typename Handler> void serialize(Handler &h, const int version)
{
@ -382,6 +383,7 @@ public:
h & ATTACK_POINTS_DMG_MULTIPLIER_CAP;
h & DEFENSE_POINT_DMG_MULTIPLIER;
h & DEFENSE_POINTS_DMG_MULTIPLIER_CAP;
h & NEW_HERO_ALWAYS_3_CREATURE_STACKS;
}
} settings;

@ -348,16 +348,20 @@ void CGHeroInstance::initArmy(CRandomGenerator & rand, IArmyDescriptor * dst)
if(!dst)
dst = this;
int howManyStacks = 0; //how many stacks will hero receives <1 - 3>
int pom = rand.nextInt(99);
int howManyStacks = 3; //how many stacks will hero receives <1 - 3>
int warMachinesGiven = 0;
if(pom < 9)
howManyStacks = 1;
else if(pom < 79)
howManyStacks = 2;
else
howManyStacks = 3;
if(!VLC->modh->settings.NEW_HERO_ALWAYS_3_CREATURE_STACKS)
{
int stacksCountInitRandomNumber = rand.nextInt(99);
if(stacksCountInitRandomNumber < 9)
howManyStacks = 1;
else if(stacksCountInitRandomNumber < 79)
howManyStacks = 2;
else
howManyStacks = 3;
}
vstd::amin(howManyStacks, type->initialArmy.size());