mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
vcmi: skill-agnostic resistance
Uses exiting bonus and new PERCENT_TO_TARGET_TYPE value type
This commit is contained in:
parent
6e4372176a
commit
34a26580a7
@ -226,8 +226,8 @@
|
||||
"core.bonus.MANA_DRAIN.description": "Drains ${val} mana every turn",
|
||||
"core.bonus.MAGIC_MIRROR.name": "Magic Mirror (${val}%)",
|
||||
"core.bonus.MAGIC_MIRROR.description": "${val}% chance to redirects an offensive spell to enemy",
|
||||
"core.bonus.MAGIC_RESISTANCE.name": "Magic Resistance(${MR}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description": "${MR}% chance to resist enemy spell",
|
||||
"core.bonus.MAGIC_RESISTANCE.name": "Magic Resistance(${val}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description": "${val}% chance to resist enemy spell",
|
||||
"core.bonus.MIND_IMMUNITY.name": "Mind Spell Immunity",
|
||||
"core.bonus.MIND_IMMUNITY.description": "Immune to Mind-type spells",
|
||||
"core.bonus.NO_DISTANCE_PENALTY.name": "No distance penalty",
|
||||
|
@ -228,8 +228,8 @@
|
||||
"core.bonus.MANA_DRAIN.description": "Entzieht ${val} Mana jede Runde",
|
||||
"core.bonus.MAGIC_MIRROR.name": "Zauberspiegel (${val}%)",
|
||||
"core.bonus.MAGIC_MIRROR.description": "${val}% Chance, einen Angriffszauber auf den Gegner umzulenken",
|
||||
"core.bonus.MAGIC_RESISTANCE.name": "Magie-Widerstand(${MR}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description": "${MR}% Chance, gegnerischem Zauber zu widerstehen",
|
||||
"core.bonus.MAGIC_RESISTANCE.name": "Magie-Widerstand(${val}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description": "${val}% Chance, gegnerischem Zauber zu widerstehen",
|
||||
"core.bonus.MIND_IMMUNITY.name": "Geist-Zauber-Immunität",
|
||||
"core.bonus.MIND_IMMUNITY.description": "Immun gegen Zauber vom Typ Geist",
|
||||
"core.bonus.NO_DISTANCE_PENALTY.name": "Keine Entfernungsstrafe",
|
||||
|
@ -158,8 +158,8 @@
|
||||
"core.bonus.MANA_DRAIN.description": "Wysysa ${val} many każdej tury",
|
||||
"core.bonus.MAGIC_MIRROR.name": "Magiczne Zwierciadło (${val}%)",
|
||||
"core.bonus.MAGIC_MIRROR.description": "${val}% szans na odbicie ofensywnego czaru do wroga",
|
||||
"core.bonus.MAGIC_RESISTANCE.name": "Odporność na Magię(${MR}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description": "${MR}% szans na przeciwstawienie się wrogiemu czarowi",
|
||||
"core.bonus.MAGIC_RESISTANCE.name": "Odporność na Magię(${val}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description": "${val}% szans na przeciwstawienie się wrogiemu czarowi",
|
||||
"core.bonus.MIND_IMMUNITY.name": "Odporność na czasy umysłu",
|
||||
"core.bonus.MIND_IMMUNITY.description": "Odporny na czary typu umysłu",
|
||||
"core.bonus.NO_DISTANCE_PENALTY.name": "Brak ograniczeń za odległość",
|
||||
|
@ -239,8 +239,8 @@
|
||||
"core.bonus.MANA_DRAIN.description": "Высасывает ${val} маны каждый ход",
|
||||
"core.bonus.MAGIC_MIRROR.name": "Волшебное зеркало (${val}%)",
|
||||
"core.bonus.MAGIC_MIRROR.description": "Шанс ${val}% отразить атакующие заклинание в противника",
|
||||
"core.bonus.MAGIC_RESISTANCE.name": "Защита от магии (${MR}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description": "Шанс ${MR}% полностью проигнорировать заклинание",
|
||||
"core.bonus.MAGIC_RESISTANCE.name": "Защита от магии (${val}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description": "Шанс ${val}% полностью проигнорировать заклинание",
|
||||
"core.bonus.MIND_IMMUNITY.name": "Железная воля",
|
||||
"core.bonus.MIND_IMMUNITY.description": "Иммунитет к заклинаниям, влияющим на разум",
|
||||
"core.bonus.NO_DISTANCE_PENALTY.name": "Игнорирует расстояние",
|
||||
|
@ -212,8 +212,8 @@
|
||||
"core.bonus.MANA_DRAIN.description" : "Викрадає ${val} мани кожного ходу",
|
||||
"core.bonus.MAGIC_MIRROR.name" : "Магічне дзеркало (${val}%)",
|
||||
"core.bonus.MAGIC_MIRROR.description" : "Відбиває ворожі заклинання до випадкової істоти ворога з силою в ${val}%",
|
||||
"core.bonus.MAGIC_RESISTANCE.name" : "Опір магії (${MR}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description" : "${MR}% шанс протистояти ворожим закляттям",
|
||||
"core.bonus.MAGIC_RESISTANCE.name" : "Опір магії (${val}%)",
|
||||
"core.bonus.MAGIC_RESISTANCE.description" : "${val}% шанс протистояти ворожим закляттям",
|
||||
"core.bonus.MIND_IMMUNITY.name" : "Імунітет до заклять розуму",
|
||||
"core.bonus.MIND_IMMUNITY.description" : "Імунітет до заклять типу ",
|
||||
"core.bonus.NO_DISTANCE_PENALTY.name" : "Немає штрафу за відстань",
|
||||
|
@ -768,26 +768,9 @@ void CStackWindow::initBonusesList()
|
||||
|
||||
//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(b->type == Bonus::MAGIC_RESISTANCE || (b->type == Bonus::SECONDARY_SKILL_PREMY && b->subtype == SecondarySkill::RESISTANCE))
|
||||
continue;
|
||||
if(!bonusInfo.name.empty() || !bonusInfo.imagePath.empty())
|
||||
activeBonuses.push_back(bonusInfo);
|
||||
}
|
||||
|
||||
//handle Magic resistance separately :/
|
||||
int magicResistance = info->stackNode->magicResistance();//both MAGIC_RESITANCE and SECONDARY_SKILL_PREMY as one entry
|
||||
|
||||
if(magicResistance)
|
||||
{
|
||||
BonusInfo bonusInfo;
|
||||
auto b = std::make_shared<Bonus>();
|
||||
b->type = Bonus::MAGIC_RESISTANCE;
|
||||
|
||||
bonusInfo.name = VLC->getBth()->bonusToString(b, info->stackNode, false);
|
||||
bonusInfo.description = VLC->getBth()->bonusToString(b, info->stackNode, true);
|
||||
bonusInfo.imagePath = info->stackNode->bonusToGraphics(b);
|
||||
activeBonuses.push_back(bonusInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void CStackWindow::initSections()
|
||||
|
@ -81,11 +81,11 @@
|
||||
"specialty" : {
|
||||
"bonuses" : {
|
||||
"resistance" : {
|
||||
"subtype" : "skill.resistance",
|
||||
"type" : "SECONDARY_SKILL_PREMY",
|
||||
"type" : "MAGIC_RESISTANCE",
|
||||
"targetSourceType" : "SECONDARY_SKILL",
|
||||
"updater" : "TIMES_HERO_LEVEL",
|
||||
"val" : 5,
|
||||
"valueType" : "PERCENT_TO_BASE"
|
||||
"valueType" : "PERCENT_TO_TARGET_TYPE"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -752,8 +752,7 @@
|
||||
"base" : {
|
||||
"effects" : {
|
||||
"main" : {
|
||||
"subtype" : "skill.resistance",
|
||||
"type" : "SECONDARY_SKILL_PREMY",
|
||||
"type" : "MAGIC_RESISTANCE",
|
||||
"valueType" : "BASE_NUMBER"
|
||||
}
|
||||
}
|
||||
|
@ -82,9 +82,6 @@ std::string CBonusTypeHandler::bonusToString(const std::shared_ptr<Bonus> & bonu
|
||||
if (text.find("${subtype.spell}") != std::string::npos)
|
||||
boost::algorithm::replace_all(text, "${subtype.spell}", SpellID(bonus->subtype).toSpell()->getNameTranslated());
|
||||
|
||||
if (text.find("${MR}") != std::string::npos)
|
||||
boost::algorithm::replace_all(text, "${MR}", std::to_string(bearer->magicResistance()));
|
||||
|
||||
if (text.find("${SHval}") != std::string::npos) //regeneration case
|
||||
boost::algorithm::replace_all(text, "${SHval}", std::to_string(std::min(static_cast<si32>(bearer->MaxHealth()),bearer->valOfBonuses(Selector::typeSubtype(bonus->type, bonus->subtype)))));
|
||||
|
||||
@ -98,12 +95,6 @@ std::string CBonusTypeHandler::bonusToGraphics(const std::shared_ptr<Bonus> & bo
|
||||
|
||||
switch(bonus->type)
|
||||
{
|
||||
case Bonus::SECONDARY_SKILL_PREMY:
|
||||
if(bonus->subtype == SecondarySkill::RESISTANCE)
|
||||
{
|
||||
fileName = "E_DWARF.bmp";
|
||||
}
|
||||
break;
|
||||
case Bonus::SPELL_IMMUNITY:
|
||||
{
|
||||
fullPath = true;
|
||||
|
@ -745,11 +745,6 @@ int CStackInstance::getLevel() const
|
||||
si32 CStackInstance::magicResistance() const
|
||||
{
|
||||
si32 val = valOfBonuses(Selector::type()(Bonus::MAGIC_RESISTANCE));
|
||||
if (const CGHeroInstance * hero = dynamic_cast<const CGHeroInstance *>(_armyObj))
|
||||
{
|
||||
//resistance skill
|
||||
val += hero->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::RESISTANCE);
|
||||
}
|
||||
vstd::amin (val, 100);
|
||||
return val;
|
||||
}
|
||||
@ -792,15 +787,7 @@ void CStackInstance::setType(const CCreature *c)
|
||||
}
|
||||
std::string CStackInstance::bonusToString(const std::shared_ptr<Bonus>& bonus, bool description) const
|
||||
{
|
||||
if(Bonus::MAGIC_RESISTANCE == bonus->type)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
return VLC->getBth()->bonusToString(bonus, this, description);
|
||||
}
|
||||
|
||||
return VLC->getBth()->bonusToString(bonus, this, description);
|
||||
}
|
||||
|
||||
std::string CStackInstance::bonusToGraphics(const std::shared_ptr<Bonus>& bonus) const
|
||||
|
Loading…
Reference in New Issue
Block a user