mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-05 15:05:40 +02:00
Add "special" property for secondary skills
This commit is contained in:
parent
a4417f3fc5
commit
9e6cd9b94d
@ -94,5 +94,9 @@
|
|||||||
"onlyOnWaterMap" : {
|
"onlyOnWaterMap" : {
|
||||||
"type" : "boolean",
|
"type" : "boolean",
|
||||||
"description" : "It true, skill won't be available on a map without water"
|
"description" : "It true, skill won't be available on a map without water"
|
||||||
|
},
|
||||||
|
"special" : {
|
||||||
|
"type" : "boolean",
|
||||||
|
"description" : "If true, skill is not available on maps at random"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,15 @@
|
|||||||
|
|
||||||
## Main format
|
## Main format
|
||||||
|
|
||||||
|
```jsonc
|
||||||
|
{
|
||||||
|
// Skill be only be available on maps with water
|
||||||
|
"onlyOnWaterMap" : false,
|
||||||
|
// Skill is not available on maps at random
|
||||||
|
"special" : true
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
```jsonc
|
```jsonc
|
||||||
{
|
{
|
||||||
"skillName":
|
"skillName":
|
||||||
|
@ -32,7 +32,9 @@ CSkill::CSkill(const SecondarySkill & id, std::string identifier, bool obligator
|
|||||||
id(id),
|
id(id),
|
||||||
identifier(std::move(identifier)),
|
identifier(std::move(identifier)),
|
||||||
obligatoryMajor(obligatoryMajor),
|
obligatoryMajor(obligatoryMajor),
|
||||||
obligatoryMinor(obligatoryMinor)
|
obligatoryMinor(obligatoryMinor),
|
||||||
|
special(false),
|
||||||
|
onlyOnWaterMap(false)
|
||||||
{
|
{
|
||||||
gainChance[0] = gainChance[1] = 0; //affects CHeroClassHandler::afterLoadFinalization()
|
gainChance[0] = gainChance[1] = 0; //affects CHeroClassHandler::afterLoadFinalization()
|
||||||
levels.resize(NSecondarySkill::levels.size() - 1);
|
levels.resize(NSecondarySkill::levels.size() - 1);
|
||||||
@ -216,6 +218,7 @@ std::shared_ptr<CSkill> CSkillHandler::loadFromJson(const std::string & scope, c
|
|||||||
skill->modScope = scope;
|
skill->modScope = scope;
|
||||||
|
|
||||||
skill->onlyOnWaterMap = json["onlyOnWaterMap"].Bool();
|
skill->onlyOnWaterMap = json["onlyOnWaterMap"].Bool();
|
||||||
|
skill->special = json["special"].Bool();
|
||||||
|
|
||||||
VLC->generaltexth->registerString(scope, skill->getNameTextID(), json["name"]);
|
VLC->generaltexth->registerString(scope, skill->getNameTextID(), json["name"]);
|
||||||
switch(json["gainChance"].getType())
|
switch(json["gainChance"].getType())
|
||||||
@ -275,7 +278,8 @@ std::set<SecondarySkill> CSkillHandler::getDefaultAllowed() const
|
|||||||
std::set<SecondarySkill> result;
|
std::set<SecondarySkill> result;
|
||||||
|
|
||||||
for (auto const & skill : objects)
|
for (auto const & skill : objects)
|
||||||
result.insert(skill->getId());
|
if (!skill->special)
|
||||||
|
result.insert(skill->getId());
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ public:
|
|||||||
void serializeJson(JsonSerializeFormat & handler);
|
void serializeJson(JsonSerializeFormat & handler);
|
||||||
|
|
||||||
bool onlyOnWaterMap;
|
bool onlyOnWaterMap;
|
||||||
|
bool special;
|
||||||
|
|
||||||
friend class CSkillHandler;
|
friend class CSkillHandler;
|
||||||
friend DLL_LINKAGE std::ostream & operator<<(std::ostream & out, const CSkill & skill);
|
friend DLL_LINKAGE std::ostream & operator<<(std::ostream & out, const CSkill & skill);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user