2022-07-26 15:07:42 +02:00
|
|
|
/*
|
2014-06-05 20:26:50 +03:00
|
|
|
* CArmedInstance.h, part of VCMI engine
|
2014-06-05 19:52:14 +03:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
2017-07-13 10:26:03 +02:00
|
|
|
#pragma once
|
|
|
|
|
2023-06-02 20:47:37 +02:00
|
|
|
#include "CGObjectInstance.h"
|
2017-07-13 10:26:03 +02:00
|
|
|
#include "../CCreatureSet.h"
|
2023-04-30 14:49:26 +02:00
|
|
|
#include "../bonuses/CBonusProxy.h"
|
2023-04-30 16:35:15 +02:00
|
|
|
#include "../bonuses/CBonusSystemNode.h"
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2017-07-20 06:08:49 +02:00
|
|
|
class BattleInfo;
|
2014-06-25 17:11:07 +03:00
|
|
|
class CGameState;
|
2023-09-17 22:19:45 +02:00
|
|
|
class JsonSerializeFormat;
|
2014-06-25 17:11:07 +03:00
|
|
|
|
2023-04-09 17:26:32 +02:00
|
|
|
class DLL_LINKAGE CArmedInstance: public CGObjectInstance, public CBonusSystemNode, public CCreatureSet, public IConstBonusProvider
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
2020-06-28 15:19:27 +02:00
|
|
|
private:
|
|
|
|
CCheckProxy nonEvilAlignmentMix;
|
|
|
|
static CSelector nonEvilAlignmentMixSelector;
|
|
|
|
|
2014-06-05 19:52:14 +03:00
|
|
|
public:
|
|
|
|
BattleInfo *battle; //set to the current battle, if engaged
|
|
|
|
|
2023-11-05 18:58:07 +02:00
|
|
|
void randomizeArmy(FactionID type);
|
2014-06-05 19:52:14 +03:00
|
|
|
virtual void updateMoraleBonusFromArmy();
|
|
|
|
|
|
|
|
void armyChanged() override;
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2023-04-09 17:26:32 +02:00
|
|
|
//IConstBonusProvider
|
|
|
|
const IBonusBearer* getBonusBearer() const override;
|
2014-06-05 19:52:14 +03:00
|
|
|
// int valOfGlobalBonuses(CSelector selector) const; //used only for castle interface ???
|
2022-11-06 01:26:13 +02:00
|
|
|
virtual CBonusSystemNode & whereShouldBeAttached(CGameState * gs);
|
|
|
|
virtual CBonusSystemNode & whatShouldBeAttached();
|
2014-06-05 19:52:14 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2024-01-01 16:37:48 +02:00
|
|
|
CArmedInstance(IGameCallback *cb);
|
|
|
|
CArmedInstance(IGameCallback *cb, bool isHypothetic);
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2021-09-12 13:30:54 +02:00
|
|
|
PlayerColor getOwner() const override
|
|
|
|
{
|
|
|
|
return this->tempOwner;
|
|
|
|
}
|
2023-09-17 22:19:45 +02:00
|
|
|
|
|
|
|
void serializeJsonOptions(JsonSerializeFormat & handler) override;
|
2021-09-12 13:30:54 +02:00
|
|
|
|
2024-01-20 20:34:51 +02:00
|
|
|
template <typename Handler> void serialize(Handler &h)
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
|
|
|
h & static_cast<CBonusSystemNode&>(*this);
|
|
|
|
h & static_cast<CCreatureSet&>(*this);
|
|
|
|
}
|
|
|
|
};
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|