1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

[Spells] Do not use Unit State in heal effect

This commit is contained in:
AlexVinS 2018-02-20 13:19:01 +03:00
parent 2add0e443e
commit 2b49df2cab
3 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,7 @@
#include "../../NetPacks.h"
#include "../../battle/IBattleState.h"
#include "../../battle/CBattleInfoCallback.h"
#include "../../battle/CUnitState.h"
#include "../../battle/Unit.h"
#include "../../serializer/JsonSerializeFormat.h"
@ -120,7 +120,7 @@ void Heal::prepareHealEffect(int64_t value, BattleUnitsChanged & pack, RNG & rng
{
auto unitHPgained = m->applySpellBonus(value, unit);
auto state = unit->acquireState();
auto state = unit->acquire();
state->heal(unitHPgained, healLevel, healPower);
if(unitHPgained > 0)

View File

@ -286,7 +286,7 @@ TEST_P(HealApplyTest, Heals)
GTEST_ASSERT_EQ(targetUnitState->getAvailableHealth(), unitAmount * unitHP / 2 + 1);
GTEST_ASSERT_EQ(targetUnitState->getFirstHPleft(), 1);
EXPECT_CALL(targetUnit, acquireState()).WillOnce(Return(targetUnitState));
EXPECT_CALL(targetUnit, acquire()).WillOnce(Return(targetUnitState));
EXPECT_CALL(*battleFake, setUnitState(Eq(unitId), _, Gt(0))).Times(1);

View File

@ -198,7 +198,7 @@ TEST_F(SacrificeApplyTest, ResurrectsTarget)
targetUnitState->damage(initialDmg);
}
EXPECT_CALL(targetUnit, acquireState()).WillOnce(Return(targetUnitState));
EXPECT_CALL(targetUnit, acquire()).WillOnce(Return(targetUnitState));
setupDefaultRNG();