mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
Entities redesign and a few ERM features
* Made most Handlers derived from CHandlerBase and moved service API there. * Declared existing Entity APIs. * Added basic script context caching * Started Lua script module * Started Lua spell effect API * Started script state persistence * Started battle info callback binding * CommitPackage removed * Extracted spells::Caster to own header; Expanded Spell API. * implemented !!MC:S, !!FU:E, !!FU:P, !!MA, !!VR:H, !!VR:C * !!BU:C, !!BU:E, !!BU:G, !!BU:M implemented * Allow use of "MC:S@varName@" to declare normal variable (technically v-variable with string key) * Re-enabled VERM macros. * !?GM0 added * !?TM implemented * Added !!MF:N * Started !?OB, !!BM, !!HE, !!OW, !!UN * Added basic support of w-variables * Added support for ERM indirect variables * Made !?FU regular trigger * !!re (ERA loop receiver) implemented * Fixed ERM receivers with zero args.
This commit is contained in:
@ -94,7 +94,7 @@ namespace JsonRandom
|
||||
|
||||
return VLC->arth->pickRandomArtifact(rng, [=](ArtifactID artID) -> bool
|
||||
{
|
||||
CArtifact * art = VLC->arth->artifacts[artID];
|
||||
CArtifact * art = VLC->arth->objects[artID];
|
||||
|
||||
if (!vstd::iswithin(art->price, minValue, maxValue))
|
||||
return false;
|
||||
@ -158,13 +158,13 @@ namespace JsonRandom
|
||||
CStackBasicDescriptor loadCreature(const JsonNode & value, CRandomGenerator & rng)
|
||||
{
|
||||
CStackBasicDescriptor stack;
|
||||
stack.type = VLC->creh->creatures[VLC->modh->identifiers.getIdentifier("creature", value["type"]).get()];
|
||||
stack.type = VLC->creh->objects[VLC->modh->identifiers.getIdentifier("creature", value["type"]).get()];
|
||||
stack.count = loadValue(value, rng);
|
||||
if (!value["upgradeChance"].isNull() && !stack.type->upgrades.empty())
|
||||
{
|
||||
if (int(value["upgradeChance"].Float()) > rng.nextInt(99)) // select random upgrade
|
||||
{
|
||||
stack.type = VLC->creh->creatures[*RandomGeneratorUtil::nextItem(stack.type->upgrades, rng)];
|
||||
stack.type = VLC->creh->objects[*RandomGeneratorUtil::nextItem(stack.type->upgrades, rng)];
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
@ -194,12 +194,12 @@ namespace JsonRandom
|
||||
info.minAmount = static_cast<si32>(node["min"].Float());
|
||||
info.maxAmount = static_cast<si32>(node["max"].Float());
|
||||
}
|
||||
const CCreature * crea = VLC->creh->creatures[VLC->modh->identifiers.getIdentifier("creature", node["type"]).get()];
|
||||
const CCreature * crea = VLC->creh->objects[VLC->modh->identifiers.getIdentifier("creature", node["type"]).get()];
|
||||
info.allowedCreatures.push_back(crea);
|
||||
if (node["upgradeChance"].Float() > 0)
|
||||
{
|
||||
for (auto creaID : crea->upgrades)
|
||||
info.allowedCreatures.push_back(VLC->creh->creatures[creaID]);
|
||||
info.allowedCreatures.push_back(VLC->creh->objects[creaID]);
|
||||
}
|
||||
ret.push_back(info);
|
||||
}
|
||||
|
Reference in New Issue
Block a user