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

vcmi: remove SELF_MORALE bonus

It is easily handled by MORALE bonus with INDEPENDENT_MAX

Harmless due to converter.
This commit is contained in:
Konstantin 2023-03-09 12:25:03 +03:00
parent ebbc8cf208
commit c7e197e1ff
4 changed files with 19 additions and 14 deletions

View File

@ -261,7 +261,9 @@
{
"fearless" :
{
"type" : "SELF_MORALE"
"type" : "MORALE",
"val" : 1,
"valueType" : "INDEPENDENT_MAX"
}
},
"upgrades": ["minotaurKing"],
@ -287,7 +289,9 @@
{
"fearless" :
{
"type" : "SELF_MORALE"
"type" : "MORALE",
"val" : 1,
"valueType" : "INDEPENDENT_MAX"
}
},
"graphics" :

View File

@ -1080,7 +1080,10 @@ void CCreatureHandler::loadStackExp(Bonus & b, BonusList & bl, CLegacyConfigPars
case 'F':
b.type = Bonus::FLYING; break;
case 'm':
b.type = Bonus::SELF_MORALE; break;
b.type = Bonus::MORALE; break;
b.val = 1;
b.valType = Bonus::INDEPENDENT_MAX;
break;
case 'M':
b.type = Bonus::NO_MORALE; break;
case 'p': //Mind spells

View File

@ -113,6 +113,7 @@ const std::set<std::string> deprecatedBonusSet = {
"KING3",
"BLOCK_MORALE",
"BLOCK_LUCK",
"SELF_MORALE",
};
///CBonusProxy
@ -669,14 +670,12 @@ Selector::type()(Bonus::NON_LIVING)
CSelector IBonusBearer::moraleSelector = Selector::type()(Bonus::MORALE);
CSelector IBonusBearer::luckSelector = Selector::type()(Bonus::LUCK);
CSelector IBonusBearer::selfMoraleSelector = Selector::type()(Bonus::SELF_MORALE);
CSelector IBonusBearer::selfLuckSelector = Selector::type()(Bonus::SELF_LUCK);
IBonusBearer::IBonusBearer()
:anaffectedByMorale(this, anaffectedByMoraleSelector),
moraleValue(this, moraleSelector, 0),
luckValue(this, luckSelector, 0),
selfMorale(this, selfMoraleSelector),
selfLuck(this, selfLuckSelector)
{
}
@ -752,9 +751,6 @@ int IBonusBearer::MoraleVal() const
int ret = moraleValue.getValue();
if(selfMorale.getHasBonus()) //eg. minotaur
vstd::amax(ret, +1);
return vstd::abetween(ret, -3, +3);
}
@ -781,9 +777,6 @@ int IBonusBearer::MoraleValAndBonusList(TConstBonusListPtr & bonusList) const
}
int ret = moraleValue.getValueAndList(bonusList);
if(selfMorale.getHasBonus()) //eg. minotaur
vstd::amax(ret, +1);
return vstd::abetween(ret, -3, +3);
}
@ -1974,6 +1967,14 @@ BonusParams::BonusParams(std::string deprecatedTypeStr, std::string deprecatedSu
}
else if (deprecatedTypeStr == "SIGHT_RADIOUS")
type = Bonus::SIGHT_RADIUS;
else if (deprecatedTypeStr == "SELF_MORALE")
{
type = Bonus::MORALE;
val = 1;
valRelevant = true;
valueType = Bonus::INDEPENDENT_MAX;
valueTypeRelevant = true;
}
else
isConverted = false;
}

View File

@ -247,7 +247,6 @@ public:
BONUS_NAME(LIFE_DRAIN) \
BONUS_NAME(DOUBLE_DAMAGE_CHANCE) /*value in %, eg. dread knight*/ \
BONUS_NAME(RETURN_AFTER_STRIKE) \
BONUS_NAME(SELF_MORALE) /*eg. minotaur*/ \
BONUS_NAME(SPELLCASTER) /*subtype - spell id, value - level of school, additional info - weighted chance. use SPECIFIC_SPELL_POWER, CREATURE_SPELL_POWER or CREATURE_ENCHANT_POWER for calculating the power*/ \
BONUS_NAME(CATAPULT) \
BONUS_NAME(ENEMY_DEFENCE_REDUCTION) /*in % (value) eg. behemots*/ \
@ -710,8 +709,6 @@ private:
CTotalsProxy moraleValue;
static CSelector luckSelector;
CTotalsProxy luckValue;
static CSelector selfMoraleSelector;
CCheckProxy selfMorale;
static CSelector selfLuckSelector;
CCheckProxy selfLuck;