mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
ab475195ac
- 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)
51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include "../GameConstants.h"
|
|
#include "../ResourceSet.h"
|
|
|
|
/*
|
|
* JsonRandom.h, part of VCMI engine
|
|
*
|
|
* 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
|
|
*
|
|
*/
|
|
|
|
class JsonNode;
|
|
typedef std::vector<JsonNode> JsonVector;
|
|
class CRandomGenerator;
|
|
|
|
class Bonus;
|
|
class Component;
|
|
class CStackBasicDescriptor;
|
|
|
|
namespace JsonRandom
|
|
{
|
|
struct RandomStackInfo
|
|
{
|
|
std::vector<const CCreature *> allowedCreatures;
|
|
si32 minAmount;
|
|
si32 maxAmount;
|
|
};
|
|
|
|
si32 loadValue(const JsonNode & value, CRandomGenerator & rng, si32 defaultValue = 0);
|
|
TResources loadResources(const JsonNode & value, CRandomGenerator & rng);
|
|
std::vector<si32> loadPrimary(const JsonNode & value, CRandomGenerator & rng);
|
|
std::map<SecondarySkill, si32> loadSecondary(const JsonNode & value, CRandomGenerator & rng);
|
|
|
|
ArtifactID loadArtifact(const JsonNode & value, CRandomGenerator & rng);
|
|
std::vector<ArtifactID> loadArtifacts(const JsonNode & value, CRandomGenerator & rng);
|
|
|
|
SpellID loadSpell(const JsonNode & value, CRandomGenerator & rng, std::vector<SpellID> spells);
|
|
std::vector<SpellID> loadSpells(const JsonNode & value, CRandomGenerator & rng, std::vector<SpellID> spells);
|
|
|
|
CStackBasicDescriptor loadCreature(const JsonNode & value, CRandomGenerator & rng);
|
|
std::vector<CStackBasicDescriptor> loadCreatures(const JsonNode & value, CRandomGenerator & rng);
|
|
std::vector<RandomStackInfo> evaluateCreatures(const JsonNode & value);
|
|
|
|
std::vector<Bonus> loadBonuses(const JsonNode & value);
|
|
std::vector<Component> loadComponents(const JsonNode & value);
|
|
}
|