mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
Added string identifiers to artifacts.
Some of them have lost some abilities, needs more work.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -749,20 +749,22 @@ void CArtHandler::makeItCommanderArt( TArtifactInstanceID aid, bool onlyCommande
|
|||||||
void CArtHandler::addBonuses()
|
void CArtHandler::addBonuses()
|
||||||
{
|
{
|
||||||
const JsonNode config(ResourceID("config/artifacts.json"));
|
const JsonNode config(ResourceID("config/artifacts.json"));
|
||||||
BOOST_FOREACH(const JsonNode &artifact, config["artifacts"].Vector())
|
BOOST_FOREACH (auto & artifact, config["artifacts"].Struct()) //pair <string, JsonNode> (id, properties)
|
||||||
{
|
{
|
||||||
auto ga = artifacts[artifact["id"].Float()].get();
|
auto ga = artifacts[artifact.second["id"].Float()].get();
|
||||||
|
|
||||||
BOOST_FOREACH (auto b, artifact["bonuses"].Vector())
|
BOOST_FOREACH (auto b, artifact.second["bonuses"].Vector())
|
||||||
{
|
{
|
||||||
auto bonus = JsonUtils::parseBonus (b);
|
auto bonus = JsonUtils::parseBonus (b);
|
||||||
bonus->sid = ga->id;
|
bonus->sid = ga->id;
|
||||||
ga->addNewBonus (bonus);
|
ga->addNewBonus (bonus);
|
||||||
}
|
}
|
||||||
if(artifact["type"].String() == "Creature")
|
if(artifact.second["type"].String() == "Creature")
|
||||||
makeItCreatureArt(ga->id);
|
makeItCreatureArt(ga->id);
|
||||||
else if(artifact["type"].String() == "Commander")
|
else if(artifact.second["type"].String() == "Commander")
|
||||||
makeItCommanderArt(ga->id);
|
makeItCommanderArt(ga->id);
|
||||||
|
|
||||||
|
VLC->modh->identifiers.registerObject ("artifact." + artifact.first, ga->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -905,7 +905,7 @@ const std::string & CGHeroInstance::getBiography() const
|
|||||||
return biography;
|
return biography;
|
||||||
return type->biography;
|
return type->biography;
|
||||||
}
|
}
|
||||||
void CGHeroInstance::initObj()
|
void CGHeroInstance::initObj() //TODO: use bonus system
|
||||||
{
|
{
|
||||||
blockVisit = true;
|
blockVisit = true;
|
||||||
speciality.growthsWithLevel = false;
|
speciality.growthsWithLevel = false;
|
||||||
@@ -929,7 +929,7 @@ void CGHeroInstance::initObj()
|
|||||||
const CCreature &specCreature = *VLC->creh->creatures[it->additionalinfo]; //creature in which we have specialty
|
const CCreature &specCreature = *VLC->creh->creatures[it->additionalinfo]; //creature in which we have specialty
|
||||||
|
|
||||||
int creLevel = specCreature.level;
|
int creLevel = specCreature.level;
|
||||||
if(!creLevel) //TODO: set fixed level for War Machines
|
if(!creLevel)
|
||||||
{
|
{
|
||||||
if(it->additionalinfo == 146)
|
if(it->additionalinfo == 146)
|
||||||
creLevel = 5; //treat ballista as 5-level
|
creLevel = 5; //treat ballista as 5-level
|
||||||
@@ -1094,7 +1094,7 @@ void CGHeroInstance::initObj()
|
|||||||
mana = manaLimit(); //after all bonuses are taken into account, make sure this line is the last one
|
mana = manaLimit(); //after all bonuses are taken into account, make sure this line is the last one
|
||||||
type->name = name;
|
type->name = name;
|
||||||
}
|
}
|
||||||
void CGHeroInstance::UpdateSpeciality()
|
void CGHeroInstance::UpdateSpeciality() //TODO: calculate special value of bonuses on-the-fly?
|
||||||
{
|
{
|
||||||
if (speciality.growthsWithLevel)
|
if (speciality.growthsWithLevel)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user