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.
2018-03-17 16:58:30 +02:00
|
|
|
/*
|
|
|
|
* CCreatureTest.cpp, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#include "StdInc.h"
|
|
|
|
|
|
|
|
#include "../../lib/CCreatureHandler.h"
|
|
|
|
|
|
|
|
namespace test
|
|
|
|
{
|
|
|
|
|
|
|
|
using namespace ::testing;
|
|
|
|
|
|
|
|
class CCreatureTest : public Test
|
|
|
|
{
|
|
|
|
public:
|
2023-01-04 22:33:56 +02:00
|
|
|
MOCK_METHOD4(registarCb, void(int32_t, int32_t, const std::string &, const std::string &));
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
protected:
|
|
|
|
std::shared_ptr<CCreature> subject;
|
|
|
|
|
|
|
|
void SetUp() override
|
|
|
|
{
|
|
|
|
subject = std::make_shared<CCreature>();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(CCreatureTest, RegistersIcons)
|
|
|
|
{
|
|
|
|
subject->iconIndex = 4242;
|
|
|
|
subject->smallIconName = "Test1";
|
|
|
|
subject->largeIconName = "Test2";
|
|
|
|
|
2023-02-28 13:59:02 +02:00
|
|
|
auto cb = [this](auto && PH1, auto && PH2, auto && PH3, auto && PH4)
|
|
|
|
{
|
|
|
|
registarCb(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2), std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
|
|
|
|
};
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
|
2023-01-04 22:33:56 +02:00
|
|
|
EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "CPRSMALL", "Test1"));
|
|
|
|
EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "TWCRPORT", "Test2"));
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
|
|
|
|
subject->registerIcons(cb);
|
|
|
|
}
|
|
|
|
|
2024-01-03 02:26:15 +02:00
|
|
|
TEST_F(CCreatureTest, DISABLED_JsonUpdate)
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
{
|
|
|
|
JsonNode data(JsonNode::JsonType::DATA_STRUCT);
|
|
|
|
|
|
|
|
JsonNode & config = data["config"];
|
|
|
|
config["cost"]["gold"].Integer() = 750;
|
|
|
|
config["attack"].Integer() = 17;
|
|
|
|
config["defense"].Integer() = 15;
|
|
|
|
config["hitPoints"].Integer() = 50;
|
|
|
|
|
|
|
|
config["speed"].Integer() = 9;
|
|
|
|
config["damage"]["min"].Integer() = 12;
|
|
|
|
config["damage"]["max"].Integer() = 20;
|
|
|
|
config["shots"].Integer() = 100;
|
|
|
|
|
|
|
|
config["growth"].Integer() = 1;
|
|
|
|
config["spellPoints"].Integer() = 2;
|
|
|
|
config["horde"].Integer() = 123;
|
|
|
|
config["aiValue"].Integer() = 3388;
|
|
|
|
|
|
|
|
config["fightValue"].Integer() = 2420;
|
|
|
|
config["level"].Integer() = 6;
|
|
|
|
config["faction"].Integer() = 55;
|
|
|
|
config["doubleWide"].Bool() = true;
|
|
|
|
|
|
|
|
subject->updateFrom(data);
|
|
|
|
|
2023-04-05 02:26:29 +02:00
|
|
|
EXPECT_EQ(subject->getRecruitCost(EGameResID::GOLD), 750);
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
EXPECT_EQ(subject->getBaseAttack(), 17);
|
|
|
|
EXPECT_EQ(subject->getAttack(false), 17);
|
|
|
|
EXPECT_EQ(subject->getAttack(true), 17);
|
|
|
|
|
|
|
|
EXPECT_EQ(subject->getBaseDefense(), 15);
|
|
|
|
EXPECT_EQ(subject->getDefense(false), 15);
|
|
|
|
EXPECT_EQ(subject->getDefense(true), 15);
|
|
|
|
EXPECT_EQ(subject->getBaseHitPoints(), 50);
|
|
|
|
|
|
|
|
EXPECT_EQ(subject->getBaseSpeed(), 9);
|
|
|
|
EXPECT_EQ(subject->getBaseDamageMin(), 12);
|
|
|
|
EXPECT_EQ(subject->getMinDamage(false), 12);
|
|
|
|
EXPECT_EQ(subject->getMinDamage(true), 12);
|
|
|
|
EXPECT_EQ(subject->getBaseDamageMax(), 20);
|
|
|
|
EXPECT_EQ(subject->getMaxDamage(false), 20);
|
|
|
|
EXPECT_EQ(subject->getMaxDamage(true), 20);
|
|
|
|
EXPECT_EQ(subject->getBaseShots(), 100);
|
|
|
|
|
|
|
|
EXPECT_EQ(subject->getGrowth(), 1);
|
|
|
|
EXPECT_EQ(subject->getBaseSpellPoints(), 2);
|
|
|
|
EXPECT_EQ(subject->getHorde(), 123);
|
|
|
|
EXPECT_EQ(subject->getAIValue(), 3388);
|
|
|
|
|
|
|
|
EXPECT_EQ(subject->getFightValue(), 2420);
|
|
|
|
EXPECT_EQ(subject->getLevel(), 6);
|
2023-08-18 12:38:19 +02:00
|
|
|
EXPECT_EQ(subject->getFaction().getNum(), 55);
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
EXPECT_TRUE(subject->isDoubleWide());
|
|
|
|
}
|
|
|
|
|
2024-01-03 02:26:15 +02:00
|
|
|
TEST_F(CCreatureTest, DISABLED_JsonAddBonus)
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
{
|
|
|
|
JsonNode data(JsonNode::JsonType::DATA_STRUCT);
|
|
|
|
|
2024-01-17 14:50:00 +02:00
|
|
|
auto b = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::BLOCKS_RETALIATION, BonusSource::CREATURE_ABILITY, 17, BonusSourceID(CreatureID(42)), BonusSubtypeID(CreatureID(43)), BonusValueType::BASE_NUMBER);
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
|
|
|
|
JsonNode & toAdd = data["bonuses"]["toAdd"];
|
|
|
|
|
|
|
|
toAdd.Vector().push_back(b->toJsonNode());
|
|
|
|
|
|
|
|
subject->updateFrom(data);
|
|
|
|
|
|
|
|
auto selector = [](const Bonus * bonus)
|
|
|
|
{
|
2023-05-01 00:20:01 +02:00
|
|
|
return (bonus->duration == BonusDuration::PERMANENT)
|
|
|
|
&& (bonus->type == BonusType::BLOCKS_RETALIATION)
|
|
|
|
&& (bonus->source == BonusSource::CREATURE_ABILITY)
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
&& (bonus->val == 17)
|
2023-10-10 17:05:18 +02:00
|
|
|
&& (bonus->sid.as<CreatureID>().getNum() == 42)
|
2023-10-05 17:18:14 +02:00
|
|
|
&& (bonus->subtype.as<CreatureID>().getNum() == 43)
|
2023-05-01 00:20:01 +02:00
|
|
|
&& (bonus->valType == BonusValueType::BASE_NUMBER);
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
EXPECT_TRUE(subject->hasBonus(selector));
|
|
|
|
}
|
|
|
|
|
2024-01-03 02:26:15 +02:00
|
|
|
TEST_F(CCreatureTest, DISABLED_JsonRemoveBonus)
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
{
|
|
|
|
JsonNode data(JsonNode::JsonType::DATA_STRUCT);
|
|
|
|
|
2024-01-17 14:50:00 +02:00
|
|
|
auto b1 = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::BLOCKS_RETALIATION, BonusSource::CREATURE_ABILITY, 17, BonusSourceID(CreatureID(42)), BonusSubtypeID(CreatureID(43)), BonusValueType::BASE_NUMBER);
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
subject->addNewBonus(b1);
|
|
|
|
|
2024-01-17 14:50:00 +02:00
|
|
|
auto b2 = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::BLOCKS_RETALIATION, BonusSource::CREATURE_ABILITY, 18, BonusSourceID(CreatureID(42)), BonusSubtypeID(CreatureID(43)), BonusValueType::BASE_NUMBER);
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
subject->addNewBonus(b2);
|
|
|
|
|
|
|
|
|
|
|
|
JsonNode & toRemove = data["bonuses"]["toRemove"];
|
|
|
|
|
|
|
|
toRemove.Vector().push_back(b2->toJsonNode());
|
|
|
|
|
|
|
|
subject->updateFrom(data);
|
|
|
|
|
|
|
|
auto selector1 = [](const Bonus * bonus)
|
|
|
|
{
|
2023-05-01 00:20:01 +02:00
|
|
|
return (bonus->duration == BonusDuration::PERMANENT)
|
|
|
|
&& (bonus->type == BonusType::BLOCKS_RETALIATION)
|
|
|
|
&& (bonus->source == BonusSource::CREATURE_ABILITY)
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
&& (bonus->val == 17)
|
2023-10-10 17:05:18 +02:00
|
|
|
&& (bonus->sid.as<CreatureID>().getNum() == 42)
|
2023-10-05 17:18:14 +02:00
|
|
|
&& (bonus->subtype.as<CreatureID>().getNum() == 43)
|
2023-05-01 00:20:01 +02:00
|
|
|
&& (bonus->valType == BonusValueType::BASE_NUMBER);
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
EXPECT_TRUE(subject->hasBonus(selector1));
|
|
|
|
|
|
|
|
auto selector2 = [](const Bonus * bonus)
|
|
|
|
{
|
2023-05-01 00:20:01 +02:00
|
|
|
return (bonus->duration == BonusDuration::PERMANENT)
|
|
|
|
&& (bonus->type == BonusType::BLOCKS_RETALIATION)
|
|
|
|
&& (bonus->source == BonusSource::CREATURE_ABILITY)
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
&& (bonus->val == 18)
|
2023-10-10 17:05:18 +02:00
|
|
|
&& (bonus->sid.as<CreatureID>().getNum() == 42)
|
2023-05-01 00:20:01 +02:00
|
|
|
&& (bonus->valType == BonusValueType::BASE_NUMBER);
|
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.
2018-03-17 16:58:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
EXPECT_FALSE(subject->hasBonus(selector2));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|