1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

vcmi: specialize native terrain entity

Specialize native terrain entity for all object that have
native terrain. Allow creatures to take global bonuses into
account when checking for native terrain.
This commit is contained in:
Konstantin
2023-04-05 18:56:28 +03:00
parent 6d9859932b
commit 0f5f4c69ec
14 changed files with 122 additions and 8 deletions

View File

@@ -40,7 +40,7 @@ public:
};
class DLL_LINKAGE CGHeroInstance : public CArmedInstance, public IBoatGenerator, public CArtifactSet, public spells::Caster
class DLL_LINKAGE CGHeroInstance : public CArmedInstance, public IBoatGenerator, public CArtifactSet, public spells::Caster, public WithBonuses, public WithNativeTerrain
{
// We serialize heroes into JSON for crossover
friend class CCampaignState;
@@ -156,7 +156,9 @@ public:
bool needsLastStack()const override;
ui32 getTileCost(const TerrainTile & dest, const TerrainTile & from, const TurnInfo * ti) const; //move cost - applying pathfinding skill, road and terrain modifiers. NOT includes diagonal move penalty, last move levelling
TerrainId getNativeTerrain() const;
//WithNativeTerrain
FactionID getFaction() const override;
TerrainId getNativeTerrain() const override;
int getLowestCreatureSpeed() const;
si32 manaRegain() const; //how many points of mana can hero regain "naturally" in one day
si32 getManaNewTurn() const; //calculate how much mana this hero is going to have the next day
@@ -246,6 +248,9 @@ public:
std::string nodeName() const override;
si32 manaLimit() const override;
///WithBonuses
const IBonusBearer* getBonusBearer() const override;
CBonusSystemNode * whereShouldBeAttachedOnSiege(const bool isBattleOutsideTown) const;
CBonusSystemNode * whereShouldBeAttachedOnSiege(CGameState * gs);