1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Support for banned game entities in random map templates

The following entities can now be banned in a random map template
definition:
- Hero
- Artifact
- Spell
- Secondary skill

The ban follows the same rules as banning via the map settings in the
map editor.

It is also now possible to bypass dependencies and access identifiers
from mods that are not dependencies when defining:
- Banned entities in random map templates
- the chance of a hero class appearing in a tavern of a specific faction
- the chance of a spell appearing in a mage guild of a specific faction
- the chance of a hero class receiving a secondary skill

For this to work, the identifier must be specified in full, e.g.
`modName:objectName`. If the specified mod is not active, the game will
silently ignore this entry.

This behaviour is not affected by mod load order. It is possible to use
this format to access a mod that has not yet been loaded.
This commit is contained in:
Ivan Savenko
2025-07-14 00:18:11 +03:00
parent 0d9fd09a6d
commit f58d08e563
21 changed files with 226 additions and 78 deletions

View File

@@ -338,6 +338,11 @@ public:
const JsonNode & getMapSettings() const;
const std::vector<rmg::ZoneConnection> & getConnectedZoneIds() const;
const std::set<SpellID> & getBannedSpells() const { return bannedSpells; }
const std::set<ArtifactID> & getBannedArtifacts() const { return bannedArtifacts; }
const std::set<SecondarySkill> & getBannedSkills() const { return bannedSkills; }
const std::set<HeroTypeID> & getBannedHeroes() const { return bannedHeroes; }
void validate() const; /// Tests template on validity and throws exception on failure
void serializeJson(JsonSerializeFormat & handler);
@@ -356,6 +361,11 @@ private:
std::set<EWaterContent::EWaterContent> allowedWaterContent;
std::unique_ptr<JsonNode> mapSettings;
std::set<SpellID> bannedSpells;
std::set<ArtifactID> bannedArtifacts;
std::set<SecondarySkill> bannedSkills;
std::set<HeroTypeID> bannedHeroes;
std::set<TerrainId> inheritTerrainType(std::shared_ptr<rmg::ZoneOptions> zone, uint32_t iteration = 0);
std::map<TResource, ui16> inheritMineTypes(std::shared_ptr<rmg::ZoneOptions> zone, uint32_t iteration = 0);
std::vector<CTreasureInfo> inheritTreasureInfo(std::shared_ptr<rmg::ZoneOptions> zone, uint32_t iteration = 0);
@@ -375,4 +385,4 @@ private:
};
VCMI_LIB_NAMESPACE_END
VCMI_LIB_NAMESPACE_END