1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

hero specialty fixes continuation: changes requested during code review

This commit is contained in:
MikeLodz 2021-02-13 16:02:42 +01:00
parent 38efbb345e
commit fe9412f845
2 changed files with 6 additions and 5 deletions

View File

@ -281,8 +281,6 @@ public:
BONUS_NAME(SPECIAL_BLESS_DAMAGE) /*val = spell (bless), additionalInfo = value per level in percent*/\
BONUS_NAME(MAXED_SPELL) /*val = id*/\
BONUS_NAME(SPECIAL_PECULIAR_ENCHANT) /*blesses and curses with id = val dependent on unit's level, subtype = 0 or 1 for Coronius*/\
BONUS_NAME(SPECIAL_ADD_VALUE_ENCHANT) /*specialty like Aenin, additionalInfo = value to add*/\
BONUS_NAME(SPECIAL_FIXED_VALUE_ENCHANT) /*specialty like Melody constant 3 luck, additionalInfo = value to fix.*/\
BONUS_NAME(SPECIAL_UPGRADE) /*subtype = base, additionalInfo = target */\
BONUS_NAME(DRAGON_NATURE) \
BONUS_NAME(CREATURE_DAMAGE)/*subtype 0 = both, 1 = min, 2 = max*/\
@ -323,6 +321,8 @@ public:
BONUS_NAME(SPECIAL_CRYSTAL_GENERATION) /*crystal dragon crystal generation*/ \
BONUS_NAME(NO_SPELLCAST_BY_DEFAULT) /*spellcast will not be default attack option for this creature*/ \
BONUS_NAME(GARGOYLE) /* gargoyle is special than NON_LIVING, cannot be rised or healed */ \
BONUS_NAME(SPECIAL_ADD_VALUE_ENCHANT) /*specialty spell like Aenin has, increased effect of spell, additionalInfo = value to add*/\
BONUS_NAME(SPECIAL_FIXED_VALUE_ENCHANT) /*specialty spell like Melody has, constant spell effect (i.e. 3 luck), additionalInfo = value to fix.*/\
/* end of list */

View File

@ -213,7 +213,8 @@ void Timed::prepareEffects(SetStackEffect & sse, const Mechanics * m, const Effe
power = std::max(5 - tier, 0);
break;
}
if(m->isNegativeSpell()) {
if(m->isNegativeSpell())
{
//negative spells like weakness are defined in json with negative numbers, so we need do same here
power = -1 * power;
}
@ -222,14 +223,14 @@ void Timed::prepareEffects(SetStackEffect & sse, const Mechanics * m, const Effe
b.val += power;
}
}
else if(addedValueBonus)
if(addedValueBonus)
{
for(Bonus& b : buffer)
{
b.val += addedValueBonus->additionalInfo[0];
}
}
else if(fixedValueBonus)
if(fixedValueBonus)
{
for(Bonus& b : buffer)
{