mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-23 21:29:13 +02:00
* bug 123 fixed
This commit is contained in:
parent
0ac3d9be83
commit
c08151cb5b
@ -526,7 +526,7 @@ std::vector<int> BattleInfo::getAccessibility(int stackID, bool addOccupiable) c
|
|||||||
{
|
{
|
||||||
std::vector<int> ret;
|
std::vector<int> ret;
|
||||||
bool ac[BFIELD_SIZE];
|
bool ac[BFIELD_SIZE];
|
||||||
const CStack *s = getStack(stackID);
|
const CStack *s = getStack(stackID, false); //this function is called from healedOrResurrected, so our stack can be dead
|
||||||
|
|
||||||
if(s->position < 0) //turrets
|
if(s->position < 0) //turrets
|
||||||
return std::vector<int>();
|
return std::vector<int>();
|
||||||
|
@ -1016,7 +1016,7 @@ DLL_EXPORT void StacksHealedOrResurrected::applyGs( CGameState *gs )
|
|||||||
{
|
{
|
||||||
for(int g=0; g<healedStacks.size(); ++g)
|
for(int g=0; g<healedStacks.size(); ++g)
|
||||||
{
|
{
|
||||||
CStack * changedStack = gs->curB->stacks[healedStacks[g].stackID];
|
CStack * changedStack = gs->curB->getStack(healedStacks[g].stackID, false);
|
||||||
|
|
||||||
//checking if we resurrect a stack that is under a living stack
|
//checking if we resurrect a stack that is under a living stack
|
||||||
std::vector<int> access = gs->curB->getAccessibility(changedStack->ID, true);
|
std::vector<int> access = gs->curB->getAccessibility(changedStack->ID, true);
|
||||||
@ -1031,19 +1031,26 @@ DLL_EXPORT void StacksHealedOrResurrected::applyGs( CGameState *gs )
|
|||||||
return; //position is already occupied
|
return; //position is already occupied
|
||||||
|
|
||||||
//applying changes
|
//applying changes
|
||||||
|
bool resurrected = !changedStack->alive(); //indicates if stack is resurrected or just healed
|
||||||
if(!changedStack->alive())
|
if(!changedStack->alive())
|
||||||
{
|
{
|
||||||
changedStack->state.insert(ALIVE);
|
changedStack->state.insert(ALIVE);
|
||||||
}
|
}
|
||||||
int missingHPfirst = changedStack->MaxHealth() - changedStack->firstHPleft;
|
int missingHPfirst = changedStack->MaxHealth() - changedStack->firstHPleft;
|
||||||
changedStack->amount += healedStacks[g].healedHP / changedStack->MaxHealth();
|
int res = std::min( healedStacks[g].healedHP / changedStack->MaxHealth() , changedStack->baseAmount - changedStack->amount );
|
||||||
changedStack->firstHPleft += healedStacks[g].healedHP - changedStack->amount * changedStack->MaxHealth();
|
changedStack->amount += res;
|
||||||
|
changedStack->firstHPleft += healedStacks[g].healedHP - res * changedStack->MaxHealth();
|
||||||
if(changedStack->firstHPleft > changedStack->MaxHealth())
|
if(changedStack->firstHPleft > changedStack->MaxHealth())
|
||||||
{
|
{
|
||||||
changedStack->firstHPleft -= changedStack->MaxHealth();
|
changedStack->firstHPleft -= changedStack->MaxHealth();
|
||||||
changedStack->amount += 1;
|
if(changedStack->baseAmount > changedStack->amount)
|
||||||
|
{
|
||||||
|
changedStack->amount += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
amin(changedStack->firstHPleft, changedStack->MaxHealth());
|
||||||
//removal of negative effects
|
//removal of negative effects
|
||||||
|
if(resurrected)
|
||||||
{
|
{
|
||||||
for(int h=0; h<changedStack->effects.size(); ++h)
|
for(int h=0; h<changedStack->effects.size(); ++h)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user