2014-06-05 19:52:14 +03:00
|
|
|
/*
|
2014-06-05 20:26:50 +03:00
|
|
|
* MiscObjects.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
|
|
|
|
|
|
|
|
#include "CArmedInstance.h"
|
2023-06-17 22:52:42 +02:00
|
|
|
#include "../MetaString.h"
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2016-02-13 18:43:05 +02:00
|
|
|
class CMap;
|
|
|
|
|
2023-06-02 20:47:37 +02:00
|
|
|
// This one teleport-specific, but has to be available everywhere in callbacks and netpacks
|
|
|
|
// For now it's will be there till teleports code refactored and moved into own file
|
|
|
|
using TTeleportExitsList = std::vector<std::pair<ObjectInstanceID, int3>>;
|
|
|
|
|
2017-06-30 22:39:37 +02:00
|
|
|
/// Legacy class, use CRewardableObject instead
|
|
|
|
class DLL_LINKAGE CTeamVisited: public CGObjectInstance
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::set<PlayerColor> players; //players that visited this object
|
|
|
|
|
2022-12-07 21:50:45 +02:00
|
|
|
bool wasVisited (const CGHeroInstance * h) const override;
|
2015-10-12 15:47:10 +02:00
|
|
|
bool wasVisited(PlayerColor player) const override;
|
2023-02-12 22:39:17 +02:00
|
|
|
bool wasVisited(const TeamID & team) const;
|
2023-11-06 18:27:16 +02:00
|
|
|
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
|
|
|
h & players;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGSignBottle : public CGObjectInstance //signs and ocean bottles
|
|
|
|
{
|
|
|
|
public:
|
2023-09-27 23:11:11 +02:00
|
|
|
MetaString message;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2016-09-09 19:30:36 +02:00
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
|
|
|
h & message;
|
|
|
|
}
|
2015-11-16 15:30:40 +02:00
|
|
|
protected:
|
2016-02-22 01:37:19 +02:00
|
|
|
void serializeJsonOptions(JsonSerializeFormat & handler) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGGarrison : public CArmedInstance
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
bool removableUnits;
|
|
|
|
|
2014-06-24 02:26:36 +03:00
|
|
|
bool passableFor(PlayerColor color) const override;
|
2014-06-05 19:52:14 +03:00
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
|
|
|
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CArmedInstance&>(*this);
|
|
|
|
h & removableUnits;
|
|
|
|
}
|
2015-11-16 15:30:40 +02:00
|
|
|
protected:
|
2016-02-22 01:37:19 +02:00
|
|
|
void serializeJsonOptions(JsonSerializeFormat & handler) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGArtifact : public CArmedInstance
|
|
|
|
{
|
|
|
|
public:
|
2023-04-17 23:11:16 +02:00
|
|
|
CArtifactInstance * storedArtifact = nullptr;
|
2023-09-27 23:11:11 +02:00
|
|
|
MetaString message;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
|
|
|
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
|
|
|
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override;
|
|
|
|
|
2014-06-24 20:39:36 +03:00
|
|
|
std::string getObjectName() const override;
|
2023-11-02 15:51:08 +02:00
|
|
|
std::string getPopupText(PlayerColor player) const override;
|
|
|
|
std::string getPopupText(const CGHeroInstance * hero) const override;
|
|
|
|
std::vector<Component> getPopupComponents(PlayerColor player) const override;
|
2014-06-24 20:39:36 +03:00
|
|
|
|
2014-06-05 19:52:14 +03:00
|
|
|
void pick( const CGHeroInstance * h ) const;
|
2016-09-09 19:30:36 +02:00
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2023-10-25 12:50:11 +02:00
|
|
|
void pickRandomObject(CRandomGenerator & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2017-05-28 15:23:42 +02:00
|
|
|
void afterAddToMap(CMap * map) override;
|
2022-07-09 18:00:03 +02:00
|
|
|
BattleField getBattlefield() const override;
|
2017-05-28 15:23:42 +02:00
|
|
|
|
2023-10-24 16:11:25 +02:00
|
|
|
ArtifactID getArtifact() const;
|
|
|
|
|
2014-06-05 19:52:14 +03:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CArmedInstance&>(*this);
|
2017-07-31 15:35:42 +02:00
|
|
|
h & message;
|
|
|
|
h & storedArtifact;
|
2014-06-05 19:52:14 +03:00
|
|
|
}
|
2015-11-16 15:30:40 +02:00
|
|
|
protected:
|
2016-02-22 01:37:19 +02:00
|
|
|
void serializeJsonOptions(JsonSerializeFormat & handler) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGResource : public CArmedInstance
|
|
|
|
{
|
|
|
|
public:
|
2023-02-12 22:39:17 +02:00
|
|
|
static constexpr ui32 RANDOM_AMOUNT = 0;
|
|
|
|
ui32 amount = RANDOM_AMOUNT; //0 if random
|
2022-05-23 12:08:36 +02:00
|
|
|
|
2023-09-27 23:11:11 +02:00
|
|
|
MetaString message;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2016-09-09 19:30:36 +02:00
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2023-10-25 12:50:11 +02:00
|
|
|
void pickRandomObject(CRandomGenerator & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
|
|
|
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override;
|
2014-06-24 20:39:36 +03:00
|
|
|
std::string getHoverText(PlayerColor player) const override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2023-02-12 22:39:17 +02:00
|
|
|
void collectRes(const PlayerColor & player) const;
|
2023-10-24 16:11:25 +02:00
|
|
|
GameResID resourceID() const;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CArmedInstance&>(*this);
|
2017-07-31 15:35:42 +02:00
|
|
|
h & amount;
|
|
|
|
h & message;
|
2014-06-05 19:52:14 +03:00
|
|
|
}
|
2015-11-16 15:30:40 +02:00
|
|
|
protected:
|
2016-02-22 01:37:19 +02:00
|
|
|
void serializeJsonOptions(JsonSerializeFormat & handler) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGMine : public CArmedInstance
|
|
|
|
{
|
|
|
|
public:
|
2023-04-05 02:26:29 +02:00
|
|
|
GameResID producedResource;
|
2014-06-05 19:52:14 +03:00
|
|
|
ui32 producedQuantity;
|
2023-04-02 18:56:10 +02:00
|
|
|
std::set<GameResID> abandonedMineResources;
|
2023-09-03 21:41:57 +02:00
|
|
|
|
|
|
|
bool isAbandoned() const;
|
2023-10-28 11:27:10 +02:00
|
|
|
ResourceSet dailyIncome() const;
|
2015-12-02 22:34:13 +02:00
|
|
|
|
|
|
|
private:
|
2014-06-05 19:52:14 +03:00
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
|
|
|
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
|
|
|
void blockingDialogAnswered(const CGHeroInstance *hero, ui32 answer) const override;
|
|
|
|
|
2023-02-12 22:39:17 +02:00
|
|
|
void flagMine(const PlayerColor & player) const;
|
2016-09-09 19:30:36 +02:00
|
|
|
void newTurn(CRandomGenerator & rand) const override;
|
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2014-06-24 20:39:36 +03:00
|
|
|
|
|
|
|
std::string getObjectName() const override;
|
|
|
|
std::string getHoverText(PlayerColor player) const override;
|
|
|
|
|
2015-12-02 22:34:13 +02:00
|
|
|
public:
|
2014-06-05 19:52:14 +03:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CArmedInstance&>(*this);
|
2017-07-31 15:35:42 +02:00
|
|
|
h & producedResource;
|
|
|
|
h & producedQuantity;
|
2023-04-02 18:56:10 +02:00
|
|
|
h & abandonedMineResources;
|
2014-06-05 19:52:14 +03:00
|
|
|
}
|
2023-02-12 22:39:17 +02:00
|
|
|
ui32 defaultResProduction() const;
|
|
|
|
|
2015-11-16 15:30:40 +02:00
|
|
|
protected:
|
2016-02-22 01:37:19 +02:00
|
|
|
void serializeJsonOptions(JsonSerializeFormat & handler) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
|
|
|
|
2015-03-08 14:18:53 +02:00
|
|
|
struct DLL_LINKAGE TeleportChannel
|
|
|
|
{
|
|
|
|
enum EPassability {UNKNOWN, IMPASSABLE, PASSABLE};
|
|
|
|
|
|
|
|
std::vector<ObjectInstanceID> entrances;
|
|
|
|
std::vector<ObjectInstanceID> exits;
|
2023-02-12 22:39:17 +02:00
|
|
|
EPassability passability = EPassability::UNKNOWN;
|
2015-03-08 14:18:53 +02:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2017-07-31 15:35:42 +02:00
|
|
|
h & entrances;
|
|
|
|
h & exits;
|
|
|
|
h & passability;
|
2015-03-08 14:18:53 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-03-08 15:11:23 +02:00
|
|
|
class DLL_LINKAGE CGTeleport : public CGObjectInstance
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
2023-02-12 22:39:17 +02:00
|
|
|
bool isChannelEntrance(const ObjectInstanceID & id) const;
|
|
|
|
bool isChannelExit(const ObjectInstanceID & id) const;
|
2015-03-08 15:11:23 +02:00
|
|
|
|
2015-12-02 21:01:43 +02:00
|
|
|
std::vector<ObjectInstanceID> getAllEntrances(bool excludeCurrent = false) const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
enum EType {UNKNOWN, ENTRANCE, EXIT, BOTH};
|
2023-02-12 22:39:17 +02:00
|
|
|
EType type = EType::UNKNOWN;
|
2015-03-08 15:11:23 +02:00
|
|
|
|
2015-12-02 21:01:43 +02:00
|
|
|
ObjectInstanceID getRandomExit(const CGHeroInstance * h) const;
|
|
|
|
std::vector<ObjectInstanceID> getAllExits(bool excludeCurrent = false) const;
|
|
|
|
|
|
|
|
public:
|
|
|
|
TeleportChannelID channel;
|
|
|
|
|
2015-03-08 15:11:23 +02:00
|
|
|
bool isEntrance() const;
|
|
|
|
bool isExit() const;
|
|
|
|
|
2015-12-02 16:56:26 +02:00
|
|
|
virtual void teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer, TTeleportExitsList exits) const = 0;
|
2015-03-08 15:11:23 +02:00
|
|
|
|
|
|
|
static bool isTeleport(const CGObjectInstance * dst);
|
|
|
|
static bool isConnected(const CGTeleport * src, const CGTeleport * dst);
|
|
|
|
static bool isConnected(const CGObjectInstance * src, const CGObjectInstance * dst);
|
2015-12-29 04:43:33 +02:00
|
|
|
static void addToChannel(std::map<TeleportChannelID, std::shared_ptr<TeleportChannel> > &channelsList, const CGTeleport * obj);
|
2015-12-02 21:01:43 +02:00
|
|
|
static std::vector<ObjectInstanceID> getPassableExits(CGameState * gs, const CGHeroInstance * h, std::vector<ObjectInstanceID> exits);
|
|
|
|
static bool isExitPassable(CGameState * gs, const CGHeroInstance * h, const CGObjectInstance * obj);
|
2015-03-08 15:11:23 +02:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2017-07-31 15:35:42 +02:00
|
|
|
h & type;
|
|
|
|
h & channel;
|
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
2015-03-08 15:11:23 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGMonolith : public CGTeleport
|
|
|
|
{
|
2023-11-02 17:12:58 +02:00
|
|
|
TeleportChannelID findMeChannel(const std::vector<Obj> & IDs, MapObjectSubID SubID) const;
|
2015-03-08 15:11:23 +02:00
|
|
|
|
2015-12-02 21:01:43 +02:00
|
|
|
protected:
|
2014-06-05 19:52:14 +03:00
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2015-12-02 16:56:26 +02:00
|
|
|
void teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer, TTeleportExitsList exits) const override;
|
2016-09-09 19:30:36 +02:00
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2015-12-02 21:01:43 +02:00
|
|
|
public:
|
2014-06-05 19:52:14 +03:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2015-03-08 15:11:23 +02:00
|
|
|
h & static_cast<CGTeleport&>(*this);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGSubterraneanGate : public CGMonolith
|
|
|
|
{
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2016-09-09 19:30:36 +02:00
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2015-12-02 21:01:43 +02:00
|
|
|
|
|
|
|
public:
|
2015-03-11 16:17:21 +02:00
|
|
|
static void postInit();
|
2015-03-08 15:11:23 +02:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CGMonolith&>(*this);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGWhirlpool : public CGMonolith
|
|
|
|
{
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2015-12-02 16:56:26 +02:00
|
|
|
void teleportDialogAnswered(const CGHeroInstance *hero, ui32 answer, TTeleportExitsList exits) const override;
|
2015-03-08 15:11:23 +02:00
|
|
|
static bool isProtected( const CGHeroInstance * h );
|
|
|
|
|
2015-12-02 21:01:43 +02:00
|
|
|
public:
|
2015-03-08 15:11:23 +02:00
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CGMonolith&>(*this);
|
2014-06-05 19:52:14 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGSirens : public CGObjectInstance
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2014-06-24 20:39:36 +03:00
|
|
|
std::string getHoverText(const CGHeroInstance * hero) const override;
|
2016-09-09 19:30:36 +02:00
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-04-18 23:11:51 +02:00
|
|
|
class DLL_LINKAGE CGBoat : public CGObjectInstance, public CBonusSystemNode
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ui8 direction;
|
|
|
|
const CGHeroInstance *hero; //hero on board
|
2023-04-19 00:11:24 +02:00
|
|
|
bool onboardAssaultAllowed; //if true, hero can attack units from transport
|
|
|
|
bool onboardVisitAllowed; //if true, hero can visit objects from transport
|
2023-08-19 23:22:31 +02:00
|
|
|
EPathfindingLayer layer;
|
2023-04-18 22:14:15 +02:00
|
|
|
|
|
|
|
//animation filenames. If empty - animations won't be used
|
2023-08-23 14:07:50 +02:00
|
|
|
AnimationPath actualAnimation; //for OH3 boats those have actual animations
|
|
|
|
AnimationPath overlayAnimation; //waves animations
|
|
|
|
std::array<AnimationPath, PlayerColor::PLAYER_LIMIT_I> flagAnimations;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2023-06-07 23:42:47 +02:00
|
|
|
CGBoat();
|
2023-06-21 15:49:44 +02:00
|
|
|
bool isCoastVisitable() const override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2017-07-31 15:35:42 +02:00
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
2023-04-18 23:11:51 +02:00
|
|
|
h & static_cast<CBonusSystemNode&>(*this);
|
2017-07-31 15:35:42 +02:00
|
|
|
h & direction;
|
|
|
|
h & hero;
|
2023-04-18 15:27:39 +02:00
|
|
|
h & layer;
|
2023-04-19 00:11:24 +02:00
|
|
|
h & onboardAssaultAllowed;
|
|
|
|
h & onboardVisitAllowed;
|
2023-04-18 23:11:51 +02:00
|
|
|
h & actualAnimation;
|
|
|
|
h & overlayAnimation;
|
|
|
|
h & flagAnimations;
|
2014-06-05 19:52:14 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2022-09-17 13:04:01 +02:00
|
|
|
class DLL_LINKAGE CGShipyard : public CGObjectInstance, public IShipyard
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
2023-06-07 23:04:13 +02:00
|
|
|
friend class ShipyardInstanceConstructor;
|
|
|
|
|
|
|
|
BoatId createdBoat;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void getOutOffsets(std::vector<int3> & offsets) const override;
|
2014-06-05 19:52:14 +03:00
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2023-06-07 00:55:21 +02:00
|
|
|
const IObjectInterface * getObject() const override;
|
|
|
|
BoatId getBoatType() const override;
|
|
|
|
|
2023-06-07 23:04:13 +02:00
|
|
|
public:
|
|
|
|
template<typename Handler> void serialize(Handler & h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
|
|
|
h & createdBoat;
|
|
|
|
}
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2015-11-16 15:30:40 +02:00
|
|
|
protected:
|
2016-02-22 01:37:19 +02:00
|
|
|
void serializeJsonOptions(JsonSerializeFormat & handler) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGMagi : public CGObjectInstance
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static std::map <si32, std::vector<ObjectInstanceID> > eyelist; //[subID][id], supports multiple sets as in H5
|
|
|
|
|
2016-08-25 14:52:20 +02:00
|
|
|
static void reset();
|
|
|
|
|
2016-09-09 19:30:36 +02:00
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGDenOfthieves : public CGObjectInstance
|
|
|
|
{
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
|
|
|
};
|
|
|
|
|
2017-06-30 22:39:37 +02:00
|
|
|
class DLL_LINKAGE CGObelisk : public CTeamVisited
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
static ui8 obeliskCount; //how many obelisks are on map
|
|
|
|
static std::map<TeamID, ui8> visited; //map: team_id => how many obelisks has been visited
|
|
|
|
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2016-09-09 19:30:36 +02:00
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2014-06-24 20:39:36 +03:00
|
|
|
std::string getHoverText(PlayerColor player) const override;
|
2016-01-20 12:02:52 +02:00
|
|
|
static void reset();
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
2017-06-30 22:39:37 +02:00
|
|
|
h & static_cast<CTeamVisited&>(*this);
|
2014-06-05 19:52:14 +03:00
|
|
|
}
|
|
|
|
protected:
|
2023-11-06 18:27:16 +02:00
|
|
|
void setPropertyDer(ObjProperty what, ObjPropertyID identifier) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGLighthouse : public CGObjectInstance
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2016-09-09 19:30:36 +02:00
|
|
|
void initObj(CRandomGenerator & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
|
|
|
}
|
2023-02-12 22:39:17 +02:00
|
|
|
void giveBonusTo(const PlayerColor & player, bool onInit = false) const;
|
|
|
|
|
2015-11-16 15:30:40 +02:00
|
|
|
protected:
|
2016-02-22 01:37:19 +02:00
|
|
|
void serializeJsonOptions(JsonSerializeFormat & handler) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
2022-06-26 09:21:05 +02:00
|
|
|
|
|
|
|
class DLL_LINKAGE CGTerrainPatch : public CGObjectInstance
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CGTerrainPatch() = default;
|
|
|
|
|
|
|
|
virtual bool isTile2Terrain() const override
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
2022-07-26 15:07:42 +02:00
|
|
|
|
2023-06-06 18:19:30 +02:00
|
|
|
class DLL_LINKAGE HillFort : public CGObjectInstance, public ICreatureUpgrader
|
|
|
|
{
|
2023-06-06 23:17:39 +02:00
|
|
|
friend class HillFortInstanceConstructor;
|
|
|
|
|
|
|
|
std::vector<int> upgradeCostPercentage;
|
|
|
|
|
2023-06-06 18:19:30 +02:00
|
|
|
protected:
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
|
|
|
void fillUpgradeInfo(UpgradeInfo & info, const CStackInstance &stack) const override;
|
2023-06-06 23:17:39 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
|
|
{
|
|
|
|
h & static_cast<CGObjectInstance&>(*this);
|
|
|
|
h & upgradeCostPercentage;
|
|
|
|
}
|
2023-06-06 18:19:30 +02:00
|
|
|
};
|
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_END
|