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"
|
2024-08-24 22:42:19 +02:00
|
|
|
#include "IOwnableObject.h"
|
2024-07-20 14:55:17 +02:00
|
|
|
#include "../texts/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:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGObjectInstance::CGObjectInstance;
|
|
|
|
|
2014-06-05 19:52:14 +03:00
|
|
|
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
|
|
|
|
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 & players;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGSignBottle : public CGObjectInstance //signs and ocean bottles
|
|
|
|
{
|
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGObjectInstance::CGObjectInstance;
|
|
|
|
|
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;
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG & rand) override;
|
2014-06-05 19:52:14 +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 & 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
|
|
|
};
|
|
|
|
|
2024-08-25 17:04:44 +02:00
|
|
|
class DLL_LINKAGE CGGarrison : public CArmedInstance, public IOwnableObject
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CArmedInstance::CArmedInstance;
|
|
|
|
|
2014-06-05 19:52:14 +03:00
|
|
|
bool removableUnits;
|
|
|
|
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG &rand) override;
|
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;
|
|
|
|
|
2024-08-25 17:04:44 +02:00
|
|
|
const IOwnableObject * asOwnable() const final;
|
|
|
|
ResourceSet dailyIncome() const override;
|
|
|
|
std::vector<CreatureID> providedCreatures() const override;
|
|
|
|
|
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<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;
|
2023-12-21 19:09:33 +02:00
|
|
|
void addAntimagicGarrisonBonus();
|
2024-08-25 17:04:44 +02:00
|
|
|
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGArtifact : public CArmedInstance
|
|
|
|
{
|
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CArmedInstance::CArmedInstance;
|
|
|
|
|
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;
|
2024-08-09 00:28:28 +02:00
|
|
|
void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
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;
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG & rand) override;
|
|
|
|
void pickRandomObject(vstd::RNG & 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;
|
|
|
|
|
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<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:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CArmedInstance::CArmedInstance;
|
|
|
|
|
2024-06-17 22:08:07 +02:00
|
|
|
static constexpr uint32_t RANDOM_AMOUNT = 0;
|
|
|
|
static constexpr uint32_t GOLD_AMOUNT_MULTIPLIER = 100;
|
|
|
|
uint32_t 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;
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG & rand) override;
|
|
|
|
void pickRandomObject(vstd::RNG & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
void battleFinished(const CGHeroInstance *hero, const BattleResult &result) const override;
|
2024-08-09 00:28:28 +02:00
|
|
|
void blockingDialogAnswered(const CGHeroInstance *hero, int32_t 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
|
|
|
|
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<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
|
|
|
};
|
|
|
|
|
2024-08-24 22:42:19 +02:00
|
|
|
class DLL_LINKAGE CGMine : public CArmedInstance, public IOwnableObject
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
|
|
|
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;
|
2015-12-02 22:34:13 +02:00
|
|
|
private:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CArmedInstance::CArmedInstance;
|
|
|
|
|
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;
|
2024-08-09 00:28:28 +02:00
|
|
|
void blockingDialogAnswered(const CGHeroInstance *hero, int32_t answer) const override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2023-02-12 22:39:17 +02:00
|
|
|
void flagMine(const PlayerColor & player) const;
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG & 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:
|
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<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;
|
2024-07-25 02:51:00 +02:00
|
|
|
ui32 getProducedQuantity() const;
|
2023-02-12 22:39:17 +02:00
|
|
|
|
2024-08-24 22:42:19 +02:00
|
|
|
const IOwnableObject * asOwnable() const final;
|
2024-08-25 17:04:44 +02:00
|
|
|
ResourceSet dailyIncome() const override;
|
|
|
|
std::vector<CreatureID> providedCreatures() const override;
|
2024-08-24 22:42:19 +02: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
|
|
|
};
|
|
|
|
|
2024-05-07 21:17:05 +02:00
|
|
|
struct DLL_LINKAGE TeleportChannel : public Serializeable
|
2015-03-08 14:18:53 +02:00
|
|
|
{
|
|
|
|
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
|
|
|
|
2024-01-20 20:34:51 +02:00
|
|
|
template <typename Handler> void serialize(Handler &h)
|
2015-03-08 14:18:53 +02:00
|
|
|
{
|
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:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGObjectInstance::CGObjectInstance;
|
|
|
|
|
2015-12-02 21:01:43 +02:00
|
|
|
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
|
|
|
|
2024-01-20 20:34:51 +02:00
|
|
|
template <typename Handler> void serialize(Handler &h)
|
2015-03-08 15:11:23 +02:00
|
|
|
{
|
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;
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
|
2015-12-02 21:01:43 +02:00
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGTeleport::CGTeleport;
|
|
|
|
|
2024-01-20 20:34:51 +02:00
|
|
|
template <typename Handler> void serialize(Handler &h)
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
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;
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG & rand) override;
|
2015-12-02 21:01:43 +02:00
|
|
|
|
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGMonolith::CGMonolith;
|
|
|
|
|
|
|
|
static void postInit(IGameCallback * cb);
|
2015-03-08 15:11:23 +02:00
|
|
|
|
2024-01-20 20:34:51 +02:00
|
|
|
template <typename Handler> void serialize(Handler &h)
|
2015-03-08 15:11:23 +02:00
|
|
|
{
|
|
|
|
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:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGMonolith::CGMonolith;
|
|
|
|
|
2024-01-20 20:34:51 +02:00
|
|
|
template <typename Handler> void serialize(Handler &h)
|
2015-03-08 15:11:23 +02:00
|
|
|
{
|
|
|
|
h & static_cast<CGMonolith&>(*this);
|
2014-06-05 19:52:14 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGSirens : public CGObjectInstance
|
|
|
|
{
|
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGObjectInstance::CGObjectInstance;
|
|
|
|
|
2014-06-05 19:52:14 +03:00
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2014-06-24 20:39:36 +03:00
|
|
|
std::string getHoverText(const CGHeroInstance * hero) const override;
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG & rand) override;
|
2014-06-05 19:52:14 +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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
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:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGObjectInstance::CGObjectInstance;
|
|
|
|
|
2014-06-05 19:52:14 +03:00
|
|
|
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
|
|
|
|
2024-01-01 16:37:48 +02:00
|
|
|
CGBoat(IGameCallback * cb);
|
2023-06-21 15:49:44 +02:00
|
|
|
bool isCoastVisitable() const override;
|
2014-06-05 19:52:14 +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
|
|
|
{
|
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
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2024-09-04 21:46:36 +02:00
|
|
|
class DLL_LINKAGE CGShipyard : public CGObjectInstance, public IShipyard, public IOwnableObject
|
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;
|
|
|
|
|
2024-09-04 21:46:36 +02:00
|
|
|
const IOwnableObject * asOwnable() const final;
|
|
|
|
ResourceSet dailyIncome() const override;
|
|
|
|
std::vector<CreatureID> providedCreatures() const override;
|
|
|
|
|
2023-06-07 23:04:13 +02:00
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGObjectInstance::CGObjectInstance;
|
|
|
|
|
2024-01-20 20:34:51 +02:00
|
|
|
template<typename Handler> void serialize(Handler & h)
|
2023-06-07 23:04:13 +02:00
|
|
|
{
|
|
|
|
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:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGObjectInstance::CGObjectInstance;
|
|
|
|
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG & rand) override;
|
2014-06-05 19:52:14 +03:00
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class DLL_LINKAGE CGDenOfthieves : public CGObjectInstance
|
|
|
|
{
|
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2024-01-01 16:37:48 +02:00
|
|
|
public:
|
|
|
|
using CGObjectInstance::CGObjectInstance;
|
2014-06-05 19:52:14 +03:00
|
|
|
};
|
|
|
|
|
2017-06-30 22:39:37 +02:00
|
|
|
class DLL_LINKAGE CGObelisk : public CTeamVisited
|
2014-06-05 19:52:14 +03:00
|
|
|
{
|
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CTeamVisited::CTeamVisited;
|
|
|
|
|
2014-06-05 19:52:14 +03:00
|
|
|
void onHeroVisit(const CGHeroInstance * h) const override;
|
2024-06-01 17:28:17 +02:00
|
|
|
void initObj(vstd::RNG & rand) override;
|
2014-06-24 20:39:36 +03:00
|
|
|
std::string getHoverText(PlayerColor player) const override;
|
2014-06-05 19:52:14 +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
|
|
|
{
|
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
|
|
|
};
|
|
|
|
|
2022-06-26 09:21:05 +02:00
|
|
|
class DLL_LINKAGE CGTerrainPatch : public CGObjectInstance
|
|
|
|
{
|
|
|
|
public:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGObjectInstance::CGObjectInstance;
|
2022-06-26 09:21:05 +02:00
|
|
|
|
2024-02-10 21:22:08 +02:00
|
|
|
bool isTile2Terrain() const override
|
2022-06-26 09:21:05 +02:00
|
|
|
{
|
|
|
|
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:
|
2024-01-01 16:37:48 +02:00
|
|
|
using CGObjectInstance::CGObjectInstance;
|
|
|
|
|
2024-10-30 15:20:21 +02:00
|
|
|
std::string getPopupText(PlayerColor player) const override;
|
|
|
|
std::string getPopupText(const CGHeroInstance * hero) const override;
|
|
|
|
|
2024-09-24 18:28:17 +02:00
|
|
|
std::string getDescriptionToolTip() const;
|
|
|
|
std::string getUnavailableUpgradeMessage() const;
|
2024-08-07 19:36:16 +02:00
|
|
|
|
2024-01-20 20:34:51 +02:00
|
|
|
template <typename Handler> void serialize(Handler &h)
|
2023-06-06 23:17:39 +02:00
|
|
|
{
|
|
|
|
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
|