1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

* support for HP regeneration

* minor fixes
This commit is contained in:
mateuszb
2009-08-22 14:39:44 +00:00
parent 66dd31fd8a
commit ef8f2e695f
5 changed files with 30 additions and 4 deletions

View File

@@ -15,6 +15,9 @@
#include <boost/thread.hpp>
#include <boost/thread/shared_mutex.hpp>
#undef min
#undef max
/*
* NetPacksLib.cpp, part of VCMI engine
*
@@ -602,6 +605,12 @@ DLL_EXPORT void BattleNextRound::applyGs( CGameState *gs )
s->state -= HAD_MORALE;
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
std::vector<CStack::StackEffect> tmpEffects = s->effects;
s->effects.clear();