mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-23 00:28:08 +02:00
Implemented "changeCreatures" option for Stables
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include "../CRandomGenerator.h"
|
||||
#include "../StringConstants.h"
|
||||
#include "../CCreatureHandler.h"
|
||||
#include "../CModHandler.h"
|
||||
#include "JsonRandom.h"
|
||||
#include "../IGameCallback.h"
|
||||
|
||||
@ -117,6 +118,16 @@ void CRandomRewardObjectInfo::configureReward(CRewardableObject * object, CRando
|
||||
reward.artifacts = JsonRandom::loadArtifacts(source["artifacts"], rng);
|
||||
reward.spells = JsonRandom::loadSpells(source["spells"], rng, spells);
|
||||
reward.creatures = JsonRandom::loadCreatures(source["creatures"], rng);
|
||||
|
||||
for ( auto node : source["changeCreatures"].Struct() )
|
||||
{
|
||||
CreatureID from (VLC->modh->identifiers.getIdentifier (node.second.meta, "creature", node.first) .get());
|
||||
CreatureID dest (VLC->modh->identifiers.getIdentifier (node.second.meta, "creature", node.second.String()).get());
|
||||
|
||||
reward.extraComponents.push_back(Component(Component::CREATURE, dest.getNum(), 0, 0));
|
||||
|
||||
reward.creaturesChange[from] = dest;
|
||||
}
|
||||
}
|
||||
|
||||
void CRandomRewardObjectInfo::configureResetInfo(CRewardableObject * object, CRandomGenerator & rng, CRewardResetInfo & resetParameters, const JsonNode & source) const
|
||||
|
Reference in New Issue
Block a user