2
0
Эх сурвалжийг харах

Added string identifiers to artifacts.
Some of them have lost some abilities, needs more work.

DjWarmonger 13 жил өмнө
parent
commit
743a0fc3f4

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 133 - 1
config/artifacts.json


+ 7 - 5
lib/CArtHandler.cpp

@@ -749,20 +749,22 @@ void CArtHandler::makeItCommanderArt( TArtifactInstanceID aid, bool onlyCommande
 void CArtHandler::addBonuses()
 {
 	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);
 			bonus->sid = ga->id;
 			ga->addNewBonus (bonus);
 		}
-		if(artifact["type"].String() == "Creature")
+		if(artifact.second["type"].String() == "Creature")
 			makeItCreatureArt(ga->id);
-		else if(artifact["type"].String() == "Commander")
+		else if(artifact.second["type"].String() == "Commander")
 			makeItCommanderArt(ga->id);
+
+		VLC->modh->identifiers.registerObject ("artifact." + artifact.first, ga->id);
 	}
 }
 

+ 3 - 3
lib/CObjectHandler.cpp

@@ -905,7 +905,7 @@ const std::string & CGHeroInstance::getBiography() const
 		return biography;
 	return type->biography;
 }
-void CGHeroInstance::initObj()
+void CGHeroInstance::initObj() //TODO: use bonus system
 {
 	blockVisit = true;
 	speciality.growthsWithLevel = false;
@@ -929,7 +929,7 @@ void CGHeroInstance::initObj()
 					const CCreature &specCreature = *VLC->creh->creatures[it->additionalinfo]; //creature in which we have specialty
 
 					int creLevel = specCreature.level;
-					if(!creLevel) //TODO: set fixed level for War Machines
+					if(!creLevel)
 					{
 						if(it->additionalinfo == 146)
 							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
 	type->name = name;
 }
-void CGHeroInstance::UpdateSpeciality()
+void CGHeroInstance::UpdateSpeciality() //TODO: calculate special value of bonuses on-the-fly?
 {
 	if (speciality.growthsWithLevel)
 	{

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно