1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Give custom descriptions to unclear H3 abilities and artifacts

This commit is contained in:
Ivan Savenko
2025-05-23 20:03:00 +03:00
parent 6c5b2b8e63
commit 0945654672
11 changed files with 27 additions and 5 deletions

View File

@@ -621,7 +621,13 @@
"mapObject.core.hillFort.object.description" : "Upgrades creatures. Levels 1 - 4 are less expensive than in associated town.", "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.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.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", "core.bonus.BLOCKS_RANGED_RETALIATION.description" : "{No ranged retaliation}\nThe enemy cannot retaliate when shot by this unit",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -145,6 +145,11 @@ std::string CArtifact::getNameTextID() const
return TextIdentifier("artifact", modScope, identifier, "name").get(); 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 uint32_t CArtifact::getPrice() const
{ {
return price; return price;

View File

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

View File

@@ -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"].isString() && !ability["description"].String().empty())
{ {
if (ability["description"].String()[0] == '@') if (ability["description"].String()[0] == '@')
b->description.appendTextID(ability["description"].String()); b->description.appendTextID(ability["description"].String().substr(1));
else if (!descriptionID.get().empty()) else if (!descriptionID.get().empty())
{ {
LIBRARY->generaltexth->registerString(ability.getModScope(), descriptionID, ability["description"]); LIBRARY->generaltexth->registerString(ability.getModScope(), descriptionID, ability["description"]);