1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-31 22:05:10 +02:00

Merge pull request #3990 from IvanSavenko/random_monsters

[1.5.2] Exclude some AB creatures from randomization picks
This commit is contained in:
Ivan Savenko 2024-05-19 15:42:29 +03:00 committed by GitHub
commit c5a53f4866
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 0 deletions

View File

@ -67,6 +67,7 @@
"index": 132,
"level": 10,
"faction": "neutral",
"excludeFromRandomization" : true,
"abilities":
{
"dragon" :
@ -109,6 +110,7 @@
"index": 133,
"level": 10,
"faction": "neutral",
"excludeFromRandomization" : true,
"abilities":
{
"dragon" :
@ -144,6 +146,7 @@
"index": 134,
"level": 8,
"faction": "neutral",
"excludeFromRandomization" : true,
"abilities":
{
"dragon" :
@ -241,6 +244,7 @@
"index": 135,
"level": 10,
"faction": "neutral",
"excludeFromRandomization" : true,
"abilities":
{
"dragon" :
@ -283,6 +287,7 @@
"level": 6,
"extraNames": [ "enchanters" ],
"faction": "neutral",
"excludeFromRandomization" : true,
"abilities":
{
"noPenalty" :
@ -362,6 +367,7 @@
"level": 4,
"extraNames": [ "sharpshooters" ],
"faction": "neutral",
"excludeFromRandomization" : true,
"abilities":
{
"noPenalty" :

View File

@ -25,6 +25,10 @@
"type" : "boolean",
"description" : "Internal. Object is competely disabled and may not be even loaded in-game"
},
"excludeFromRandomization" : {
"type" : "boolean",
"description" : "If set, this creature will never be picked as random monster and will not appear in Refugee Camp. Random map generator can still pick this creature"
},
"name" : {
"type" : "object",
"additionalProperties" : false,

View File

@ -37,6 +37,10 @@ In order to make functional creature you also need:
// Marks this object as special and not available by default
"special" : true,
// If set, this creature will never be picked as random monster on premade maps and will not appear in Refugee Camp
// Random map generator does not checks for this flag and can still pick this creature
"excludeFromRandomization" : false,
// Faction this creature belongs to. Examples: castle, rampart
"faction" : "",

View File

@ -957,6 +957,7 @@ void CCreatureHandler::loadCreatureJson(CCreature * creature, const JsonNode & c
}
creature->special = config["special"].Bool() || config["disabled"].Bool();
creature->excludeFromRandomization = config["excludeFromRandomization"].Bool();
const JsonNode & sounds = config["sound"];
creature->sounds.attack = AudioPath::fromJson(sounds["attack"]);
@ -1357,6 +1358,9 @@ CreatureID CCreatureHandler::pickRandomMonster(CRandomGenerator & rand, int tier
if(creature->special)
continue;
if(creature->excludeFromRandomization)
continue;
if (creature->level == tier || tier == -1)
allowed.push_back(creature->getId());
}

View File

@ -58,6 +58,7 @@ public:
ui32 ammMax;
bool special = true; // Creature is not available normally (war machines, commanders, several unused creatures, etc
bool excludeFromRandomization = false;
std::set<CreatureID> upgrades; // IDs of creatures to which this creature can be upgraded