mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +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;
|
||||
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
|
||||
return std::vector<int>();
|
||||
|
@ -1016,7 +1016,7 @@ DLL_EXPORT void StacksHealedOrResurrected::applyGs( CGameState *gs )
|
||||
{
|
||||
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
|
||||
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
|
||||
|
||||
//applying changes
|
||||
bool resurrected = !changedStack->alive(); //indicates if stack is resurrected or just healed
|
||||
if(!changedStack->alive())
|
||||
{
|
||||
changedStack->state.insert(ALIVE);
|
||||
}
|
||||
int missingHPfirst = changedStack->MaxHealth() - changedStack->firstHPleft;
|
||||
changedStack->amount += healedStacks[g].healedHP / changedStack->MaxHealth();
|
||||
changedStack->firstHPleft += healedStacks[g].healedHP - changedStack->amount * changedStack->MaxHealth();
|
||||
int res = std::min( healedStacks[g].healedHP / changedStack->MaxHealth() , changedStack->baseAmount - changedStack->amount );
|
||||
changedStack->amount += res;
|
||||
changedStack->firstHPleft += healedStacks[g].healedHP - res * changedStack->MaxHealth();
|
||||
if(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
|
||||
if(resurrected)
|
||||
{
|
||||
for(int h=0; h<changedStack->effects.size(); ++h)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user