1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Support for Aura of Magic Resistance.

This commit is contained in:
DjWarmonger
2011-10-20 11:03:04 +00:00
parent 092dac1f63
commit bdb6db2ab7
5 changed files with 58 additions and 16 deletions

View File

@@ -606,16 +606,16 @@ std::string CStackInstance::bonusToString(Bonus *bonus, bool description) const
boost::algorithm::replace_first(text, "%d", boost::lexical_cast<std::string>(valOfBonuses(Selector::typeSubtype(bonus->type, bonus->subtype))));
break;
//Complex descriptions
case Bonus::SECONDARY_SKILL_PREMY: //only if there's no simple MR
if (bonus->subtype == CGHeroInstance::RESISTANCE)
{
if (!hasBonusOfType(Bonus::MAGIC_RESISTANCE))
boost::algorithm::replace_first(text, "%d", boost::lexical_cast<std::string>( magicResistance() ));
}
break;
case Bonus::MAGIC_RESISTANCE:
boost::algorithm::replace_first(text, "%d", boost::lexical_cast<std::string>( magicResistance() ));
break;
//case Bonus::SECONDARY_SKILL_PREMY: //only if there's no simple MR
// if (bonus->subtype == CGHeroInstance::RESISTANCE)
// {
// if (!hasBonusOfType(Bonus::MAGIC_RESISTANCE))
// boost::algorithm::replace_first(text, "%d", boost::lexical_cast<std::string>( magicResistance() ));
// }
// break;
//case Bonus::MAGIC_RESISTANCE:
// boost::algorithm::replace_first(text, "%d", boost::lexical_cast<std::string>( magicResistance() ));
// break;
case Bonus::HATE:
boost::algorithm::replace_first(text, "%d", boost::lexical_cast<std::string>(valOfBonuses(Selector::typeSubtype(bonus->type, bonus->subtype))));
boost::algorithm::replace_first(text, "%s", VLC->creh->creatures[bonus->subtype]->namePl);
@@ -658,10 +658,13 @@ std::string CStackInstance::bonusToString(Bonus *bonus, bool description) const
case Bonus::SPELL_IMMUNITY:
boost::algorithm::replace_first(text, "%s", VLC->spellh->spells[bonus->subtype]->name);
break;
case Bonus::SECONDARY_SKILL_PREMY:
if (bonus->subtype != CGHeroInstance::RESISTANCE || hasBonusOfType(Bonus::MAGIC_RESISTANCE)) //handle it there
text = "";
case Bonus::MAGIC_RESISTANCE:
text = ""; //handled separately
break;
//case Bonus::SECONDARY_SKILL_PREMY:
// if (bonus->subtype != CGHeroInstance::RESISTANCE || hasBonusOfType(Bonus::MAGIC_RESISTANCE)) //handle it there
// text = "";
// break;
}
}
return text;