2017-07-20 06:08:49 +02:00
|
|
|
/*
|
|
|
|
* CUnitStateTest.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 "mock/mock_BonusBearer.h"
|
|
|
|
#include "mock/mock_UnitInfo.h"
|
|
|
|
#include "mock/mock_UnitEnvironment.h"
|
|
|
|
#include "../../lib/battle/CUnitState.h"
|
|
|
|
#include "../../lib/CCreatureHandler.h"
|
|
|
|
|
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
|
|
|
namespace test
|
|
|
|
{
|
|
|
|
using namespace ::testing;
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
static const int32_t DEFAULT_HP = 123;
|
|
|
|
static const int32_t DEFAULT_AMOUNT = 100;
|
|
|
|
static const int32_t DEFAULT_SPEED = 10;
|
|
|
|
static const BattleHex DEFAULT_POSITION = BattleHex(5, 5);
|
|
|
|
static const int DEFAULT_ATTACK = 58;
|
|
|
|
static const int DEFAULT_DEFENCE = 63;
|
|
|
|
|
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
|
|
|
class UnitStateTest : public Test
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
UnitInfoMock infoMock;
|
|
|
|
UnitEnvironmentMock envMock;
|
|
|
|
BonusBearerMock bonusMock;
|
|
|
|
|
|
|
|
const CCreature * pikeman;
|
|
|
|
|
|
|
|
battle::CUnitStateDetached subject;
|
|
|
|
|
|
|
|
bool hasAmmoCart;
|
|
|
|
|
|
|
|
UnitStateTest()
|
|
|
|
:infoMock(),
|
|
|
|
envMock(),
|
|
|
|
bonusMock(),
|
|
|
|
subject(&infoMock, &bonusMock),
|
|
|
|
hasAmmoCart(false)
|
|
|
|
{
|
|
|
|
pikeman = CreatureID(0).toCreature();
|
|
|
|
}
|
|
|
|
|
|
|
|
void setDefaultExpectations()
|
|
|
|
{
|
2023-10-21 13:50:42 +02:00
|
|
|
bonusMock.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::STACKS_SPEED, BonusSource::CREATURE_ABILITY, DEFAULT_SPEED, BonusSourceID()));
|
2017-07-20 06:08:49 +02:00
|
|
|
|
2023-10-21 13:50:42 +02:00
|
|
|
bonusMock.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::PRIMARY_SKILL, BonusSource::CREATURE_ABILITY, DEFAULT_ATTACK, BonusSourceID(), BonusSubtypeID(PrimarySkill::ATTACK)));
|
|
|
|
bonusMock.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::PRIMARY_SKILL, BonusSource::CREATURE_ABILITY, DEFAULT_DEFENCE, BonusSourceID(), BonusSubtypeID(PrimarySkill::DEFENSE)));
|
2017-07-20 06:08:49 +02:00
|
|
|
|
2023-10-21 13:50:42 +02:00
|
|
|
bonusMock.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::STACK_HEALTH, BonusSource::CREATURE_ABILITY, DEFAULT_HP, BonusSourceID()));
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
EXPECT_CALL(infoMock, unitBaseAmount()).WillRepeatedly(Return(DEFAULT_AMOUNT));
|
|
|
|
EXPECT_CALL(infoMock, unitType()).WillRepeatedly(Return(pikeman));
|
|
|
|
|
|
|
|
EXPECT_CALL(envMock, unitHasAmmoCart(_)).WillRepeatedly(Return(hasAmmoCart));
|
|
|
|
}
|
|
|
|
|
|
|
|
void makeShooter(int32_t ammo)
|
|
|
|
{
|
2023-10-21 13:50:42 +02:00
|
|
|
bonusMock.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::SHOOTER, BonusSource::CREATURE_ABILITY, 1, BonusSourceID()));
|
|
|
|
bonusMock.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::SHOTS, BonusSource::CREATURE_ABILITY, ammo, BonusSourceID()));
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void initUnit()
|
|
|
|
{
|
|
|
|
subject.localInit(&envMock);
|
|
|
|
subject.position = DEFAULT_POSITION;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, initialRegular)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
initUnit();
|
|
|
|
|
|
|
|
EXPECT_TRUE(subject.alive());
|
|
|
|
EXPECT_TRUE(subject.ableToRetaliate());
|
|
|
|
EXPECT_FALSE(subject.isGhost());
|
|
|
|
EXPECT_FALSE(subject.isDead());
|
|
|
|
EXPECT_FALSE(subject.isTurret());
|
|
|
|
EXPECT_TRUE(subject.isValidTarget(true));
|
|
|
|
EXPECT_TRUE(subject.isValidTarget(false));
|
|
|
|
|
|
|
|
EXPECT_FALSE(subject.isClone());
|
|
|
|
EXPECT_FALSE(subject.hasClone());
|
|
|
|
|
|
|
|
EXPECT_FALSE(subject.canCast());
|
|
|
|
EXPECT_FALSE(subject.isCaster());
|
|
|
|
EXPECT_FALSE(subject.canShoot());
|
|
|
|
EXPECT_FALSE(subject.isShooter());
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getCount(), DEFAULT_AMOUNT);
|
|
|
|
EXPECT_EQ(subject.getFirstHPleft(), DEFAULT_HP);
|
|
|
|
EXPECT_EQ(subject.getKilled(), 0);
|
|
|
|
EXPECT_EQ(subject.getAvailableHealth(), DEFAULT_HP * DEFAULT_AMOUNT);
|
|
|
|
EXPECT_EQ(subject.getTotalHealth(), subject.getAvailableHealth());
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getPosition(), DEFAULT_POSITION);
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getInitiative(), DEFAULT_SPEED);
|
|
|
|
EXPECT_EQ(subject.getInitiative(123456), DEFAULT_SPEED);
|
|
|
|
|
|
|
|
EXPECT_TRUE(subject.canMove());
|
|
|
|
EXPECT_TRUE(subject.canMove(123456));
|
|
|
|
EXPECT_FALSE(subject.defended());
|
|
|
|
EXPECT_FALSE(subject.defended(123456));
|
|
|
|
EXPECT_FALSE(subject.moved());
|
|
|
|
EXPECT_FALSE(subject.moved(123456));
|
|
|
|
EXPECT_TRUE(subject.willMove());
|
|
|
|
EXPECT_TRUE(subject.willMove(123456));
|
|
|
|
EXPECT_FALSE(subject.waited());
|
|
|
|
EXPECT_FALSE(subject.waited(123456));
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getTotalAttacks(true), 1);
|
|
|
|
EXPECT_EQ(subject.getTotalAttacks(false), 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, canShoot)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
makeShooter(1);
|
|
|
|
initUnit();
|
|
|
|
|
|
|
|
EXPECT_FALSE(subject.canCast());
|
|
|
|
EXPECT_FALSE(subject.isCaster());
|
|
|
|
EXPECT_TRUE(subject.canShoot());
|
|
|
|
EXPECT_TRUE(subject.isShooter());
|
|
|
|
|
|
|
|
subject.afterAttack(true, false);
|
|
|
|
|
|
|
|
EXPECT_FALSE(subject.canShoot());
|
|
|
|
EXPECT_TRUE(subject.isShooter());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, canShootWithAmmoCart)
|
|
|
|
{
|
|
|
|
hasAmmoCart = true;
|
|
|
|
setDefaultExpectations();
|
|
|
|
makeShooter(1);
|
|
|
|
initUnit();
|
|
|
|
|
|
|
|
EXPECT_FALSE(subject.canCast());
|
|
|
|
EXPECT_FALSE(subject.isCaster());
|
|
|
|
EXPECT_TRUE(subject.canShoot());
|
|
|
|
EXPECT_TRUE(subject.isShooter());
|
|
|
|
|
|
|
|
subject.afterAttack(true, false);
|
|
|
|
|
|
|
|
EXPECT_TRUE(subject.canShoot());
|
|
|
|
EXPECT_TRUE(subject.isShooter());
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, getAttack)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getAttack(false), DEFAULT_ATTACK);
|
|
|
|
EXPECT_EQ(subject.getAttack(true), DEFAULT_ATTACK);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
TEST_F(UnitStateTest, getDefense)
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
|
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.getDefense(false), DEFAULT_DEFENCE);
|
|
|
|
EXPECT_EQ(subject.getDefense(true), DEFAULT_DEFENCE);
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, attackWithFrenzy)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
|
2023-10-21 13:50:42 +02:00
|
|
|
bonusMock.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::IN_FRENZY, BonusSource::SPELL_EFFECT, 50, BonusSourceID()));
|
2017-07-20 06:08:49 +02:00
|
|
|
|
Fixed a bad fix. Fixed more warnings.
These warnings have not been fixed because the are legitimate and/or I don't know how to fix them:
test\googletest\googletest\include\gtest/gtest-printers.h(888,43): warning C4996: 'std::tr1': warning STL4002: The non-Standard std::tr1 namespace and TR1-only machinery are deprecated and will be REMOVED.
lib\serializer\JsonSerializeFormat.h(523,26): warning C4244: 'argument': conversion from 'type1' to 'type2', possible loss of data
include\boost/iostreams/positioning.hpp(96,15): warning C4996: 'std::fpos<_Mbstatet>::seekpos': warning STL4019: The member std::fpos::seekpos() is non-Standard, ...
source\lib\filesystem\FileStream.h(39,69): warning C4910: 'boost::iostreams::stream<FileBuf,std::char_traits<char>,std::allocator<char>>': '__declspec(dllexport)' and 'extern' are incompatible on an explicit instantiation
include\boost/optional/optional.hpp(274,53): warning C4244: 'argument': conversion from 'T' to 'T', possible loss of data
client\widgets\../gui/SDL_Extensions.h(112,14): warning C4244: 'initializing': conversion from 'type1' to 'type2', possible loss of data
client\CServerHandler.cpp(421,24): warning C4834: discarding return value of function with 'nodiscard' attribute (see https://bugs.vcmi.eu/view.php?id=3144)
client\CVideoHandler.cpp(130,25): warning C4996: 'AVStream::codec': was declared deprecated
2020-10-05 01:00:38 +02:00
|
|
|
int expectedAttack = static_cast<int>(DEFAULT_ATTACK + 0.5 * DEFAULT_DEFENCE);
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
EXPECT_EQ(subject.getAttack(false), expectedAttack);
|
|
|
|
EXPECT_EQ(subject.getAttack(true), expectedAttack);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, defenceWithFrenzy)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
|
2023-10-21 13:50:42 +02:00
|
|
|
bonusMock.addNewBonus(std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::IN_FRENZY, BonusSource::SPELL_EFFECT, 50, BonusSourceID()));
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
int expectedDefence = 0;
|
|
|
|
|
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.getDefense(false), expectedDefence);
|
|
|
|
EXPECT_EQ(subject.getDefense(true), expectedDefence);
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, additionalAttack)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
|
|
|
|
{
|
2023-10-21 13:50:42 +02:00
|
|
|
auto bonus = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::ADDITIONAL_ATTACK, BonusSource::SPELL_EFFECT, 41, BonusSourceID());
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
bonusMock.addNewBonus(bonus);
|
|
|
|
}
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getTotalAttacks(false), 42);
|
|
|
|
EXPECT_EQ(subject.getTotalAttacks(true), 42);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, additionalMeleeAttack)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
|
|
|
|
{
|
2023-10-21 13:50:42 +02:00
|
|
|
auto bonus = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::ADDITIONAL_ATTACK, BonusSource::SPELL_EFFECT, 41, BonusSourceID());
|
2023-05-01 00:20:01 +02:00
|
|
|
bonus->effectRange = BonusLimitEffect::ONLY_MELEE_FIGHT;
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
bonusMock.addNewBonus(bonus);
|
|
|
|
}
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getTotalAttacks(false), 42);
|
|
|
|
EXPECT_EQ(subject.getTotalAttacks(true), 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, additionalRangedAttack)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
|
|
|
|
{
|
2023-10-21 13:50:42 +02:00
|
|
|
auto bonus = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::ADDITIONAL_ATTACK, BonusSource::SPELL_EFFECT, 41, BonusSourceID());
|
2023-05-01 00:20:01 +02:00
|
|
|
bonus->effectRange = BonusLimitEffect::ONLY_DISTANCE_FIGHT;
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
bonusMock.addNewBonus(bonus);
|
|
|
|
}
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getTotalAttacks(false), 1);
|
|
|
|
EXPECT_EQ(subject.getTotalAttacks(true), 42);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
TEST_F(UnitStateTest, getMinDamage)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
|
|
|
|
{
|
2023-10-21 13:50:42 +02:00
|
|
|
auto bonus = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::CREATURE_DAMAGE, BonusSource::SPELL_EFFECT, 30, BonusSourceID(), BonusCustomSubtype::creatureDamageBoth);
|
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
|
|
|
bonusMock.addNewBonus(bonus);
|
|
|
|
|
2023-10-21 13:50:42 +02:00
|
|
|
bonus = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::CREATURE_DAMAGE, BonusSource::SPELL_EFFECT, -20, BonusSourceID(), BonusCustomSubtype::creatureDamageMin);
|
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
|
|
|
bonusMock.addNewBonus(bonus);
|
|
|
|
}
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getMinDamage(false), 10);
|
|
|
|
EXPECT_EQ(subject.getMinDamage(true), 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_F(UnitStateTest, getMaxDamage)
|
|
|
|
{
|
|
|
|
setDefaultExpectations();
|
|
|
|
|
|
|
|
{
|
2023-10-21 13:50:42 +02:00
|
|
|
auto bonus = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::CREATURE_DAMAGE, BonusSource::SPELL_EFFECT, 30, BonusSourceID(), BonusCustomSubtype::creatureDamageBoth);
|
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
|
|
|
bonusMock.addNewBonus(bonus);
|
|
|
|
|
2023-10-21 13:50:42 +02:00
|
|
|
bonus = std::make_shared<Bonus>(BonusDuration::PERMANENT, BonusType::CREATURE_DAMAGE, BonusSource::SPELL_EFFECT, -20, BonusSourceID(), BonusCustomSubtype::creatureDamageMax);
|
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
|
|
|
bonusMock.addNewBonus(bonus);
|
|
|
|
}
|
|
|
|
|
|
|
|
EXPECT_EQ(subject.getMaxDamage(false), 10);
|
|
|
|
EXPECT_EQ(subject.getMaxDamage(true), 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|