mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-14 02:33:51 +02:00
* support for HP regeneration
* minor fixes
This commit is contained in:
parent
66dd31fd8a
commit
ef8f2e695f
@ -563,7 +563,8 @@ bool CCallback::battleCanShoot(int ID, int dest)
|
|||||||
if(our->hasFeatureOfType(StackFeature::SHOOTER)//it's shooter
|
if(our->hasFeatureOfType(StackFeature::SHOOTER)//it's shooter
|
||||||
&& our->owner != dst->owner
|
&& our->owner != dst->owner
|
||||||
&& dst->alive()
|
&& dst->alive()
|
||||||
&& (!gs->curB->isStackBlocked(ID) || gs->getHero(ourHero)->hasBonusOfType(HeroBonus::FREE_SHOOTING))
|
&& (!gs->curB->isStackBlocked(ID) ||
|
||||||
|
( gs->getHero(ourHero) && gs->getHero(ourHero)->hasBonusOfType(HeroBonus::FREE_SHOOTING) ) )
|
||||||
&& our->shots
|
&& our->shots
|
||||||
)
|
)
|
||||||
return true;
|
return true;
|
||||||
|
@ -1574,6 +1574,20 @@ void CBattleInterface::newRound(int number)
|
|||||||
|
|
||||||
//unlock spellbook
|
//unlock spellbook
|
||||||
bSpell->block(!LOCPLINT->cb->battleCanCastSpell());
|
bSpell->block(!LOCPLINT->cb->battleCanCastSpell());
|
||||||
|
|
||||||
|
//handle regeneration
|
||||||
|
std::map<int, CStack> stacks = LOCPLINT->cb->battleGetStacks();
|
||||||
|
for(std::map<int, CStack>::const_iterator it = stacks.begin(); it != stacks.end(); ++it)
|
||||||
|
{
|
||||||
|
if( it->second.hasFeatureOfType(StackFeature::HP_REGENERATION) )
|
||||||
|
displayEffect(74, it->second.position);
|
||||||
|
|
||||||
|
if( it->second.hasFeatureOfType(StackFeature::FULL_HP_REGENERATION, 0) )
|
||||||
|
displayEffect(4, it->second.position);
|
||||||
|
|
||||||
|
if( it->second.hasFeatureOfType(StackFeature::FULL_HP_REGENERATION, 1) )
|
||||||
|
displayEffect(74, it->second.position);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBattleInterface::giveCommand(ui8 action, ui16 tile, ui32 stack, si32 additional)
|
void CBattleInterface::giveCommand(ui8 action, ui16 tile, ui32 stack, si32 additional)
|
||||||
|
@ -74,9 +74,9 @@
|
|||||||
+ 55 ENEMY_LUCK_DECREASING -1 0 0 //archdevils
|
+ 55 ENEMY_LUCK_DECREASING -1 0 0 //archdevils
|
||||||
+ 55 HATE 0 12 0 //archdevils hate angels
|
+ 55 HATE 0 12 0 //archdevils hate angels
|
||||||
+ 55 HATE 0 13 0 //archdevils hate archangles
|
+ 55 HATE 0 13 0 //archdevils hate archangles
|
||||||
+ 60 REGENERATION 0 0 0 //wight
|
+ 60 FULL_HP_REGENERATION 0 1 0 //wight
|
||||||
+ 61 MANA_DRAIN 2 0 0 //wraith
|
+ 61 MANA_DRAIN 2 0 0 //wraith
|
||||||
+ 61 REGENERATION 0 0 0 //wraith
|
+ 61 FULL_HP_REGENERATION 0 1 0 //wraith
|
||||||
+ 62 BLOCKS_RETALIATION 0 0 0 //vampires
|
+ 62 BLOCKS_RETALIATION 0 0 0 //vampires
|
||||||
+ 63 BLOCKS_RETALIATION 0 0 0 //vampire lords
|
+ 63 BLOCKS_RETALIATION 0 0 0 //vampire lords
|
||||||
+ 63 LIFE_DRAIN 0 0 0 //vampire lords
|
+ 63 LIFE_DRAIN 0 0 0 //vampire lords
|
||||||
@ -160,6 +160,7 @@
|
|||||||
+ 123 DOUBLE_WIDE 0 0 0 //ice elemental should be treated as double-wide
|
+ 123 DOUBLE_WIDE 0 0 0 //ice elemental should be treated as double-wide
|
||||||
+ 140 DOUBLE_WIDE 0 0 0 //boar should be treated as double-wide
|
+ 140 DOUBLE_WIDE 0 0 0 //boar should be treated as double-wide
|
||||||
+ 142 DOUBLE_WIDE 0 0 0 //nomads should be treated as double-wide
|
+ 142 DOUBLE_WIDE 0 0 0 //nomads should be treated as double-wide
|
||||||
|
+ 144 FULL_HP_REGENERATION 0 0 0 //troll
|
||||||
+ 147 NOT_ACTIVE 0 0 0 //First Aid Tent //TODO: remove when support is added
|
+ 147 NOT_ACTIVE 0 0 0 //First Aid Tent //TODO: remove when support is added
|
||||||
+ 148 NOT_ACTIVE 0 0 0 //Ammo Cart
|
+ 148 NOT_ACTIVE 0 0 0 //Ammo Cart
|
||||||
- 46 FLYING //hell hound doesn't fly
|
- 46 FLYING //hell hound doesn't fly
|
||||||
|
@ -15,6 +15,9 @@
|
|||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <boost/thread/shared_mutex.hpp>
|
#include <boost/thread/shared_mutex.hpp>
|
||||||
|
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NetPacksLib.cpp, part of VCMI engine
|
* NetPacksLib.cpp, part of VCMI engine
|
||||||
*
|
*
|
||||||
@ -602,6 +605,12 @@ DLL_EXPORT void BattleNextRound::applyGs( CGameState *gs )
|
|||||||
s->state -= HAD_MORALE;
|
s->state -= HAD_MORALE;
|
||||||
s->counterAttacks = 1 + s->valOfFeatures(StackFeature::ADDITIONAL_RETALIATION);
|
s->counterAttacks = 1 + s->valOfFeatures(StackFeature::ADDITIONAL_RETALIATION);
|
||||||
|
|
||||||
|
//regeneration
|
||||||
|
if( s->hasFeatureOfType(StackFeature::HP_REGENERATION) )
|
||||||
|
s->firstHPleft = std::min<ui32>( s->MaxHealth(), s->valOfFeatures(StackFeature::HP_REGENERATION) );
|
||||||
|
if( s->hasFeatureOfType(StackFeature::FULL_HP_REGENERATION) )
|
||||||
|
s->firstHPleft = s->MaxHealth();
|
||||||
|
|
||||||
//remove effects and restore only those with remaining turns in duration
|
//remove effects and restore only those with remaining turns in duration
|
||||||
std::vector<CStack::StackEffect> tmpEffects = s->effects;
|
std::vector<CStack::StackEffect> tmpEffects = s->effects;
|
||||||
s->effects.clear();
|
s->effects.clear();
|
||||||
|
@ -40,7 +40,8 @@ struct StackFeature
|
|||||||
VCMI_CREATURE_ABILITY_NAME(ENEMY_MORALE_DECREASING) /*value - how much it decreases*/ \
|
VCMI_CREATURE_ABILITY_NAME(ENEMY_MORALE_DECREASING) /*value - how much it decreases*/ \
|
||||||
VCMI_CREATURE_ABILITY_NAME(ENEMY_LUCK_DECREASING) \
|
VCMI_CREATURE_ABILITY_NAME(ENEMY_LUCK_DECREASING) \
|
||||||
VCMI_CREATURE_ABILITY_NAME(UNDEAD) \
|
VCMI_CREATURE_ABILITY_NAME(UNDEAD) \
|
||||||
VCMI_CREATURE_ABILITY_NAME(REGENERATION) \
|
VCMI_CREATURE_ABILITY_NAME(HP_REGENERATION) /*creature regenerates val HP every new round*/ \
|
||||||
|
VCMI_CREATURE_ABILITY_NAME(FULL_HP_REGENERATION) /*first creature regenerates all HP every new round; subtype 0 - animation 4 (trolllike), 1 - animation 47 (wightlike)*/ \
|
||||||
VCMI_CREATURE_ABILITY_NAME(MANA_DRAIN) /*value - spell points per turn*/ \
|
VCMI_CREATURE_ABILITY_NAME(MANA_DRAIN) /*value - spell points per turn*/ \
|
||||||
VCMI_CREATURE_ABILITY_NAME(LIFE_DRAIN) \
|
VCMI_CREATURE_ABILITY_NAME(LIFE_DRAIN) \
|
||||||
VCMI_CREATURE_ABILITY_NAME(DOUBLE_DAMAGE_CHANCE) /*value in %, eg. dread knight*/ \
|
VCMI_CREATURE_ABILITY_NAME(DOUBLE_DAMAGE_CHANCE) /*value in %, eg. dread knight*/ \
|
||||||
|
Loading…
Reference in New Issue
Block a user