mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-19 19:10:20 +02:00
Merge branch 'develop' of https://github.com/vcmi/vcmi into RMG
This commit is contained in:
commit
a556ef64e9
@ -1,6 +1,7 @@
|
|||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include "AIUtility.h"
|
#include "AIUtility.h"
|
||||||
#include "VCAI.h"
|
#include "VCAI.h"
|
||||||
|
#include "Fuzzy.h"
|
||||||
|
|
||||||
#include "../../lib/UnlockGuard.h"
|
#include "../../lib/UnlockGuard.h"
|
||||||
#include "../../lib/CConfigHandler.h"
|
#include "../../lib/CConfigHandler.h"
|
||||||
|
@ -1,4 +1,2 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "../../Global.h"
|
#include "../../Global.h"
|
||||||
|
|
||||||
#include "Fuzzy.h"
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "StdInc.h"
|
#include "StdInc.h"
|
||||||
#include "VCAI.h"
|
#include "VCAI.h"
|
||||||
#include "Goals.h"
|
#include "Goals.h"
|
||||||
|
#include "Fuzzy.h"
|
||||||
|
|
||||||
#include "../../lib/UnlockGuard.h"
|
#include "../../lib/UnlockGuard.h"
|
||||||
#include "../../lib/mapObjects/MapObjects.h"
|
#include "../../lib/mapObjects/MapObjects.h"
|
||||||
#include "../../lib/CConfigHandler.h"
|
#include "../../lib/CConfigHandler.h"
|
||||||
|
@ -45,10 +45,8 @@ void CBank::initObj()
|
|||||||
|
|
||||||
std::string CBank::getHoverText(PlayerColor player) const
|
std::string CBank::getHoverText(PlayerColor player) const
|
||||||
{
|
{
|
||||||
// TODO: USE BANK_SPECIFIC NAMES
|
|
||||||
// TODO: record visited players
|
// TODO: record visited players
|
||||||
bool visited = (bc == nullptr);
|
return getObjectName() + " " + visitedTxt(bc == nullptr);
|
||||||
return visitedTxt(visited);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBank::setConfig(const BankConfig & config)
|
void CBank::setConfig(const BankConfig & config)
|
||||||
@ -128,8 +126,8 @@ void CBank::onHeroVisit (const CGHeroInstance * h) const
|
|||||||
bd.player = h->getOwner();
|
bd.player = h->getOwner();
|
||||||
bd.soundID = soundID;
|
bd.soundID = soundID;
|
||||||
bd.text.addTxt(MetaString::ADVOB_TXT, banktext);
|
bd.text.addTxt(MetaString::ADVOB_TXT, banktext);
|
||||||
//if (ID == Obj::CREATURE_BANK)
|
if (ID == Obj::CREATURE_BANK)
|
||||||
// bd.text.addReplacement(VLC->objh->creBanksNames[index]); // FIXME: USE BANK SPECIFIC NAMES
|
bd.text.addReplacement(getObjectName());
|
||||||
cb->showBlockingDialog (&bd);
|
cb->showBlockingDialog (&bd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -149,7 +147,7 @@ void CBank::onHeroVisit (const CGHeroInstance * h) const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
iw.text << VLC->generaltexth->advobtxt[33];// This was X, now is completely empty
|
iw.text << VLC->generaltexth->advobtxt[33];// This was X, now is completely empty
|
||||||
//iw.text.addReplacement(VLC->objh->creBanksNames[index]); // FIXME: USE BANK SPECIFIC NAMES
|
iw.text.addReplacement(getObjectName());
|
||||||
}
|
}
|
||||||
cb->showInfoDialog(&iw);
|
cb->showInfoDialog(&iw);
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,17 @@ std::vector<JsonNode> CObjectClassesHandler::loadLegacyData(size_t dataSize)
|
|||||||
ret[i]["name"].String() = namesParser.readString();
|
ret[i]["name"].String() = namesParser.readString();
|
||||||
namesParser.endLine();
|
namesParser.endLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CLegacyConfigParser cregen1Parser("data/crgen1");
|
||||||
|
do
|
||||||
|
customNames[Obj::CREATURE_GENERATOR1].push_back(cregen1Parser.readString());
|
||||||
|
while(cregen1Parser.endLine());
|
||||||
|
|
||||||
|
CLegacyConfigParser cregen4Parser("data/crgen4");
|
||||||
|
do
|
||||||
|
customNames[Obj::CREATURE_GENERATOR4].push_back(cregen4Parser.readString());
|
||||||
|
while(cregen4Parser.endLine());
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,12 +153,16 @@ void CObjectClassesHandler::loadObjectEntry(const JsonNode & entry, ObjectContai
|
|||||||
logGlobal->errorStream() << "Handler with name " << obj->handlerName << " was not found!";
|
logGlobal->errorStream() << "Handler with name " << obj->handlerName << " was not found!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto handler = handlerConstructors.at(obj->handlerName)();
|
|
||||||
handler->init(entry);
|
|
||||||
|
|
||||||
si32 id = selectNextID(entry["index"], obj->objects, 1000);
|
si32 id = selectNextID(entry["index"], obj->objects, 1000);
|
||||||
|
|
||||||
|
auto handler = handlerConstructors.at(obj->handlerName)();
|
||||||
handler->setType(obj->id, id);
|
handler->setType(obj->id, id);
|
||||||
|
|
||||||
|
if (customNames.count(obj->id) && customNames.at(obj->id).size() > id)
|
||||||
|
handler->init(entry, customNames.at(obj->id).at(id));
|
||||||
|
else
|
||||||
|
handler->init(entry);
|
||||||
|
|
||||||
if (handler->getTemplates().empty())
|
if (handler->getTemplates().empty())
|
||||||
{
|
{
|
||||||
auto range = legacyTemplates.equal_range(std::make_pair(obj->id, id));
|
auto range = legacyTemplates.equal_range(std::make_pair(obj->id, id));
|
||||||
@ -208,6 +223,7 @@ void CObjectClassesHandler::loadSubObject(std::string name, JsonNode config, si3
|
|||||||
std::string oldMeta = config.meta; // FIXME: move into inheritNode?
|
std::string oldMeta = config.meta; // FIXME: move into inheritNode?
|
||||||
JsonUtils::inherit(config, objects.at(ID)->base);
|
JsonUtils::inherit(config, objects.at(ID)->base);
|
||||||
config.setMeta(oldMeta);
|
config.setMeta(oldMeta);
|
||||||
|
|
||||||
loadObjectEntry(config, objects[ID]);
|
loadObjectEntry(config, objects[ID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,6 +306,17 @@ std::string CObjectClassesHandler::getObjectName(si32 type) const
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CObjectClassesHandler::getObjectName(si32 type, si32 subtype) const
|
||||||
|
{
|
||||||
|
if (knownSubObjects(type).count(subtype))
|
||||||
|
{
|
||||||
|
auto name = getHandlerFor(type, subtype)->getCustomName();
|
||||||
|
if (name)
|
||||||
|
return name.get();
|
||||||
|
}
|
||||||
|
return getObjectName(type);
|
||||||
|
}
|
||||||
|
|
||||||
void AObjectTypeHandler::setType(si32 type, si32 subtype)
|
void AObjectTypeHandler::setType(si32 type, si32 subtype)
|
||||||
{
|
{
|
||||||
this->type = type;
|
this->type = type;
|
||||||
@ -304,7 +331,7 @@ static ui32 loadJsonOrMax(const JsonNode & input)
|
|||||||
return input.Float();
|
return input.Float();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AObjectTypeHandler::init(const JsonNode & input)
|
void AObjectTypeHandler::init(const JsonNode & input, boost::optional<std::string> name)
|
||||||
{
|
{
|
||||||
base = input["base"];
|
base = input["base"];
|
||||||
|
|
||||||
@ -328,6 +355,12 @@ void AObjectTypeHandler::init(const JsonNode & input)
|
|||||||
tmpl.readJson(entry.second);
|
tmpl.readJson(entry.second);
|
||||||
templates.push_back(tmpl);
|
templates.push_back(tmpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (input["name"].isNull())
|
||||||
|
objectName = name;
|
||||||
|
else
|
||||||
|
objectName.reset(input["name"].String());
|
||||||
|
|
||||||
initTypeData(input);
|
initTypeData(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,6 +371,12 @@ bool AObjectTypeHandler::objectFilter(const CGObjectInstance *, const ObjectTemp
|
|||||||
|
|
||||||
void AObjectTypeHandler::initTypeData(const JsonNode & input)
|
void AObjectTypeHandler::initTypeData(const JsonNode & input)
|
||||||
{
|
{
|
||||||
|
// empty implementation for overrides
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::optional<std::string> AObjectTypeHandler::getCustomName() const
|
||||||
|
{
|
||||||
|
return objectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AObjectTypeHandler::addTemplate(ObjectTemplate templ)
|
void AObjectTypeHandler::addTemplate(ObjectTemplate templ)
|
||||||
|
@ -98,6 +98,9 @@ class DLL_LINKAGE AObjectTypeHandler : public boost::noncopyable
|
|||||||
{
|
{
|
||||||
RandomMapInfo rmgInfo;
|
RandomMapInfo rmgInfo;
|
||||||
|
|
||||||
|
/// Human-readable name of this object, used for objects like banks and dwellings, if set
|
||||||
|
boost::optional<std::string> objectName;
|
||||||
|
|
||||||
si32 type;
|
si32 type;
|
||||||
si32 subtype;
|
si32 subtype;
|
||||||
|
|
||||||
@ -116,7 +119,10 @@ public:
|
|||||||
void setType(si32 type, si32 subtype);
|
void setType(si32 type, si32 subtype);
|
||||||
|
|
||||||
/// loads generic data from Json structure and passes it towards type-specific constructors
|
/// loads generic data from Json structure and passes it towards type-specific constructors
|
||||||
void init(const JsonNode & input);
|
void init(const JsonNode & input, boost::optional<std::string> name = boost::optional<std::string>());
|
||||||
|
|
||||||
|
/// Returns object-specific name, if set
|
||||||
|
boost::optional<std::string> getCustomName() const;
|
||||||
|
|
||||||
void addTemplate(ObjectTemplate templ);
|
void addTemplate(ObjectTemplate templ);
|
||||||
void addTemplate(JsonNode config);
|
void addTemplate(JsonNode config);
|
||||||
@ -148,7 +154,7 @@ public:
|
|||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
h & type & subtype & templates & rmgInfo;
|
h & type & subtype & templates & rmgInfo & objectName;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -174,8 +180,6 @@ class DLL_LINKAGE CObjectClassesHandler : public IHandlerBase
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::multimap<std::pair<si32, si32>, ObjectTemplate> TTemplatesContainer;
|
|
||||||
|
|
||||||
/// list of object handlers, each of them handles only one type
|
/// list of object handlers, each of them handles only one type
|
||||||
std::map<si32, ObjectContainter * > objects;
|
std::map<si32, ObjectContainter * > objects;
|
||||||
|
|
||||||
@ -183,8 +187,13 @@ class DLL_LINKAGE CObjectClassesHandler : public IHandlerBase
|
|||||||
std::map<std::string, std::function<TObjectTypeHandler()> > handlerConstructors;
|
std::map<std::string, std::function<TObjectTypeHandler()> > handlerConstructors;
|
||||||
|
|
||||||
/// container with H3 templates, used only during loading, no need to serialize it
|
/// container with H3 templates, used only during loading, no need to serialize it
|
||||||
|
typedef std::multimap<std::pair<si32, si32>, ObjectTemplate> TTemplatesContainer;
|
||||||
TTemplatesContainer legacyTemplates;
|
TTemplatesContainer legacyTemplates;
|
||||||
|
|
||||||
|
/// contains list of custom names for H3 objects (e.g. Dwellings), used to load H3 data
|
||||||
|
/// format: customNames[primaryID][secondaryID] -> name
|
||||||
|
std::map<si32, std::vector<std::string>> customNames;
|
||||||
|
|
||||||
void loadObjectEntry(const JsonNode & entry, ObjectContainter * obj);
|
void loadObjectEntry(const JsonNode & entry, ObjectContainter * obj);
|
||||||
ObjectContainter * loadFromJson(const JsonNode & json);
|
ObjectContainter * loadFromJson(const JsonNode & json);
|
||||||
public:
|
public:
|
||||||
@ -211,6 +220,7 @@ public:
|
|||||||
TObjectTypeHandler getHandlerFor(si32 type, si32 subtype) const;
|
TObjectTypeHandler getHandlerFor(si32 type, si32 subtype) const;
|
||||||
|
|
||||||
std::string getObjectName(si32 type) const;
|
std::string getObjectName(si32 type) const;
|
||||||
|
std::string getObjectName(si32 type, si32 subtype) const;
|
||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h, const int version)
|
template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +263,7 @@ void CGObjectInstance::giveDummyBonus(ObjectInstanceID heroID, ui8 duration) con
|
|||||||
|
|
||||||
std::string CGObjectInstance::getObjectName() const
|
std::string CGObjectInstance::getObjectName() const
|
||||||
{
|
{
|
||||||
return VLC->objtypeh->getObjectName(ID);
|
return VLC->objtypeh->getObjectName(ID, subID);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CGObjectInstance::getHoverText(PlayerColor player) const
|
std::string CGObjectInstance::getHoverText(PlayerColor player) const
|
||||||
|
@ -76,7 +76,8 @@ std::vector<ui32> CRewardableObject::getAvailableRewards(const CGHeroInstance *
|
|||||||
{
|
{
|
||||||
const CVisitInfo & visit = info[i];
|
const CVisitInfo & visit = info[i];
|
||||||
|
|
||||||
if (visit.numOfGrants < visit.limiter.numOfGrants && visit.limiter.heroAllowed(hero))
|
if ((visit.limiter.numOfGrants == 0 || visit.numOfGrants < visit.limiter.numOfGrants) // reward has unlimited uses or some are still available
|
||||||
|
&& visit.limiter.heroAllowed(hero))
|
||||||
{
|
{
|
||||||
logGlobal->debugStream() << "Reward " << i << " is allowed";
|
logGlobal->debugStream() << "Reward " << i << " is allowed";
|
||||||
ret.push_back(i);
|
ret.push_back(i);
|
||||||
@ -183,7 +184,6 @@ void CRewardableObject::blockingDialogAnswered(const CGHeroInstance *hero, ui32
|
|||||||
|
|
||||||
if (answer > 0 && answer-1 < info.size())
|
if (answer > 0 && answer-1 < info.size())
|
||||||
{
|
{
|
||||||
//NOTE: this relies on assumption that there won't be any changes in player/hero during blocking dialog
|
|
||||||
auto list = getAvailableRewards(hero);
|
auto list = getAvailableRewards(hero);
|
||||||
grantReward(list[answer - 1], hero);
|
grantReward(list[answer - 1], hero);
|
||||||
}
|
}
|
||||||
@ -270,7 +270,10 @@ void CRewardableObject::grantRewardAfterLevelup(const CVisitInfo & info, const C
|
|||||||
|
|
||||||
for (const Bonus & bonus : info.reward.bonuses)
|
for (const Bonus & bonus : info.reward.bonuses)
|
||||||
{
|
{
|
||||||
|
assert(bonus.source == Bonus::OBJECT);
|
||||||
|
assert(bonus.sid == ID);
|
||||||
GiveBonus gb;
|
GiveBonus gb;
|
||||||
|
gb.who = GiveBonus::HERO;
|
||||||
gb.bonus = bonus;
|
gb.bonus = bonus;
|
||||||
gb.id = hero->id.getNum();
|
gb.id = hero->id.getNum();
|
||||||
cb->giveHeroBonus(&gb);
|
cb->giveHeroBonus(&gb);
|
||||||
@ -306,7 +309,7 @@ bool CRewardableObject::wasVisited (PlayerColor player) const
|
|||||||
{
|
{
|
||||||
case VISIT_UNLIMITED:
|
case VISIT_UNLIMITED:
|
||||||
return false;
|
return false;
|
||||||
case VISIT_ONCE:
|
case VISIT_ONCE: // FIXME: hide this info deeper and return same as player?
|
||||||
for (auto & visit : info)
|
for (auto & visit : info)
|
||||||
{
|
{
|
||||||
if (visit.numOfGrants != 0)
|
if (visit.numOfGrants != 0)
|
||||||
@ -315,7 +318,7 @@ bool CRewardableObject::wasVisited (PlayerColor player) const
|
|||||||
case VISIT_HERO:
|
case VISIT_HERO:
|
||||||
return false;
|
return false;
|
||||||
case VISIT_PLAYER:
|
case VISIT_PLAYER:
|
||||||
return vstd::contains(cb->getPlayer(player)->visitedObjects, ObjectInstanceID(ID));
|
return vstd::contains(cb->getPlayer(player)->visitedObjects, ObjectInstanceID(id));
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -325,8 +328,10 @@ bool CRewardableObject::wasVisited (const CGHeroInstance * h) const
|
|||||||
{
|
{
|
||||||
switch (visitMode)
|
switch (visitMode)
|
||||||
{
|
{
|
||||||
|
case VISIT_UNLIMITED:
|
||||||
|
return h->hasBonusFrom(Bonus::OBJECT, ID);
|
||||||
case VISIT_HERO:
|
case VISIT_HERO:
|
||||||
return vstd::contains(h->visitedObjects, ObjectInstanceID(ID)) || h->hasBonusFrom(Bonus::OBJECT, ID);
|
return h->visitedObjects.count(ObjectInstanceID(id));
|
||||||
default:
|
default:
|
||||||
return wasVisited(h->tempOwner);
|
return wasVisited(h->tempOwner);
|
||||||
}
|
}
|
||||||
@ -337,12 +342,6 @@ void CRewardInfo::loadComponents(std::vector<Component> & comps) const
|
|||||||
for (auto comp : extraComponents)
|
for (auto comp : extraComponents)
|
||||||
comps.push_back(comp);
|
comps.push_back(comp);
|
||||||
|
|
||||||
for (size_t i=0; i<resources.size(); i++)
|
|
||||||
{
|
|
||||||
if (resources[i] !=0)
|
|
||||||
comps.push_back(Component(Component::RESOURCE, i, resources[i], 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gainedExp) comps.push_back(Component(Component::EXPERIENCE, 0, gainedExp, 0));
|
if (gainedExp) comps.push_back(Component(Component::EXPERIENCE, 0, gainedExp, 0));
|
||||||
if (gainedLevels) comps.push_back(Component(Component::EXPERIENCE, 0, gainedLevels, 0));
|
if (gainedLevels) comps.push_back(Component(Component::EXPERIENCE, 0, gainedLevels, 0));
|
||||||
|
|
||||||
@ -365,6 +364,12 @@ void CRewardInfo::loadComponents(std::vector<Component> & comps) const
|
|||||||
|
|
||||||
for (auto & entry : creatures)
|
for (auto & entry : creatures)
|
||||||
comps.push_back(Component(Component::CREATURE, entry.type->idNumber, entry.count, 0));
|
comps.push_back(Component(Component::CREATURE, entry.type->idNumber, entry.count, 0));
|
||||||
|
|
||||||
|
for (size_t i=0; i<resources.size(); i++)
|
||||||
|
{
|
||||||
|
if (resources[i] !=0)
|
||||||
|
comps.push_back(Component(Component::RESOURCE, i, resources[i], 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component CRewardInfo::getDisplayedComponent() const
|
Component CRewardInfo::getDisplayedComponent() const
|
||||||
@ -464,7 +469,7 @@ void CGPickable::initObj()
|
|||||||
blockVisit = true;
|
blockVisit = true;
|
||||||
switch(ID)
|
switch(ID)
|
||||||
{
|
{
|
||||||
case Obj::CAMPFIRE: //FIXME: campfire is not functioning correctly in game (no visible message)
|
case Obj::CAMPFIRE:
|
||||||
{
|
{
|
||||||
soundID = soundBase::experience;
|
soundID = soundBase::experience;
|
||||||
int givenRes = cb->gameState()->getRandomGenerator().nextInt(5);
|
int givenRes = cb->gameState()->getRandomGenerator().nextInt(5);
|
||||||
@ -658,8 +663,10 @@ void CGBonusingObject::initObj()
|
|||||||
for (int i=0; i<5; i++)
|
for (int i=0; i<5; i++)
|
||||||
{
|
{
|
||||||
configureBonus(info[i], Bonus::LUCK, i-1, 69); //NOTE: description have %d that should be replaced with value
|
configureBonus(info[i], Bonus::LUCK, i-1, 69); //NOTE: description have %d that should be replaced with value
|
||||||
configureMessage(info[i], 55, 56, soundBase::LUCK);
|
info[i].message.addTxt(MetaString::ADVOB_TXT, 55);
|
||||||
|
soundID = soundBase::LUCK;
|
||||||
}
|
}
|
||||||
|
onVisited.addTxt(MetaString::ADVOB_TXT, 56);
|
||||||
break;
|
break;
|
||||||
case Obj::IDOL_OF_FORTUNE:
|
case Obj::IDOL_OF_FORTUNE:
|
||||||
|
|
||||||
@ -668,8 +675,10 @@ void CGBonusingObject::initObj()
|
|||||||
{
|
{
|
||||||
info[i].limiter.dayOfWeek = i+1;
|
info[i].limiter.dayOfWeek = i+1;
|
||||||
configureBonus(info[i], i%2 ? Bonus::MORALE : Bonus::LUCK, 1, 68);
|
configureBonus(info[i], i%2 ? Bonus::MORALE : Bonus::LUCK, 1, 68);
|
||||||
configureMessage(info[i], 62, 63, soundBase::experience);
|
info[i].message.addTxt(MetaString::ADVOB_TXT, 62);
|
||||||
|
soundID = soundBase::experience;
|
||||||
}
|
}
|
||||||
|
onVisited.addTxt(MetaString::ADVOB_TXT, 63);
|
||||||
info.back().limiter.dayOfWeek = 7;
|
info.back().limiter.dayOfWeek = 7;
|
||||||
configureBonus(info.back(), Bonus::MORALE, 1, 68); // on last day of week
|
configureBonus(info.back(), Bonus::MORALE, 1, 68); // on last day of week
|
||||||
configureBonus(info.back(), Bonus::LUCK, 1, 68);
|
configureBonus(info.back(), Bonus::LUCK, 1, 68);
|
||||||
@ -698,8 +707,10 @@ void CGBonusingObject::initObj()
|
|||||||
configureBonus(info[0], Bonus::MORALE, 2, 96);
|
configureBonus(info[0], Bonus::MORALE, 2, 96);
|
||||||
configureBonus(info[1], Bonus::MORALE, 1, 97);
|
configureBonus(info[1], Bonus::MORALE, 1, 97);
|
||||||
|
|
||||||
configureMessage(info[0], 140, 141, soundBase::temple);
|
info[0].message.addTxt(MetaString::ADVOB_TXT, 140);
|
||||||
configureMessage(info[1], 140, 141, soundBase::temple);
|
info[1].message.addTxt(MetaString::ADVOB_TXT, 140);
|
||||||
|
onVisited.addTxt(MetaString::ADVOB_TXT, 141);
|
||||||
|
soundID = soundBase::temple;
|
||||||
break;
|
break;
|
||||||
case Obj::WATERING_HOLE:
|
case Obj::WATERING_HOLE:
|
||||||
configureMessage(info[0], 166, 167, soundBase::MORALE);
|
configureMessage(info[0], 166, 167, soundBase::MORALE);
|
||||||
@ -924,6 +935,8 @@ void CGVisitableOPH::initObj()
|
|||||||
info.resize(2);
|
info.resize(2);
|
||||||
info[0].reward.primary[PrimarySkill::SPELL_POWER] = 1;
|
info[0].reward.primary[PrimarySkill::SPELL_POWER] = 1;
|
||||||
info[1].reward.primary[PrimarySkill::KNOWLEDGE] = 1;
|
info[1].reward.primary[PrimarySkill::KNOWLEDGE] = 1;
|
||||||
|
info[0].reward.resources[Res::GOLD] = -1000;
|
||||||
|
info[1].reward.resources[Res::GOLD] = -1000;
|
||||||
onSelect.addTxt(MetaString::ADVOB_TXT, 71);
|
onSelect.addTxt(MetaString::ADVOB_TXT, 71);
|
||||||
onVisited.addTxt(MetaString::ADVOB_TXT, 72);
|
onVisited.addTxt(MetaString::ADVOB_TXT, 72);
|
||||||
onEmpty.addTxt(MetaString::ADVOB_TXT, 73);
|
onEmpty.addTxt(MetaString::ADVOB_TXT, 73);
|
||||||
@ -934,6 +947,8 @@ void CGVisitableOPH::initObj()
|
|||||||
info.resize(2);
|
info.resize(2);
|
||||||
info[0].reward.primary[PrimarySkill::ATTACK] = 1;
|
info[0].reward.primary[PrimarySkill::ATTACK] = 1;
|
||||||
info[1].reward.primary[PrimarySkill::DEFENSE] = 1;
|
info[1].reward.primary[PrimarySkill::DEFENSE] = 1;
|
||||||
|
info[0].reward.resources[Res::GOLD] = -1000;
|
||||||
|
info[1].reward.resources[Res::GOLD] = -1000;
|
||||||
onSelect.addTxt(MetaString::ADVOB_TXT, 158);
|
onSelect.addTxt(MetaString::ADVOB_TXT, 158);
|
||||||
onVisited.addTxt(MetaString::ADVOB_TXT, 159);
|
onVisited.addTxt(MetaString::ADVOB_TXT, 159);
|
||||||
onEmpty.addTxt(MetaString::ADVOB_TXT, 160);
|
onEmpty.addTxt(MetaString::ADVOB_TXT, 160);
|
||||||
|
@ -48,7 +48,7 @@ public:
|
|||||||
std::vector<CStackBasicDescriptor> creatures;
|
std::vector<CStackBasicDescriptor> creatures;
|
||||||
|
|
||||||
CRewardLimiter():
|
CRewardLimiter():
|
||||||
numOfGrants(1),
|
numOfGrants(0),
|
||||||
dayOfWeek(0),
|
dayOfWeek(0),
|
||||||
minLevel(0),
|
minLevel(0),
|
||||||
primary(4, 0)
|
primary(4, 0)
|
||||||
|
@ -195,8 +195,11 @@ void CDwellingInstanceConstructor::configureObject(CGObjectInstance * object, CR
|
|||||||
|
|
||||||
if (guards.getType() == JsonNode::DATA_BOOL)
|
if (guards.getType() == JsonNode::DATA_BOOL)
|
||||||
{
|
{
|
||||||
const CCreature * crea = availableCreatures.at(0).at(0);
|
if (guards.Bool())
|
||||||
dwelling->putStack(SlotID(0), new CStackInstance(crea->idNumber, crea->growth * 3 ));
|
{
|
||||||
|
const CCreature * crea = availableCreatures.at(0).at(0);
|
||||||
|
dwelling->putStack(SlotID(0), new CStackInstance(crea->idNumber, crea->growth * 3 ));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else for (auto & stack : JsonRandom::loadCreatures(guards, rng))
|
else for (auto & stack : JsonRandom::loadCreatures(guards, rng))
|
||||||
{
|
{
|
||||||
|
@ -1061,7 +1061,7 @@ void CGObservatory::onHeroVisit( const CGHeroInstance * h ) const
|
|||||||
case Obj::COVER_OF_DARKNESS:
|
case Obj::COVER_OF_DARKNESS:
|
||||||
{
|
{
|
||||||
iw.text.addTxt (MetaString::ADVOB_TXT, 31);
|
iw.text.addTxt (MetaString::ADVOB_TXT, 31);
|
||||||
for (auto player : cb->gameState()->players)
|
for (auto & player : cb->gameState()->players)
|
||||||
{
|
{
|
||||||
if (cb->getPlayerStatus(player.first) == EPlayerStatus::INGAME &&
|
if (cb->getPlayerStatus(player.first) == EPlayerStatus::INGAME &&
|
||||||
cb->getPlayerRelations(player.first, h->tempOwner) == PlayerRelations::ENEMIES)
|
cb->getPlayerRelations(player.first, h->tempOwner) == PlayerRelations::ENEMIES)
|
||||||
|
@ -1351,7 +1351,7 @@ void CGameHandler::newTurn()
|
|||||||
}
|
}
|
||||||
if (t->hasBonusOfType (Bonus::DARKNESS))
|
if (t->hasBonusOfType (Bonus::DARKNESS))
|
||||||
{
|
{
|
||||||
for (auto player : gameState()->players)
|
for (auto & player : gameState()->players)
|
||||||
{
|
{
|
||||||
if (getPlayerStatus(player.first) == EPlayerStatus::INGAME &&
|
if (getPlayerStatus(player.first) == EPlayerStatus::INGAME &&
|
||||||
getPlayerRelations(player.first, t->tempOwner) == PlayerRelations::ENEMIES)
|
getPlayerRelations(player.first, t->tempOwner) == PlayerRelations::ENEMIES)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user