1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-05 13:04:54 +02:00

Merge pull request #5137 from Laserlicht/bonus

[1.6.1] Bonus display
This commit is contained in:
Ivan Savenko 2024-12-24 15:51:02 +02:00 committed by GitHub
commit d58202d2a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 58 additions and 3 deletions

View File

@ -607,6 +607,11 @@
"mapObject.core.hillFort.object.description" : "Upgrades creatures. Levels 1 - 4 are less expensive than in associated town.",
"core.spellSchools.0": "Air",
"core.spellSchools.1": "Fire",
"core.spellSchools.2": "Water",
"core.spellSchools.3": "Earth",
"core.bonus.ADDITIONAL_ATTACK.name": "Double Strike",
"core.bonus.ADDITIONAL_ATTACK.description": "Attacks twice",
"core.bonus.ADDITIONAL_RETALIATION.name": "Additional retaliations",
@ -762,5 +767,11 @@
"core.bonus.MECHANICAL.name": "Mechanical",
"core.bonus.MECHANICAL.description": "Immunity to many effects, repairable",
"core.bonus.PRISM_HEX_ATTACK_BREATH.name": "Prism Breath",
"core.bonus.PRISM_HEX_ATTACK_BREATH.description": "Prism Breath Attack (three directions)"
"core.bonus.PRISM_HEX_ATTACK_BREATH.description": "Prism Breath Attack (three directions)",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name": "Spell immunity",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description": "Immune to all spell schools",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name.specific": "${subtype.spellSchool} immunity",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description.specific": "Immune to ${subtype.spellSchool} school",
"core.bonus.OPENING_BATTLE_SPELL.name": "Starts with spell",
"core.bonus.OPENING_BATTLE_SPELL.description": "Casts ${subtype.spell} on battle start"
}

View File

@ -607,6 +607,11 @@
"mapObject.core.hillFort.object.description" : "Aufwertungen von Kreaturen. Die Stufen 1 - 4 sind billiger als in der zugehörigen Stadt.",
"core.spellSchools.0": "Luft",
"core.spellSchools.1": "Feuer",
"core.spellSchools.2": "Wasser",
"core.spellSchools.3": "Erde",
"core.bonus.ADDITIONAL_ATTACK.name": "Doppelschlag",
"core.bonus.ADDITIONAL_ATTACK.description": "Greift zweimal an",
"core.bonus.ADDITIONAL_RETALIATION.name": "Zusätzliche Vergeltungsmaßnahmen",
@ -678,7 +683,7 @@
"core.bonus.JOUSTING.name": "Champion Charge",
"core.bonus.JOUSTING.description": "+${val}% Schaden pro zurückgelegtem Feld",
"core.bonus.KING.name": "König",
"core.bonus.KING.description": "Anfällig für SLAYER Level ${val} oder höher",
"core.bonus.KING.description": "Anfällig für Drachentöter Level ${val} oder höher",
"core.bonus.LEVEL_SPELL_IMMUNITY.name": "Zauberimmunität 1-${val}",
"core.bonus.LEVEL_SPELL_IMMUNITY.description": "Immun gegen Zaubersprüche der Stufen 1-${val}",
"core.bonus.LIMITED_SHOOTING_RANGE.name" : "Begrenzte Schussweite",
@ -762,5 +767,11 @@
"core.bonus.MECHANICAL.name": "Mechanisch",
"core.bonus.MECHANICAL.description": "Immunität gegen viele Effekte, reparierbar",
"core.bonus.PRISM_HEX_ATTACK_BREATH.name": "Prisma-Atem",
"core.bonus.PRISM_HEX_ATTACK_BREATH.description": "Prisma-Atem-Angriff (drei Richtungen)"
"core.bonus.PRISM_HEX_ATTACK_BREATH.description": "Prisma-Atem-Angriff (drei Richtungen)",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name": "Zauber-Immunität",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description": "Immunität gegen alle Zauber-Schulen",
"core.bonus.SPELL_SCHOOL_IMMUNITY.name.specific": "${subtype.spellSchool}-Immunität",
"core.bonus.SPELL_SCHOOL_IMMUNITY.description.specific": "Immunität gegen Zauber der ${subtype.spellSchool}-Schule",
"core.bonus.OPENING_BATTLE_SPELL.name": "Startet mit Zauber",
"core.bonus.OPENING_BATTLE_SPELL.description": "Wirkt ${subtype.spell} beim Start des Kampfes"
}

View File

@ -39,6 +39,7 @@
#include "../../lib/networkPacks/ArtifactLocation.h"
#include "../../lib/texts/CGeneralTextHandler.h"
#include "../../lib/texts/TextOperations.h"
#include "../../lib/bonuses/Propagators.h"
class CCreatureArtifactInstance;
class CSelectableSkill;
@ -856,6 +857,9 @@ void CStackWindow::initBonusesList()
bonusInfo.imagePath = info->stackNode->bonusToGraphics(b);
bonusInfo.bonusSource = b->source;
if(b->sid.getNum() != info->stackNode->getId() && b->propagator && b->propagator->getPropagatorType() == CBonusSystemNode::HERO) // Shows bonus with "propagator":"HERO" only at creature with bonus
continue;
//if it's possible to give any description or image for this kind of bonus
//TODO: figure out why half of bonuses don't have proper description
if(!bonusInfo.name.empty() || !bonusInfo.imagePath.empty())

View File

@ -407,6 +407,14 @@
}
},
"OPENING_BATTLE_SPELL":
{
"graphics":
{
"icon": "zvs/Lib1.res/E_SPDFIRE"
}
},
"RANDOM_SPELLCASTER":
{
"graphics":
@ -532,6 +540,10 @@
}
},
"SPELL_SCHOOL_IMMUNITY":
{
},
"SPELL_RESISTANCE_AURA":
{
"graphics":

View File

@ -75,6 +75,23 @@ std::string CBonusTypeHandler::bonusToString(const std::shared_ptr<Bonus> & bonu
std::string textID = description ? bt.getDescriptionTextID() : bt.getNameTextID();
std::string text = VLC->generaltexth->translate(textID);
if (bonus->subtype.as<SpellSchool>().hasValue())
{
auto school = bonus->subtype.as<SpellSchool>();
if(school != SpellSchool::ANY)
{
auto specificTextID = description ? bt.getDescriptionTextID() + ".specific" : bt.getNameTextID() + ".specific";
auto specificText = VLC->generaltexth->translate(specificTextID);
if(specificText.find("${subtype.spellSchool}") != std::string::npos)
{
auto schoolName = VLC->generaltexth->translate(TextIdentifier("core.spellSchools", school).get());
boost::algorithm::replace_all(specificText, "${subtype.spellSchool}", schoolName);
text = specificText;
}
}
}
if (text.find("${val}") != std::string::npos)
boost::algorithm::replace_all(text, "${val}", std::to_string(bearer->valOfBonuses(Selector::typeSubtype(bonus->type, bonus->subtype))));