Browse Source

Give custom descriptions to unclear H3 abilities and artifacts

Ivan Savenko 5 months ago
parent
commit
0945654672

+ 7 - 1
Mods/vcmi/Content/config/english.json

@@ -621,7 +621,13 @@
 	
 	"mapObject.core.hillFort.object.description" : "Upgrades creatures. Levels 1 - 4 are less expensive than in associated town.",
 	
-	"core.bonus.ADDITIONAL_ATTACK.description" : "{Additional attacks}\nUnit can attack an additional {$val} times", // TODO: alternative descriptions for effect range
+	"artifact.core.orbOfVulnerability.bonus.noResistance" : "{Orb of Vulnerability}\nNegates natural magic resistance of all creatures on the battlefield",
+	"creatures.core.angel.bonus.raisesMorale" : "{Increases allies morale}\nAngels and Archangels increase allies Morale by one",
+	"creatures.core.devil.bonus.descreaseLuck" : "{Reduces enemy luck}\nDevils and Archdevils reduce enemy luck by one",
+	"creatures.core.boneDragon.bonus.decreaseMorale" : "{Reduces enemy morale}\nBone Dragons and Ghost Dragons lower the morale of enemy units by one",
+	"creatures.core.marksman.bonus.extraAttack" : "{Shoots twice}\nThis unit can shoot twice",
+
+	"core.bonus.ADDITIONAL_ATTACK.description" : "{Additional attacks}\nUnit can attack an additional {$val} times", // TODO: alternative descriptions for melee/ranged effect range
 	"core.bonus.ADDITIONAL_RETALIATION.description" : "{Additional retaliations}\nUnit can retaliate ${val} extra times",
 	"core.bonus.ATTACKS_ALL_ADJACENT.description" : "{Attack all around}\nAttacks all adjacent enemies in addition to the primary target",
 	"core.bonus.BLOCKS_RANGED_RETALIATION.description" : "{No ranged retaliation}\nThe enemy cannot retaliate when shot by this unit",

+ 1 - 1
client/windows/CCreatureWindow.cpp

@@ -899,7 +899,7 @@ void CStackWindow::initBonusesList()
 
 		int valIndepMin = groupIndepMin.totalValue();
 		int valIndepMax = groupIndepMax.totalValue();
-		int valNoMinMax = group.totalValue();
+		int valNoMinMax = groupNoMinMax.totalValue();
 
 		BonusList usedGroup;
 

+ 2 - 0
config/artifacts.json

@@ -1382,6 +1382,7 @@
 			"noResistance" : {
 				"type" : "MAGIC_RESISTANCE",
 				"val" : 0,
+				"description" : "PLACEHOLDER",
 				"valueType" : "INDEPENDENT_MIN",
 				"propagator": "BATTLE_WIDE"
 			},
@@ -1389,6 +1390,7 @@
 				"type" : "SPELL_RESISTANCE_AURA",
 				"val" : 0,
 				"valueType" : "INDEPENDENT_MIN",
+				"description" : "@artifact.core.orbOfVulnerability.bonus.noResistance",
 				"propagator": "BATTLE_WIDE"
 			}
 		},

+ 3 - 0
config/creatures/castle.json

@@ -97,6 +97,7 @@
 			{
 				"type": "ADDITIONAL_ATTACK",
 				"val" : 1,
+				"description" : "PLACEHOLDER",
 				"effectRange": "ONLY_DISTANCE_FIGHT"
 			}
 		},
@@ -359,6 +360,7 @@
 				"type" : "MORALE",
 				"val" : 1,
 				"propagator" : "HERO",
+				"description" : "PLACEHOLDER",
 				"stacking" : "Angels"
 			},
 			"KING_2" : // Will be affected by Advanced Slayer or better
@@ -426,6 +428,7 @@
 				"type" : "MORALE",
 				"val" : 1,
 				"propagator" : "HERO",
+				"description" : "@creatures.core.angel.bonus.raisesMorale",
 				"stacking" : "Angels"
 			},
 			"KING_2" : // Will be affected by Advanced Slayer or better

+ 2 - 0
config/creatures/inferno.json

@@ -371,6 +371,7 @@
 				"stacking" : "Devils",
 				"propagator": "BATTLE_WIDE",
 				"propagationUpdater" : "BONUS_OWNER_UPDATER",
