diff --git a/config/defaultMods.json b/config/defaultMods.json index daa6af0c6..4aad3fb71 100644 --- a/config/defaultMods.json +++ b/config/defaultMods.json @@ -26,7 +26,11 @@ "MAX_HEROES_ON_MAP_PER_PLAYER" : 8, "WINNING_HERO_WITH_NO_TROOPS_RETREATS": true, "BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE": true, - "NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS": false + "NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS": false, + "ATTACK_POINT_DMG_MULTIPLIER": 0.05, + "ATTACK_POINTS_DMG_MULTIPLIER_CAP": 4.0, + "DEFENSE_POINT_DMG_MULTIPLIER": 0.025, + "DEFENSE_POINTS_DMG_MULTIPLIER_CAP": 0.7 }, "modules": { diff --git a/lib/CModHandler.cpp b/lib/CModHandler.cpp index c79457f96..8fc32149d 100644 --- a/lib/CModHandler.cpp +++ b/lib/CModHandler.cpp @@ -751,6 +751,14 @@ void CModHandler::loadConfigFromFile (std::string name) logMod->debug("\tBLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE\t%d", static_cast(settings.BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE)); settings.NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS = hardcodedFeatures["NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS"].Bool(); logMod->debug("\tNO_RANDOM_SPECIAL_WEEKS_AND_MONTHS\t%d", static_cast(settings.NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS)); + settings.ATTACK_POINT_DMG_MULTIPLIER = hardcodedFeatures["ATTACK_POINT_DMG_MULTIPLIER"].Float(); + logMod->debug("\tATTACK_POINT_DMG_MULTIPLIER\t%f", settings.ATTACK_POINT_DMG_MULTIPLIER); + settings.ATTACK_POINTS_DMG_MULTIPLIER_CAP = hardcodedFeatures["ATTACK_POINTS_DMG_MULTIPLIER_CAP"].Float(); + logMod->debug("\tATTACK_POINTS_DMG_MULTIPLIER_CAP\t%f", settings.ATTACK_POINTS_DMG_MULTIPLIER_CAP); + settings.DEFENSE_POINT_DMG_MULTIPLIER = hardcodedFeatures["DEFENSE_POINT_DMG_MULTIPLIER"].Float(); + 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); const JsonNode & gameModules = settings.data["modules"]; modules.STACK_EXP = gameModules["STACK_EXPERIENCE"].Bool(); diff --git a/lib/CModHandler.h b/lib/CModHandler.h index adf8cb752..64e4c420a 100644 --- a/lib/CModHandler.h +++ b/lib/CModHandler.h @@ -358,6 +358,10 @@ public: bool WINNING_HERO_WITH_NO_TROOPS_RETREATS; bool BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE; bool NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS; + double ATTACK_POINT_DMG_MULTIPLIER; + double ATTACK_POINTS_DMG_MULTIPLIER_CAP; + double DEFENSE_POINT_DMG_MULTIPLIER; + double DEFENSE_POINTS_DMG_MULTIPLIER_CAP; template void serialize(Handler &h, const int version) { @@ -373,6 +377,10 @@ public: h & WINNING_HERO_WITH_NO_TROOPS_RETREATS; h & BLACK_MARKET_MONTHLY_ARTIFACTS_CHANGE; h & NO_RANDOM_SPECIAL_WEEKS_AND_MONTHS; + h & ATTACK_POINT_DMG_MULTIPLIER; + h & ATTACK_POINTS_DMG_MULTIPLIER_CAP; + h & DEFENSE_POINT_DMG_MULTIPLIER; + h & DEFENSE_POINTS_DMG_MULTIPLIER_CAP; } } settings; diff --git a/lib/battle/CBattleInfoCallback.cpp b/lib/battle/CBattleInfoCallback.cpp index 2df6f4377..3e10b38c3 100644 --- a/lib/battle/CBattleInfoCallback.cpp +++ b/lib/battle/CBattleInfoCallback.cpp @@ -18,6 +18,7 @@ #include "../spells/CSpellHandler.h" #include "../mapObjects/CGTownInstance.h" #include "../BattleFieldHandler.h" +#include "../CModHandler.h" VCMI_LIB_NAMESPACE_BEGIN @@ -802,12 +803,18 @@ TDmgRange CBattleInfoCallback::calculateDmgRange(const BattleAttackInfo & info) //bonus from attack/defense skills if(attackDefenceDifference < 0) //decreasing dmg { - const double dec = std::min(0.025 * (-attackDefenceDifference), 0.7); + double defenseMultiplier = VLC->modh->settings.DEFENSE_POINT_DMG_MULTIPLIER; + double defenseMultiplierCap = VLC->modh->settings.DEFENSE_POINTS_DMG_MULTIPLIER_CAP; + + const double dec = std::min(defenseMultiplier * (-attackDefenceDifference), defenseMultiplierCap); multBonus *= 1.0 - dec; } else //increasing dmg { - const double inc = std::min(0.05 * attackDefenceDifference, 4.0); + double attackMultiplier = VLC->modh->settings.ATTACK_POINT_DMG_MULTIPLIER; + double attackMultiplierCap = VLC->modh->settings.ATTACK_POINTS_DMG_MULTIPLIER_CAP; + + const double inc = std::min(attackMultiplier * attackDefenceDifference, attackMultiplierCap); additiveBonus += inc; }