mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
[Spells] Do not use Unit State in heal effect
This commit is contained in:
parent
2add0e443e
commit
2b49df2cab
@ -16,7 +16,7 @@
|
|||||||
#include "../../NetPacks.h"
|
#include "../../NetPacks.h"
|
||||||
#include "../../battle/IBattleState.h"
|
#include "../../battle/IBattleState.h"
|
||||||
#include "../../battle/CBattleInfoCallback.h"
|
#include "../../battle/CBattleInfoCallback.h"
|
||||||
#include "../../battle/CUnitState.h"
|
#include "../../battle/Unit.h"
|
||||||
#include "../../serializer/JsonSerializeFormat.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 unitHPgained = m->applySpellBonus(value, unit);
|
||||||
|
|
||||||
auto state = unit->acquireState();
|
auto state = unit->acquire();
|
||||||
state->heal(unitHPgained, healLevel, healPower);
|
state->heal(unitHPgained, healLevel, healPower);
|
||||||
|
|
||||||
if(unitHPgained > 0)
|
if(unitHPgained > 0)
|
||||||
|
@ -286,7 +286,7 @@ TEST_P(HealApplyTest, Heals)
|
|||||||
GTEST_ASSERT_EQ(targetUnitState->getAvailableHealth(), unitAmount * unitHP / 2 + 1);
|
GTEST_ASSERT_EQ(targetUnitState->getAvailableHealth(), unitAmount * unitHP / 2 + 1);
|
||||||
GTEST_ASSERT_EQ(targetUnitState->getFirstHPleft(), 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);
|
EXPECT_CALL(*battleFake, setUnitState(Eq(unitId), _, Gt(0))).Times(1);
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@ TEST_F(SacrificeApplyTest, ResurrectsTarget)
|
|||||||
targetUnitState->damage(initialDmg);
|
targetUnitState->damage(initialDmg);
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPECT_CALL(targetUnit, acquireState()).WillOnce(Return(targetUnitState));
|
EXPECT_CALL(targetUnit, acquire()).WillOnce(Return(targetUnitState));
|
||||||
|
|
||||||
setupDefaultRNG();
|
setupDefaultRNG();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user