1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-03 13:01:33 +02:00

* support for cursed ground

This commit is contained in:
mateuszb 2009-07-22 09:31:20 +00:00
parent 1c2edcf496
commit 17064478fa
3 changed files with 34 additions and 4 deletions

View File

@ -570,7 +570,7 @@ si8 CStack::Morale() const
{
si8 ret = morale;
if(hasFeatureOfType(StackFeature::NON_LIVING) || hasFeatureOfType(StackFeature::UNDEAD))
if(hasFeatureOfType(StackFeature::NON_LIVING) || hasFeatureOfType(StackFeature::UNDEAD) || hasFeatureOfType(StackFeature::NO_MORALE))
return 0;
ret += valOfFeatures(StackFeature::MORALE_BONUS); //mirth & sorrow & other
@ -588,6 +588,9 @@ si8 CStack::Morale() const
si8 CStack::Luck() const
{
si8 ret = luck;
if(hasFeatureOfType(StackFeature::NO_LUCK))
return 0;
ret += valOfFeatures(StackFeature::LUCK_BONUS); //fortune & misfortune & other
@ -1374,7 +1377,7 @@ int CGameState::battleGetBattlefieldType(int3 tile)
{
case 222: //clover field
return 19;
case 223: //cursed ground
case 21: case 223: //cursed ground
return 22;
case 224: //evil fog
return 20;
@ -1388,7 +1391,7 @@ int CGameState::battleGetBattlefieldType(int3 tile)
return 17;
case 229: //magic clouds
return 16;
case 230: //magic plains
case 46: case 230: //magic plains
return 9;
case 231: //rocklands
return 15;

View File

@ -78,7 +78,9 @@ struct StackFeature
VCMI_CREATURE_ABILITY_NAME(SLAYER) /*value - level*/ \
VCMI_CREATURE_ABILITY_NAME(FORGETFULL) /*forgetfullnes spell effect, value - level*/ \
VCMI_CREATURE_ABILITY_NAME(CLONED) \
VCMI_CREATURE_ABILITY_NAME(NOT_ACTIVE)
VCMI_CREATURE_ABILITY_NAME(NOT_ACTIVE) \
VCMI_CREATURE_ABILITY_NAME(NO_LUCK) /*eg. when fighting on cursed ground*/ \
VCMI_CREATURE_ABILITY_NAME(NO_MORALE) /*eg. when fighting on cursed ground*/
//general list of stack abilities and effects
enum ECombatFeatures

View File

@ -1148,6 +1148,31 @@ void CGameHandler::setupBattle( BattleInfo * curB, int3 tile, const CCreatureSet
stacks[g]->features.push_back(makeFeature(StackFeature::MORALE_BONUS, StackFeature::WHOLE_BATTLE, 0, 1, StackFeature::OTHER_SOURCE));
}
}
break;
}
case 22: //cursed ground
{
for(int g=0; g<stacks.size(); ++g) //no luck nor morale
{
stacks[g]->features.push_back(makeFeature(StackFeature::NO_MORALE, StackFeature::WHOLE_BATTLE, 0, 0, StackFeature::OTHER_SOURCE));
stacks[g]->features.push_back(makeFeature(StackFeature::NO_LUCK, StackFeature::WHOLE_BATTLE, 0, 0, StackFeature::OTHER_SOURCE));
}
const CGHeroInstance * cHero = NULL;
for(int i=0; i<2; ++i) //blocking spells above level 1
{
if(i == 0) cHero = hero1;
else cHero = hero2;
if(cHero == NULL) continue;
GiveBonus gs;
gs.bonus = HeroBonus(HeroBonus::ONE_BATTLE, HeroBonus::BLOCK_SPELLS_ABOVE_LEVEL, HeroBonus::OBJECT, 1, -1, "", bonusSubtype);
gs.hid = cHero->id;
sendAndApply(&gs);
}
break;
}
}