1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Merge pull request #3673 from Kris-Ja/develop

change MANA_PER_KNOWLEGDE to percentage
This commit is contained in:
DjWarmonger 2024-03-24 09:09:04 +01:00 committed by GitHub
commit 96c7e593bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 20 additions and 14 deletions

View File

@ -429,8 +429,8 @@
}, },
"manaPerKnowledge" : "manaPerKnowledge" :
{ {
"type" : "MANA_PER_KNOWLEDGE", //10 mana per knowledge "type" : "MANA_PER_KNOWLEDGE_PERCENTAGE", //1000% mana per knowledge
"val" : 10, "val" : 1000,
"valueType" : "BASE_NUMBER" "valueType" : "BASE_NUMBER"
}, },
"landMovement" : "landMovement" :

View File

@ -285,7 +285,7 @@
"bonuses" : { "bonuses" : {
"intelligence" : { "intelligence" : {
"targetSourceType" : "SECONDARY_SKILL", "targetSourceType" : "SECONDARY_SKILL",
"type" : "MANA_PER_KNOWLEDGE", "type" : "MANA_PER_KNOWLEDGE_PERCENTAGE",
"updater" : "TIMES_HERO_LEVEL", "updater" : "TIMES_HERO_LEVEL",
"val" : 5, "val" : 5,
"valueType" : "PERCENT_TO_TARGET_TYPE" "valueType" : "PERCENT_TO_TARGET_TYPE"

View File

@ -129,7 +129,7 @@
"bonuses" : { "bonuses" : {
"intelligence" : { "intelligence" : {
"targetSourceType" : "SECONDARY_SKILL", "targetSourceType" : "SECONDARY_SKILL",
"type" : "MANA_PER_KNOWLEDGE", "type" : "MANA_PER_KNOWLEDGE_PERCENTAGE",
"updater" : "TIMES_HERO_LEVEL", "updater" : "TIMES_HERO_LEVEL",
"val" : 5, "val" : 5,
"valueType" : "PERCENT_TO_TARGET_TYPE" "valueType" : "PERCENT_TO_TARGET_TYPE"

View File

@ -199,7 +199,7 @@
"bonuses" : { "bonuses" : {
"intelligence" : { "intelligence" : {
"targetSourceType" : "SECONDARY_SKILL", "targetSourceType" : "SECONDARY_SKILL",
"type" : "MANA_PER_KNOWLEDGE", "type" : "MANA_PER_KNOWLEDGE_PERCENTAGE",
"updater" : "TIMES_HERO_LEVEL", "updater" : "TIMES_HERO_LEVEL",
"val" : 5, "val" : 5,
"valueType" : "PERCENT_TO_TARGET_TYPE" "valueType" : "PERCENT_TO_TARGET_TYPE"

View File

@ -708,7 +708,7 @@
"base" : { "base" : {
"effects" : { "effects" : {
"main" : { "main" : {
"type" : "MANA_PER_KNOWLEDGE", "type" : "MANA_PER_KNOWLEDGE_PERCENTAGE",
"valueType" : "PERCENT_TO_BASE" "valueType" : "PERCENT_TO_BASE"
} }
} }

View File

@ -172,11 +172,11 @@ Defines percentage of enemy troops that will be raised after battle into own arm
- val: percentage of raised troops - val: percentage of raised troops
### MANA_PER_KNOWLEDGE ### MANA_PER_KNOWLEDGE_PERCENTAGE
Defines amount of mana points that hero gains per each point of knowledge (Intelligence) Defines percentage of mana points that hero gains per each point of knowledge (Intelligence)
- val: Amount of mana points per knowledge - val: percentage of mana points per knowledge
### HERO_GRANTS_ATTACKS ### HERO_GRANTS_ATTACKS

View File

@ -105,6 +105,11 @@ struct DLL_LINKAGE Bonus : public std::enable_shared_from_this<Bonus>
h & updater; h & updater;
h & propagationUpdater; h & propagationUpdater;
h & targetSourceType; h & targetSourceType;
if (h.version < Handler::Version::MANA_LIMIT && type == BonusType::MANA_PER_KNOWLEDGE_PERCENTAGE)
{
if (valType == BonusValueType::ADDITIVE_VALUE || valType == BonusValueType::BASE_NUMBER)
val *= 100;
}
} }
template <typename Ptr> template <typename Ptr>

View File

@ -162,7 +162,7 @@ class JsonNode;
BONUS_NAME(BEFORE_BATTLE_REPOSITION_BLOCK) /*skill-agnostic tactics, bonus for blocking opposite tactics. For now donble side tactics is TODO.*/\ BONUS_NAME(BEFORE_BATTLE_REPOSITION_BLOCK) /*skill-agnostic tactics, bonus for blocking opposite tactics. For now donble side tactics is TODO.*/\
BONUS_NAME(HERO_EXPERIENCE_GAIN_PERCENT) /*skill-agnostic learning, and we can use it as a global effect also*/\ BONUS_NAME(HERO_EXPERIENCE_GAIN_PERCENT) /*skill-agnostic learning, and we can use it as a global effect also*/\
BONUS_NAME(UNDEAD_RAISE_PERCENTAGE) /*Percentage of killed enemy creatures to be raised after battle as undead*/\ BONUS_NAME(UNDEAD_RAISE_PERCENTAGE) /*Percentage of killed enemy creatures to be raised after battle as undead*/\
BONUS_NAME(MANA_PER_KNOWLEDGE) /*Percentage rate of translating 10 hero knowledge to mana, used to intelligence and global bonus*/\ BONUS_NAME(MANA_PER_KNOWLEDGE_PERCENTAGE) /*Percentage rate of translating hero knowledge to 10 mana, used to intelligence and global bonus*/\
BONUS_NAME(HERO_GRANTS_ATTACKS) /*If hero can grant additional attacks to creature, value is number of attacks, subtype is creatureID*/\ BONUS_NAME(HERO_GRANTS_ATTACKS) /*If hero can grant additional attacks to creature, value is number of attacks, subtype is creatureID*/\
BONUS_NAME(BONUS_DAMAGE_PERCENTAGE) /*If hero can grant conditional damage to creature, value is percentage, subtype is creatureID*/\ BONUS_NAME(BONUS_DAMAGE_PERCENTAGE) /*If hero can grant conditional damage to creature, value is percentage, subtype is creatureID*/\
BONUS_NAME(BONUS_DAMAGE_CHANCE) /*If hero can grant additional damage to creature, value is chance, subtype is creatureID*/\ BONUS_NAME(BONUS_DAMAGE_CHANCE) /*If hero can grant additional damage to creature, value is chance, subtype is creatureID*/\

View File

@ -78,7 +78,7 @@ BonusParams::BonusParams(std::string deprecatedTypeStr, std::string deprecatedSu
type = BonusType::SIGHT_RADIUS; type = BonusType::SIGHT_RADIUS;
else if(deprecatedSubtype == SecondarySkill::INTELLIGENCE || deprecatedSubtypeStr == "skill.intelligence") else if(deprecatedSubtype == SecondarySkill::INTELLIGENCE || deprecatedSubtypeStr == "skill.intelligence")
{ {
type = BonusType::MANA_PER_KNOWLEDGE; type = BonusType::MANA_PER_KNOWLEDGE_PERCENTAGE;
valueType = BonusValueType::PERCENT_TO_BASE; valueType = BonusValueType::PERCENT_TO_BASE;
} }
else if(deprecatedSubtype == SecondarySkill::SORCERY || deprecatedSubtypeStr == "skill.sorcery") else if(deprecatedSubtype == SecondarySkill::SORCERY || deprecatedSubtypeStr == "skill.sorcery")

View File

@ -390,7 +390,7 @@ void CGHeroInstance::initHero(CRandomGenerator & rand)
// load base hero bonuses, TODO: per-map loading of base hero bonuses // load base hero bonuses, TODO: per-map loading of base hero bonuses
// must be done separately from global bonuses since recruitable heroes in taverns // must be done separately from global bonuses since recruitable heroes in taverns
// are not attached to global bonus node but need access to some global bonuses // are not attached to global bonus node but need access to some global bonuses
// e.g. MANA_PER_KNOWLEDGE for correct preview and initial state after recruit for(const auto & ob : VLC->modh->heroBaseBonuses) // e.g. MANA_PER_KNOWLEDGE_PERCENTAGE for correct preview and initial state after recruit for(const auto & ob : VLC->modh->heroBaseBonuses)
// or MOVEMENT to compute initial movement before recruiting is finished // or MOVEMENT to compute initial movement before recruiting is finished
const JsonNode & baseBonuses = VLC->settings()->getValue(EGameSettings::BONUSES_PER_HERO); const JsonNode & baseBonuses = VLC->settings()->getValue(EGameSettings::BONUSES_PER_HERO);
for(const auto & b : baseBonuses.Struct()) for(const auto & b : baseBonuses.Struct())
@ -1082,7 +1082,7 @@ std::string CGHeroInstance::nodeName() const
si32 CGHeroInstance::manaLimit() const si32 CGHeroInstance::manaLimit() const
{ {
return si32(getPrimSkillLevel(PrimarySkill::KNOWLEDGE) return si32(getPrimSkillLevel(PrimarySkill::KNOWLEDGE)
* (valOfBonuses(BonusType::MANA_PER_KNOWLEDGE))); * (valOfBonuses(BonusType::MANA_PER_KNOWLEDGE_PERCENTAGE))) / 100;
} }
HeroTypeID CGHeroInstance::getPortraitSource() const HeroTypeID CGHeroInstance::getPortraitSource() const

View File

@ -37,6 +37,7 @@ enum class ESerializationVersion : int32_t
DESTROYED_OBJECTS, // 834 +list of objects destroyed by player DESTROYED_OBJECTS, // 834 +list of objects destroyed by player
CAMPAIGN_MAP_TRANSLATIONS, // 835 +campaigns include translations for its maps CAMPAIGN_MAP_TRANSLATIONS, // 835 +campaigns include translations for its maps
JSON_FLAGS, // 836 json uses new format for flags JSON_FLAGS, // 836 json uses new format for flags
MANA_LIMIT, // 837 change MANA_PER_KNOWLEGDE to percentage
CURRENT = JSON_FLAGS CURRENT = MANA_LIMIT
}; };