+				"description" : "PLACEHOLDER",
 				"limiters" : [ "OPPOSITE_SIDE" ]
 			},
 			"KING_2" : // Will be affected by Advanced Slayer or better
@@ -431,6 +432,7 @@
 				"stacking" : "Devils",
 				"propagator": "BATTLE_WIDE",
 				"propagationUpdater" : "BONUS_OWNER_UPDATER",
+				"description" : "@creatures.core.devil.bonus.descreaseLuck",
 				"limiters" : [ "OPPOSITE_SIDE" ]
 			},
 			"KING_2" : // Will be affected by Advanced Slayer or better

+ 2 - 0
config/creatures/necropolis.json

@@ -438,6 +438,7 @@
 				"stacking" : "Undead Dragons",
 				"propagator": "BATTLE_WIDE",
 				"propagationUpdater" : "BONUS_OWNER_UPDATER",
+				"description" : "PLACEHOLDER",
 				"limiters" : [ "OPPOSITE_SIDE" ]
 			},
 			"KING_1" : // Will be affected by Slayer with no expertise
@@ -493,6 +494,7 @@
 				"stacking" : "Undead Dragons",
 				"propagator": "BATTLE_WIDE",
 				"propagationUpdater" : "BONUS_OWNER_UPDATER",
+				"description" : "@creatures.core.boneDragon.bonus.decreaseMorale",
 				"limiters" : [ "OPPOSITE_SIDE" ]
 			},
 			"KING_1" : // Will be affected by Slayer with no expertise

+ 1 - 0
config/creatures/rampart.json

@@ -143,6 +143,7 @@
 			{
 				"type": "ADDITIONAL_ATTACK",
 				"val" : 1,
+				"description" : "@creatures.core.marksman.bonus.extraAttack",
 				"effectRange": "ONLY_DISTANCE_FIGHT"
 			}
 		},

+ 2 - 2
lib/entities/artifact/CArtHandler.cpp

@@ -195,7 +195,7 @@ std::shared_ptr<CArtifact> CArtHandler::loadFromJson(const std::string & scope,
 		{
 			if (b.second.isNull())
 				continue;
-			auto bonus = JsonUtils::parseBonus(b.second);
+			auto bonus = JsonUtils::parseBonus(b.second, art->getBonusTextID(b.first));
 			art->addNewBonus(bonus);
 		}
 	}
@@ -204,7 +204,7 @@ std::shared_ptr<CArtifact> CArtHandler::loadFromJson(const std::string & scope,
 	{
 		if (b.second.isNull())
 			continue;
-		auto bonus = JsonUtils::parseBonus(b.second);
+		auto bonus = JsonUtils::parseBonus(b.second, art->getBonusTextID(b.first));
 		bonus->source = BonusSource::ARTIFACT;
 		bonus->duration = BonusDuration::PERMANENT;
 		bonus->description.appendTextID(art->getNameTextID());

+ 5 - 0
lib/entities/artifact/CArtifact.cpp

@@ -145,6 +145,11 @@ std::string CArtifact::getNameTextID() const
 	return TextIdentifier("artifact", modScope, identifier, "name").get();
 }
 
+std::string CArtifact::getBonusTextID(const std::string & bonusID) const
+{
+	return TextIdentifier("artifact", modScope, identifier, "bonus", bonusID).get();
+}
+
 uint32_t CArtifact::getPrice() const
 {
 	return price;

+ 1 - 0
lib/entities/artifact/CArtifact.h

@@ -123,6 +123,7 @@ public:
 	std::string getDescriptionTextID() const override;
 	std::string getEventTextID() const override;
 	std::string getNameTextID() const override;
+	std::string getBonusTextID(const std::string & bonusID) const;
 
 	uint32_t getPrice() const override;
 	CreatureID getWarMachine() const override;

+ 1 - 1
lib/json/JsonBonus.cpp

@@ -697,7 +697,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b, const TextIdentifi
 		if (ability["description"].isString() && !ability["description"].String().empty())
 		{
 			if (ability["description"].String()[0] == '@')
-				b->description.appendTextID(ability["description"].String());
+				b->description.appendTextID(ability["description"].String().substr(1));
 			else if (!descriptionID.get().empty())
 			{
 				LIBRARY->generaltexth->registerString(ability.getModScope(), descriptionID, ability["description"]);