2022-07-26 16:07:42 +03: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 11:26:03 +03:00
|
|
|
#pragma once
|
|
|
|
|
2023-06-02 21:47:37 +03:00
|
|
|
#include "CGObjectInstance.h"
|
2017-07-13 11:26:03 +03:00
|
|
|
#include "../CCreatureSet.h"
|
2023-04-30 15:49:26 +03:00
|
|
|
#include "../bonuses/CBonusProxy.h"
|
2023-04-30 17:35:15 +03:00
|
|
|
#include "../bonuses/CBonusSystemNode.h"
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2022-07-26 16:07:42 +03:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2017-07-20 07:08:49 +03: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 18:26:32 +03:00
|
|
|
class DLL_LINKAGE CArmedInstance: public CGObjectInstance, public CBonusSystemNode, public CCreatureSet, public IConstBonusProvider
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
2020-06-28 16:19:27 +03: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 18:26:32 +03: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 03:26:13 +04: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 14:30:54 +03:00
|
|
|
PlayerColor getOwner() const override
|
|
|
|
{
|
|
|
|
return this->tempOwner;
|
|
|
|
}
|
2023-09-17 22:19:45 +02:00
|
|
|
|
|
|
|
void serializeJsonOptions(JsonSerializeFormat & handler) override;
|
2021-09-12 14:30:54 +03: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 16:07:42 +03:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|