mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Banks now use new scheme as well
- Implemented Bank Constructor object. - Merged Pyramid object into common Bank class. Banks can now grant spells as part of their reward. - Move bank config code to config/objects/creatureBanks.json. Note: WoG banks are not updated yet, should be moved to WoG mod. - Updated AI code so it can correctly evaluate bank danger (should be generic enough for use with other objects) - New files JsonRandom.* that contain routines for loading random objects from Json (still WiP but should be stable)
This commit is contained in:
@@ -50,20 +50,45 @@ struct RandomMapInfo
|
||||
class IObjectInfo
|
||||
{
|
||||
public:
|
||||
virtual bool givesResources() const = 0;
|
||||
struct CArmyStructure
|
||||
{
|
||||
ui32 totalStrength;
|
||||
ui32 shootersStrength;
|
||||
ui32 flyersStrength;
|
||||
ui32 walkersStrength;
|
||||
|
||||
virtual bool givesExperience() const = 0;
|
||||
virtual bool givesMana() const = 0;
|
||||
virtual bool givesMovement() const = 0;
|
||||
CArmyStructure() :
|
||||
totalStrength(0),
|
||||
shootersStrength(0),
|
||||
flyersStrength(0),
|
||||
walkersStrength(0)
|
||||
{}
|
||||
|
||||
virtual bool givesPrimarySkills() const = 0;
|
||||
virtual bool givesSecondarySkills() const = 0;
|
||||
bool operator <(const CArmyStructure & other)
|
||||
{
|
||||
return this->totalStrength < other.totalStrength;
|
||||
}
|
||||
};
|
||||
|
||||
virtual bool givesArtifacts() const = 0;
|
||||
virtual bool givesCreatures() const = 0;
|
||||
virtual bool givesSpells() const = 0;
|
||||
/// Returns possible composition of guards. Actual guards would be
|
||||
/// somewhere between these two values
|
||||
virtual CArmyStructure minGuards() const { return CArmyStructure(); }
|
||||
virtual CArmyStructure maxGuards() const { return CArmyStructure(); }
|
||||
|
||||
virtual bool givesBonuses() const = 0;
|
||||
virtual bool givesResources() const { return false; }
|
||||
|
||||
virtual bool givesExperience() const { return false; }
|
||||
virtual bool givesMana() const { return false; }
|
||||
virtual bool givesMovement() const { return false; }
|
||||
|
||||
virtual bool givesPrimarySkills() const { return false; }
|
||||
virtual bool givesSecondarySkills() const { return false; }
|
||||
|
||||
virtual bool givesArtifacts() const { return false; }
|
||||
virtual bool givesCreatures() const { return false; }
|
||||
virtual bool givesSpells() const { return false; }
|
||||
|
||||
virtual bool givesBonuses() const { return false; }
|
||||
};
|
||||
|
||||
class CGObjectInstance;
|
||||
@@ -118,7 +143,7 @@ public:
|
||||
virtual void configureObject(CGObjectInstance * object, CRandomGenerator & rng) const = 0;
|
||||
|
||||
/// Returns object configuration, if available. Othervice returns NULL
|
||||
virtual const IObjectInfo * getObjectInfo(ObjectTemplate tmpl) const = 0;
|
||||
virtual std::unique_ptr<IObjectInfo> getObjectInfo(ObjectTemplate tmpl) const = 0;
|
||||
|
||||
template <typename Handler> void serialize(Handler &h, const int version)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user