2017-07-20 06:08:49 +02:00
|
|
|
/*
|
|
|
|
* BattleProxy.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 "BattleProxy.h"
|
|
|
|
#include "Unit.h"
|
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
///BattleProxy
|
|
|
|
|
2023-02-15 00:44:59 +02:00
|
|
|
BattleProxy::BattleProxy(Subject subject_):
|
|
|
|
subject(std::move(subject_))
|
2023-08-28 16:43:57 +02:00
|
|
|
{}
|
|
|
|
|
|
|
|
BattleProxy::~BattleProxy() = default;
|
|
|
|
|
|
|
|
const IBattleInfo * BattleProxy::getBattle() const
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
2023-08-28 16:43:57 +02:00
|
|
|
return this;
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
|
|
|
|
2023-08-28 16:43:57 +02:00
|
|
|
std::optional<PlayerColor> BattleProxy::getPlayerID() const
|
|
|
|
{
|
|
|
|
return subject->getPlayerID();
|
|
|
|
}
|
2017-07-20 06:08:49 +02:00
|
|
|
|
|
|
|
int32_t BattleProxy::getActiveStackID() const
|
|
|
|
{
|
2023-02-15 00:44:59 +02:00
|
|
|
const auto * ret = subject->battleActiveUnit();
|
2017-07-20 06:08:49 +02:00
|
|
|
if(ret)
|
|
|
|
return ret->unitId();
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
TStacks BattleProxy::getStacksIf(TStackFilter predicate) const
|
|
|
|
{
|
|
|
|
return subject->battleGetStacksIf(predicate);
|
|
|
|
}
|
|
|
|
|
|
|
|
battle::Units BattleProxy::getUnitsIf(battle::UnitFilter predicate) const
|
|
|
|
{
|
|
|
|
return subject->battleGetUnitsIf(predicate);
|
|
|
|
}
|
|
|
|
|
2022-06-22 10:41:02 +02:00
|
|
|
BattleField BattleProxy::getBattlefieldType() const
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
|
|
|
return subject->battleGetBattlefieldType();
|
|
|
|
}
|
|
|
|
|
2022-09-29 11:44:46 +02:00
|
|
|
TerrainId BattleProxy::getTerrainType() const
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
|
|
|
return subject->battleTerrainType();
|
|
|
|
}
|
|
|
|
|
|
|
|
IBattleInfo::ObstacleCList BattleProxy::getAllObstacles() const
|
|
|
|
{
|
|
|
|
return subject->battleGetAllObstacles();
|
|
|
|
}
|
|
|
|
|
|
|
|
PlayerColor BattleProxy::getSidePlayer(ui8 side) const
|
|
|
|
{
|
|
|
|
return subject->sideToPlayer(side);
|
|
|
|
}
|
|
|
|
|
|
|
|
const CArmedInstance * BattleProxy::getSideArmy(ui8 side) const
|
|
|
|
{
|
|
|
|
return subject->battleGetArmyObject(side);
|
|
|
|
}
|
|
|
|
|
|
|
|
const CGHeroInstance * BattleProxy::getSideHero(ui8 side) const
|
|
|
|
{
|
|
|
|
return subject->battleGetFightingHero(side);
|
|
|
|
}
|
|
|
|
|
|
|
|
ui8 BattleProxy::getTacticDist() const
|
|
|
|
{
|
|
|
|
return subject->battleTacticDist();
|
|
|
|
}
|
|
|
|
|
|
|
|
ui8 BattleProxy::getTacticsSide() const
|
|
|
|
{
|
|
|
|
return subject->battleGetTacticsSide();
|
|
|
|
}
|
|
|
|
|
|
|
|
const CGTownInstance * BattleProxy::getDefendedTown() const
|
|
|
|
{
|
|
|
|
return subject->battleGetDefendedTown();
|
|
|
|
}
|
|
|
|
|
2023-01-13 00:35:58 +02:00
|
|
|
EWallState BattleProxy::getWallState(EWallPart partOfWall) const
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
|
|
|
return subject->battleGetWallState(partOfWall);
|
|
|
|
}
|
|
|
|
|
|
|
|
EGateState BattleProxy::getGateState() const
|
|
|
|
{
|
|
|
|
return subject->battleGetGateState();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t BattleProxy::getCastSpells(ui8 side) const
|
|
|
|
{
|
|
|
|
return subject->battleCastSpells(side);
|
|
|
|
}
|
|
|
|
|
|
|
|
int32_t BattleProxy::getEnchanterCounter(ui8 side) const
|
|
|
|
{
|
|
|
|
return subject->battleGetEnchanterCounter(side);
|
|
|
|
}
|
|
|
|
|
2023-04-05 02:26:29 +02:00
|
|
|
const IBonusBearer * BattleProxy::getBonusBearer() const
|
2017-07-20 06:08:49 +02:00
|
|
|
{
|
2023-04-05 02:26:29 +02:00
|
|
|
return subject->getBonusBearer();
|
2017-07-20 06:08:49 +02:00
|
|
|
}
|
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|