فهرست منبع

[Spells] Do not use Unit State in heal effect

AlexVinS 7 سال پیش
والد
کامیت
2b49df2cab
3فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 2 2
      lib/spells/effects/Heal.cpp
  2. 1 1
      test/spells/effects/HealTest.cpp
  3. 1 1
      test/spells/effects/SacrificeTest.cpp

+ 2 - 2
lib/spells/effects/Heal.cpp

@@ -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)

+ 1 - 1
test/spells/effects/HealTest.cpp

@@ -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);
 

+ 1 - 1
test/spells/effects/SacrificeTest.cpp

@@ -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();