mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there. * Declared existing Entity APIs. * Added basic script context caching * Started Lua script module * Started Lua spell effect API * Started script state persistence * Started battle info callback binding * CommitPackage removed * Extracted spells::Caster to own header; Expanded Spell API. * implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C * !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented * Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key) * Re-enabled VERM macros. * !?GM0 added * !?TM implemented * Added !!MF:N * Started !?OB, !!BM, !!HE, !!OW, !!UN * Added basic support of w-variables * Added support for ERM indirect variables * Made !?FU regular trigger * !!re (ERA loop receiver) implemented * Fixed ERM receivers with zero args.
This commit is contained in:
@@ -31,6 +31,7 @@ protected:
|
||||
void SetUp() override
|
||||
{
|
||||
EffectFixture::setUp();
|
||||
setupEffect(JsonNode());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -46,26 +47,37 @@ protected:
|
||||
void SetUp() override
|
||||
{
|
||||
EffectFixture::setUp();
|
||||
setupEffect(JsonNode());
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(TeleportApplyTest, MovesUnit)
|
||||
{
|
||||
battleFake->setupEmptyBattlefield();
|
||||
|
||||
uint32_t unitId = 42;
|
||||
BattleHex initial(1, 1);
|
||||
BattleHex destination(10, 10);
|
||||
|
||||
EXPECT_CALL(*battleFake, getUnitsIf(_)).Times(AtLeast(0));
|
||||
|
||||
auto & unit = unitsFake.add(BattleSide::ATTACKER);
|
||||
|
||||
ON_CALL(unit, getPosition()).WillByDefault(Return(initial));
|
||||
EXPECT_CALL(unit, getPosition()).WillRepeatedly(Return(initial));
|
||||
EXPECT_CALL(unit, unitId()).Times(AtLeast(1)).WillRepeatedly(Return(unitId));
|
||||
EXPECT_CALL(unit, unitSide()).Times(AtLeast(1));
|
||||
EXPECT_CALL(unit, doubleWide()).WillRepeatedly(Return(false));
|
||||
EXPECT_CALL(unit, isValidTarget(Eq(false))).WillRepeatedly(Return(true));
|
||||
|
||||
EXPECT_CALL(*battleFake, moveUnit(Eq(unitId), Eq(destination)));
|
||||
EXPECT_CALL(mechanicsMock, getEffectLevel()).WillRepeatedly(Return(0));
|
||||
EXPECT_CALL(serverMock, apply(Matcher<BattleStackMoved *>(_))).Times(1);
|
||||
|
||||
Target target;
|
||||
target.emplace_back(&unit, BattleHex());
|
||||
target.emplace_back(destination);
|
||||
|
||||
subject->apply(battleProxy.get(), rngMock, &mechanicsMock, target);
|
||||
subject->apply(&serverMock, &mechanicsMock, target);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user