1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

vcmi: convert intelligence

Intelligence is converted to both global effect and skill bonus

Bonus name HERO_MANA_PER_TEN_KNOWLEDGE is a little weird, but works
like old SECONDARY_SKILL_PREMY bonus
This commit is contained in:
Konstantin 2023-02-20 00:09:06 +03:00
parent a86e12cd42
commit a0987313ba
11 changed files with 33 additions and 16 deletions

View File

@ -61,6 +61,11 @@ int64_t CHeroWithMaybePickedArtifact::getTreeVersion() const
return hero->getTreeVersion(); //this assumes that hero and artifact belongs to main bonus tree
}
si32 CHeroWithMaybePickedArtifact::manaLimit() const
{
return hero->manaLimit();
}
CHeroWithMaybePickedArtifact::CHeroWithMaybePickedArtifact(CWindowWithArtifacts * Cww, const CGHeroInstance * Hero)
: hero(Hero), cww(Cww)
{

View File

@ -55,6 +55,8 @@ public:
TConstBonusListPtr getAllBonuses(const CSelector & selector, const CSelector & limit, const CBonusSystemNode * root = nullptr, const std::string & cachingStr = "") const override;
int64_t getTreeVersion() const override;
si32 manaLimit() const override;
};
class CHeroWindow : public CStatusbarWindow, public CGarrisonHolder, public CWindowWithArtifacts

View File

@ -68,6 +68,11 @@
"type" : "HERO_EXPERIENCE_GAIN_PERCENT", //default hero xp
"val" : 100,
"valueType" : "BASE_NUMBER"
},
{
"type" : "MANA_PER_KNOWLEDGE", //10 knowledge to 100 mana is default
"val" : 10,
"valueType" : "BASE_NUMBER"
}
]
}

View File

@ -281,11 +281,11 @@
"specialty" : {
"bonuses" : {
"intelligence" : {
"subtype" : "skill.intelligence",
"type" : "SECONDARY_SKILL_PREMY",
"targetSourceType" : "SECONDARY_SKILL",
"type" : "MANA_PER_KNOWLEDGE",
"updater" : "TIMES_HERO_LEVEL",
"val" : 5,
"valueType" : "PERCENT_TO_BASE"
"valueType" : "PERCENT_TO_TARGET_TYPE"
}
}
}

View File

@ -128,11 +128,11 @@
"specialty" : {
"bonuses" : {
"intelligence" : {
"subtype" : "skill.intelligence",
"type" : "SECONDARY_SKILL_PREMY",
"targetSourceType" : "SECONDARY_SKILL",
"type" : "MANA_PER_KNOWLEDGE",
"updater" : "TIMES_HERO_LEVEL",
"val" : 5,
"valueType" : "PERCENT_TO_BASE"
"valueType" : "PERCENT_TO_TARGET_TYPE"
}
}
}

View File

@ -197,11 +197,11 @@
"specialty" : {
"bonuses" : {
"intelligence" : {
"subtype" : "skill.intelligence",
"type" : "SECONDARY_SKILL_PREMY",
"targetSourceType" : "SECONDARY_SKILL",
"type" : "MANA_PER_KNOWLEDGE",
"updater" : "TIMES_HERO_LEVEL",
"val" : 5,
"valueType" : "PERCENT_TO_BASE"
"valueType" : "PERCENT_TO_TARGET_TYPE"
}
}
}

View File

@ -708,9 +708,8 @@
"base" : {
"effects" : {
"main" : {
"subtype" : "skill.intelligence",
"type" : "SECONDARY_SKILL_PREMY",
"valueType" : "BASE_NUMBER"
"type" : "MANA_PER_KNOWLEDGE",
"valueType" : "PERCENT_TO_BASE"
}
}
},

View File

@ -834,9 +834,7 @@ int IBonusBearer::getMaxDamage(bool ranged) const
si32 IBonusBearer::manaLimit() const
{
return si32(getPrimSkillLevel(PrimarySkill::KNOWLEDGE)
* (100.0 + valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::INTELLIGENCE))
/ 10.0);
return 0;
}
int IBonusBearer::getPrimSkillLevel(PrimarySkill::PrimarySkill id) const

View File

@ -342,6 +342,7 @@ public:
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(UNDEAD_RAISE_PERCENTAGE) /*Percentage of killed enemy creatures to be raised after battle as undead*/\
BONUS_NAME(MANA_PER_KNOWLEDGE) /*Rate of translating hero knowledge to mana, used for intelligence and as a global bonus*/\
/* end of list */
@ -743,7 +744,7 @@ public:
virtual si32 magicResistance() const;
ui32 Speed(int turn = 0, bool useBind = false) const; //get speed of creature with all modificators
si32 manaLimit() const; //maximum mana value for this hero (basically 10*knowledge)
virtual si32 manaLimit() const; //maximum mana value for this hero (basically 10*knowledge)
int getPrimSkillLevel(PrimarySkill::PrimarySkill id) const;
virtual int64_t getTreeVersion() const = 0;

View File

@ -988,6 +988,12 @@ std::string CGHeroInstance::nodeName() const
return "Hero " + getNameTextID();
}
si32 CGHeroInstance::manaLimit() const
{
return si32(getPrimSkillLevel(PrimarySkill::KNOWLEDGE)
* (valOfBonuses(Bonus::MANA_PER_KNOWLEDGE)));
}
std::string CGHeroInstance::getNameTranslated() const
{
if (!nameCustom.empty())

View File

@ -256,6 +256,7 @@ public:
///IBonusBearer
CBonusSystemNode & whereShouldBeAttached(CGameState * gs) override;
std::string nodeName() const override;
si32 manaLimit() const override;
CBonusSystemNode * whereShouldBeAttachedOnSiege(const bool isBattleOutsideTown) const;
CBonusSystemNode * whereShouldBeAttachedOnSiege(CGameState * gs);