mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-21 00:19:29 +02:00
Implemented configurable blacksmith. Deprecated ballistaYard type
This commit is contained in:
@ -686,6 +686,12 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
|
||||
logGlobal->trace("You've clicked on %d", (int)building.toEnum());
|
||||
const CBuilding *b = town->town->buildings.find(building)->second;
|
||||
|
||||
if (town->getWarMachineInBuilding(building).hasValue())
|
||||
{
|
||||
enterBlacksmith(building, town->getWarMachineInBuilding(building));
|
||||
return;
|
||||
}
|
||||
|
||||
if (building >= BuildingID::DWELL_FIRST)
|
||||
{
|
||||
enterDwelling((BuildingID::getLevelFromDwelling(building)));
|
||||
@ -734,10 +740,6 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
|
||||
enterBuilding(building);
|
||||
break;
|
||||
|
||||
case BuildingID::BLACKSMITH:
|
||||
enterBlacksmith(town->town->warMachine);
|
||||
break;
|
||||
|
||||
case BuildingID::SHIP:
|
||||
LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[51]); //Cannot build another boat
|
||||
break;
|
||||
@ -799,10 +801,6 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
|
||||
enterDwelling(town->town->creatures.size());
|
||||
break;
|
||||
|
||||
case BuildingSubID::BALLISTA_YARD:
|
||||
enterBlacksmith(ArtifactID::BALLISTA);
|
||||
break;
|
||||
|
||||
case BuildingSubID::THIEVES_GUILD:
|
||||
enterAnyThievesGuild();
|
||||
break;
|
||||
@ -827,12 +825,12 @@ void CCastleBuildings::buildingClicked(BuildingID building, BuildingSubID::EBuil
|
||||
}
|
||||
}
|
||||
|
||||
void CCastleBuildings::enterBlacksmith(ArtifactID artifactID)
|
||||
void CCastleBuildings::enterBlacksmith(BuildingID building, ArtifactID artifactID)
|
||||
{
|
||||
const CGHeroInstance *hero = town->visitingHero;
|
||||
if(!hero)
|
||||
{
|
||||
LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[273]) % town->town->buildings.find(BuildingID::BLACKSMITH)->second->getNameTranslated()));
|
||||
LOCPLINT->showInfoDialog(boost::str(boost::format(CGI->generaltexth->allTexts[273]) % town->town->buildings.find(building)->second->getNameTranslated()));
|
||||
return;
|
||||
}
|
||||
auto art = artifactID.toArtifact();
|
||||
@ -854,8 +852,9 @@ void CCastleBuildings::enterBlacksmith(ArtifactID artifactID)
|
||||
}
|
||||
}
|
||||
}
|
||||
CreatureID cre = art->getWarMachine();
|
||||
GH.windows().createAndPushWindow<CBlacksmithDialog>(possible, cre, artifactID, hero->id);
|
||||
|
||||
CreatureID creatureID = artifactID.toArtifact()->getWarMachine();
|
||||
GH.windows().createAndPushWindow<CBlacksmithDialog>(possible, creatureID, artifactID, hero->id);
|
||||
}
|
||||
|
||||
void CCastleBuildings::enterBuilding(BuildingID building)
|
||||
|
@ -150,7 +150,7 @@ class CCastleBuildings : public CIntObject
|
||||
|
||||
const CGHeroInstance* getHero();//Select hero for buildings usage
|
||||
|
||||
void enterBlacksmith(ArtifactID artifactID);//support for blacksmith + ballista yard
|
||||
void enterBlacksmith(BuildingID building, ArtifactID artifactID);//support for blacksmith + ballista yard
|
||||
void enterBuilding(BuildingID building);//for buildings with simple description + pic left-click messages
|
||||
void enterCastleGate();
|
||||
void enterFountain(const BuildingID & building, BuildingSubID::EBuildingSubID subID, BuildingID upgrades);//Rampart's fountains
|
||||
|
@ -198,5 +198,10 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
// Section 3 - buildings that now have dedicated mechanics
|
||||
"ballistaYard": {
|
||||
"blacksmith" : "ballista"
|
||||
}
|
||||
}
|
@ -147,7 +147,6 @@
|
||||
],
|
||||
"horde" : [ 2, -1 ],
|
||||
"mageGuild" : 4,
|
||||
"warMachine" : "ballista",
|
||||
"moatAbility" : "castleMoat",
|
||||
// primaryResource not specified so town get both Wood and Ore for resource bonus
|
||||
|
||||
@ -168,7 +167,7 @@
|
||||
"capitol": { },
|
||||
"marketplace": { "marketModes" : ["resource-resource", "resource-player"] },
|
||||
"resourceSilo": { "produce": { "ore": 1, "wood": 1 } },
|
||||
"blacksmith": { },
|
||||
"blacksmith": { "warMachine" : "ballista" },
|
||||
|
||||
"special1": {
|
||||
"bonuses": [
|
||||
|
@ -152,7 +152,6 @@
|
||||
"horde" : [ 0, -1 ],
|
||||
"mageGuild" : 5,
|
||||
"primaryResource" : "mercury",
|
||||
"warMachine" : "ballista",
|
||||
"moatAbility" : "castleMoat",
|
||||
|
||||
"buildings" :
|
||||
@ -173,7 +172,7 @@
|
||||
"capitol": { },
|
||||
"marketplace": { "marketModes" : ["resource-resource", "resource-player"] },
|
||||
"resourceSilo": { "produce": { "mercury": 1 } },
|
||||
"blacksmith": { },
|
||||
"blacksmith": { "warMachine" : "ballista" },
|
||||
|
||||
"special1": { "type" : "artifactMerchant", "requires" : [ "marketplace" ], "marketModes" : ["resource-artifact", "artifact-resource"] },
|
||||
"horde1": { "id" : 18, "upgrades" : "dwellingLvl1" },
|
||||
|
@ -148,10 +148,8 @@
|
||||
"horde" : [ 0, -1 ],
|
||||
"mageGuild" : 5,
|
||||
"primaryResource" : "sulfur",
|
||||
"warMachine" : "ballista",
|
||||
"moatAbility" : "dungeonMoat",
|
||||
|
||||
|
||||
"buildings" :
|
||||
{
|
||||
"mageGuild1": { },
|
||||
@ -169,7 +167,7 @@
|
||||
"capitol": { },
|
||||
"marketplace": { "marketModes" : ["resource-resource", "resource-player"] },
|
||||
"resourceSilo": { "produce": { "sulfur": 1 } },
|
||||
"blacksmith": { },
|
||||
"blacksmith": { "warMachine" : "ballista" },
|
||||
|
||||
"special1": { "type" : "artifactMerchant", "requires" : [ "marketplace" ], "marketModes" : ["resource-artifact", "artifact-resource"] },
|
||||
"horde1": { "id" : 18, "upgrades" : "dwellingLvl1" },
|
||||
|
@ -147,7 +147,6 @@
|
||||
],
|
||||
"horde" : [ 0, -1 ],
|
||||
"mageGuild" : 3,
|
||||
"warMachine" : "firstAidTent",
|
||||
"moatAbility" : "fortressMoat",
|
||||
// primaryResource not specified so town get both Wood and Ore for resource bonus
|
||||
|
||||
@ -167,7 +166,7 @@
|
||||
"capitol": { },
|
||||
"marketplace": { "marketModes" : ["resource-resource", "resource-player"] },
|
||||
"resourceSilo": { "produce": { "wood": 1, "ore": 1 } },
|
||||
"blacksmith": { },
|
||||
"blacksmith": { "warMachine" : "firstAidTent" },
|
||||
|
||||
"special1": {
|
||||
"requires" : [ "allOf", [ "townHall" ], [ "special2" ] ],
|
||||
|
@ -149,7 +149,6 @@
|
||||
"horde" : [ 0, 2 ],
|
||||
"mageGuild" : 5,
|
||||
"primaryResource" : "mercury",
|
||||
"warMachine" : "ammoCart",
|
||||
"moatAbility" : "infernoMoat",
|
||||
|
||||
"buildings" :
|
||||
@ -169,7 +168,7 @@
|
||||
"capitol": { },
|
||||
"marketplace": { "marketModes" : ["resource-resource", "resource-player"] },
|
||||
"resourceSilo": { "produce": { "mercury": 1 } },
|
||||
"blacksmith": { },
|
||||
"blacksmith": { "warMachine" : "ammoCart" },
|
||||
|
||||
"horde1": { "id" : 18, "upgrades" : "dwellingLvl1" },
|
||||
"horde1Upgr": { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },
|
||||
|
@ -152,7 +152,6 @@
|
||||
],
|
||||
"horde" : [ 0, -1 ],
|
||||
"mageGuild" : 5,
|
||||
"warMachine" : "firstAidTent",
|
||||
"moatAbility" : "necropolisMoat",
|
||||
// primaryResource not specified so town get both Wood and Ore for resource bonus
|
||||
|
||||
@ -174,7 +173,7 @@
|
||||
"capitol": { },
|
||||
"marketplace": { "marketModes" : ["resource-resource", "resource-player"] },
|
||||
"resourceSilo": { "produce": { "ore": 1, "wood": 1 } },
|
||||
"blacksmith": { },
|
||||
"blacksmith": { "warMachine" : "firstAidTent" },
|
||||
|
||||
"special1": { "requires" : [ "fort" ], "bonuses": [ { "type": "DARKNESS", "val": 20 } ] },
|
||||
"horde1": { "id" : 18, "upgrades" : "dwellingLvl1", "requires" : [ "special3" ] },
|
||||
|
@ -152,7 +152,6 @@
|
||||
"horde" : [ 1, 4 ],
|
||||
"mageGuild" : 5,
|
||||
"primaryResource" : "crystal",
|
||||
"warMachine" : "firstAidTent",
|
||||
"moatAbility" : "rampartMoat",
|
||||
|
||||
"buildings" :
|
||||
@ -172,7 +171,7 @@
|
||||
"capitol": { },
|
||||
"marketplace": { "marketModes" : ["resource-resource", "resource-player"] },
|
||||
"resourceSilo": { "produce": { "crystal": 1 } },
|
||||
"blacksmith": { },
|
||||
"blacksmith": { "warMachine" : "firstAidTent" },
|
||||
|
||||
"special1": { "type" : "mysticPond" },
|
||||
"horde1": { "id" : 18, "upgrades" : "dwellingLvl2" },
|
||||
|
@ -145,7 +145,6 @@
|
||||
],
|
||||
"horde" : [ 0, -1 ],
|
||||
"mageGuild" : 3,
|
||||
"warMachine" : "ammoCart",
|
||||
"moatAbility" : "strongholdMoat",
|
||||
// primaryResource not specified so town get both Wood and Ore for resource bonus
|
||||
|
||||
@ -164,13 +163,13 @@
|
||||
"capitol": { },
|
||||
"marketplace": { "marketModes" : ["resource-resource", "resource-player"] },
|
||||
"resourceSilo": { "produce": { "ore": 1, "wood": 1 } },
|
||||
"blacksmith": { },
|
||||
"blacksmith": { "warMachine" : "ammoCart" },
|
||||
|
||||
"special1": { "type" : "escapeTunnel", "requires" : [ "fort" ] },
|
||||
"horde1": { "id" : 18, "upgrades" : "dwellingLvl1" },
|
||||
"horde1Upgr": { "id" : 19, "upgrades" : "dwellingUpLvl1", "requires" : [ "horde1" ], "mode" : "auto" },
|
||||
"special2": { "type" : "freelancersGuild", "requires" : [ "marketplace" ], "marketModes" : ["creature-resource"] },
|
||||
"special3": { "type" : "ballistaYard", "requires" : [ "blacksmith" ] },
|
||||
"special3": { "warMachine" : "ballista", "requires" : [ "blacksmith" ] },
|
||||
"special4": {
|
||||
"requires" : [ "fort" ],
|
||||
"configuration" : {
|
||||
|
@ -147,7 +147,6 @@
|
||||
"horde" : [ 1, -1 ],
|
||||
"primaryResource" : "gems",
|
||||
"mageGuild" : 5,
|
||||
"warMachine" : "ammoCart",
|
||||
"moatAbility" : "towerMoat",
|
||||
|
||||
"buildings" :
|
||||
@ -167,7 +166,7 @@
|
||||
"capitol": { },
|
||||
"marketplace": { "marketModes" : ["resource-resource", "resource-player"] },
|
||||
"resourceSilo": { "produce" : { "gems": 1 } },
|
||||
"blacksmith": { },
|
||||
"blacksmith": { "warMachine" : "ammoCart" },
|
||||
|
||||
"special1": { "type" : "artifactMerchant", "requires" : [ "marketplace" ], "marketModes" : ["resource-artifact", "artifact-resource"] },
|
||||
"horde1": { "id" : 18, "upgrades" : "dwellingLvl2" },
|
||||
|
@ -89,7 +89,7 @@
|
||||
"additionalProperties" : false,
|
||||
"required" : [
|
||||
"mapObject", "buildingsIcons", "buildings", "creatures", "guildWindow", "names",
|
||||
"hallBackground", "hallSlots", "horde", "mageGuild", "moatAbility", "defaultTavern", "tavernVideo", "guildBackground", "musicTheme", "siege", "structures", "townBackground", "warMachine"
|
||||
"hallBackground", "hallSlots", "horde", "mageGuild", "moatAbility", "defaultTavern", "tavernVideo", "guildBackground", "musicTheme", "siege", "structures", "townBackground"
|
||||
],
|
||||
"description" : "town",
|
||||
"properties" : {
|
||||
@ -133,10 +133,6 @@
|
||||
"type" : "string",
|
||||
"description" : "Primary resource for this town. Produced by Silo and offered as starting bonus"
|
||||
},
|
||||
"warMachine" : {
|
||||
"type" : "string",
|
||||
"description" : "Identifier of war machine produced by blacksmith in town"
|
||||
},
|
||||
"horde" : {
|
||||
"type" : "array",
|
||||
"maxItems" : 2,
|
||||
|
@ -36,7 +36,7 @@
|
||||
},
|
||||
"type" : {
|
||||
"type" : "string",
|
||||
"enum" : [ "mysticPond", "artifactMerchant", "freelancersGuild", "magicUniversity", "castleGate", "creatureTransformer", "portalOfSummoning", "ballistaYard", "library", "escapeTunnel", "treasury", "thievesGuild", "bank" ],
|
||||
"enum" : [ "mysticPond", "artifactMerchant", "freelancersGuild", "magicUniversity", "castleGate", "creatureTransformer", "portalOfSummoning", "library", "escapeTunnel", "treasury", "thievesGuild", "bank" ],
|
||||
"description" : "Subtype for some special buildings"
|
||||
},
|
||||
"mode" : {
|
||||
@ -93,6 +93,10 @@
|
||||
"gems" : { "type" : "number"}
|
||||
}
|
||||
},
|
||||
"warMachine" : {
|
||||
"type" : "string",
|
||||
"description" : "Artifact ID of a war machine that can be purchased in this building, if any"
|
||||
},
|
||||
"bonuses" : {
|
||||
"type" : "array",
|
||||
"description" : "Bonuses that are provided by this building in any town where this building has been built. Only affects town itself (including siege), to propagate effect to player or team please use bonus propagators",
|
||||
|
@ -247,9 +247,6 @@ Each town requires a set of buildings (Around 30-45 buildings)
|
||||
// maximum level of mage guild
|
||||
"mageGuild" : 4,
|
||||
|
||||
// war machine produced in town
|
||||
"warMachine" : "ballista"
|
||||
|
||||
// Identifier of spell that will create effects for town moat during siege
|
||||
"moatAbility" : "castleMoat"
|
||||
}
|
||||
|
@ -136,6 +136,9 @@ These are just a couple of examples of what can be done in VCMI. See vcmi config
|
||||
"gold" : 10000
|
||||
},
|
||||
|
||||
// Artifact ID of a war machine produced in this town building, if any
|
||||
"warMachine" : "ballista",
|
||||
|
||||
// Allows to define additional functionality of this building, usually using logic of one of original H3 town building
|
||||
// Generally only needs to be specified for "special" buildings
|
||||
// See 'List of unique town buildings' section below for detailed description of this field
|
||||
|
@ -460,7 +460,7 @@ std::shared_ptr<CArtifact> CArtHandler::loadFromJson(const std::string & scope,
|
||||
}
|
||||
|
||||
const JsonNode & warMachine = node["warMachine"];
|
||||
if(warMachine.getType() == JsonNode::JsonType::DATA_STRING && !warMachine.String().empty())
|
||||
if(!warMachine.isNull())
|
||||
{
|
||||
VLC->identifiers()->requestIdentifier("creature", warMachine, [=](si32 id)
|
||||
{
|
||||
|
@ -34,7 +34,6 @@ namespace BuildingSubID
|
||||
PORTAL_OF_SUMMONING,
|
||||
ESCAPE_TUNNEL,
|
||||
FREELANCERS_GUILD,
|
||||
BALLISTA_YARD,
|
||||
MAGIC_UNIVERSITY,
|
||||
TREASURY,
|
||||
THIEVES_GUILD,
|
||||
|
@ -184,7 +184,6 @@ namespace MappedKeys
|
||||
{ "castleGate", BuildingSubID::CASTLE_GATE },
|
||||
{ "creatureTransformer", BuildingSubID::CREATURE_TRANSFORMER },//only skeleton transformer yet
|
||||
{ "portalOfSummoning", BuildingSubID::PORTAL_OF_SUMMONING },
|
||||
{ "ballistaYard", BuildingSubID::BALLISTA_YARD },
|
||||
{ "library", BuildingSubID::LIBRARY },
|
||||
{ "fountainOfFortune", BuildingSubID::FOUNTAIN_OF_FORTUNE },//luck garrison bonus
|
||||
{ "escapeTunnel", BuildingSubID::ESCAPE_TUNNEL },
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
TResources resources;
|
||||
TResources produce;
|
||||
TRequired requirements;
|
||||
ArtifactID warMachine;
|
||||
std::set<EMarketMode> marketModes;
|
||||
|
||||
BuildingID bid; //structure ID
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
std::map<int,int> hordeLvl; //[0] - first horde building creature level; [1] - second horde building (-1 if not present)
|
||||
ui32 mageLevel; //max available mage guild level
|
||||
GameResID primaryRes;
|
||||
ArtifactID warMachine;
|
||||
CreatureID warMachineDeprecated;
|
||||
SpellID moatAbility;
|
||||
|
||||
// default chance for hero of specific class to appear in tavern, if field "tavern" was not set
|
||||
|
@ -324,6 +324,14 @@ void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, cons
|
||||
}
|
||||
loadBuildingRequirements(ret, source["requires"], requirementsToLoad);
|
||||
|
||||
if (!source["warMachine"].isNull())
|
||||
{
|
||||
VLC->identifiers()->requestIdentifier("artifact", source["warMachine"], [=](si32 identifier)
|
||||
{
|
||||
ret->warMachine = ArtifactID(identifier);
|
||||
});
|
||||
}
|
||||
|
||||
if (!source["upgrades"].isNull())
|
||||
{
|
||||
// building id and upgrades can't be the same
|
||||
@ -552,7 +560,13 @@ void CTownHandler::loadTown(CTown * town, const JsonNode & source)
|
||||
else
|
||||
town->primaryRes = GameResID(resIter - std::begin(GameConstants::RESOURCE_NAMES));
|
||||
|
||||
warMachinesToLoad[town] = source["warMachine"];
|
||||
if (!source["warMachine"].isNull())
|
||||
{
|
||||
VLC->identifiers()->requestIdentifier( "creature", source["warMachine"], [=](si32 creatureID)
|
||||
{
|
||||
town->warMachineDeprecated = creatureID;
|
||||
});
|
||||
}
|
||||
|
||||
town->mageLevel = static_cast<ui32>(source["mageGuild"].Float());
|
||||
|
||||
@ -848,7 +862,6 @@ void CTownHandler::beforeValidate(JsonNode & object)
|
||||
void CTownHandler::afterLoadFinalization()
|
||||
{
|
||||
initializeRequirements();
|
||||
initializeWarMachines();
|
||||
}
|
||||
|
||||
void CTownHandler::initializeRequirements()
|
||||
@ -878,27 +891,6 @@ void CTownHandler::initializeRequirements()
|
||||
requirementsToLoad.clear();
|
||||
}
|
||||
|
||||
void CTownHandler::initializeWarMachines()
|
||||
{
|
||||
// must be done separately after all objects are loaded
|
||||
for(auto & p : warMachinesToLoad)
|
||||
{
|
||||
CTown * t = p.first;
|
||||
JsonNode creatureKey = p.second;
|
||||
|
||||
auto ret = VLC->identifiers()->getIdentifier("creature", creatureKey, false);
|
||||
|
||||
if(ret)
|
||||
{
|
||||
const CCreature * creature = CreatureID(*ret).toCreature();
|
||||
|
||||
t->warMachine = creature->warMachine;
|
||||
}
|
||||
}
|
||||
|
||||
warMachinesToLoad.clear();
|
||||
}
|
||||
|
||||
std::set<FactionID> CTownHandler::getDefaultAllowed() const
|
||||
{
|
||||
std::set<FactionID> allowedFactions;
|
||||
|
@ -34,14 +34,12 @@ class DLL_LINKAGE CTownHandler : public CHandlerBase<FactionID, Faction, CFactio
|
||||
CTown * town;
|
||||
};
|
||||
|
||||
std::map<CTown *, JsonNode> warMachinesToLoad;
|
||||
std::vector<BuildingRequirementsHelper> requirementsToLoad;
|
||||
std::vector<BuildingRequirementsHelper> overriddenBidsToLoad; //list of buildings, which bonuses should be overridden.
|
||||
|
||||
static const TPropagatorPtr & emptyPropagator();
|
||||
|
||||
void initializeRequirements();
|
||||
void initializeWarMachines();
|
||||
|
||||
/// loads CBuilding's into town
|
||||
void loadBuildingRequirements(CBuilding * building, const JsonNode & source, std::vector<BuildingRequirementsHelper> & bidsToLoad) const;
|
||||
|
@ -1176,6 +1176,31 @@ TerrainId CGTownInstance::getNativeTerrain() const
|
||||
return town->faction->getNativeTerrain();
|
||||
}
|
||||
|
||||
ArtifactID CGTownInstance::getWarMachineInBuilding(BuildingID building) const
|
||||
{
|
||||
if (builtBuildings.count(building) == 0)
|
||||
return ArtifactID::NONE;
|
||||
|
||||
if (building == BuildingID::BLACKSMITH && town->warMachineDeprecated.hasValue())
|
||||
return town->warMachineDeprecated.toCreature()->warMachine;
|
||||
|
||||
return town->buildings.at(building)->warMachine;
|
||||
}
|
||||
|
||||
bool CGTownInstance::isWarMachineAvailable(ArtifactID warMachine) const
|
||||
{
|
||||
for (auto const & buildingID : builtBuildings)
|
||||
if (town->buildings.at(buildingID)->warMachine == warMachine)
|
||||
return true;
|
||||
|
||||
if (builtBuildings.count(BuildingID::BLACKSMITH) &&
|
||||
town->warMachineDeprecated.hasValue() &&
|
||||
town->warMachineDeprecated.toCreature()->warMachine == warMachine)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
GrowthInfo::Entry::Entry(const std::string &format, int _count)
|
||||
: count(_count)
|
||||
{
|
||||
|
@ -208,6 +208,11 @@ public:
|
||||
FactionID getFaction() const override;
|
||||
TerrainId getNativeTerrain() const override;
|
||||
|
||||
/// Returns ID of war machine that is produced by specified building or NONE if this is not built or if building does not produce war machines
|
||||
ArtifactID getWarMachineInBuilding(BuildingID) const;
|
||||
/// Returns true if provided war machine is available in any of built buildings of this town
|
||||
bool isWarMachineAvailable(ArtifactID) const;
|
||||
|
||||
CGTownInstance(IGameCallback *cb);
|
||||
virtual ~CGTownInstance();
|
||||
|
||||
|
@ -2798,8 +2798,7 @@ bool CGameHandler::buyArtifact(ObjectInstanceID hid, ArtifactID aid)
|
||||
const int price = art->getPrice();
|
||||
COMPLAIN_RET_FALSE_IF(getPlayerState(hero->getOwner())->resources[EGameResID::GOLD] < price, "Not enough gold!");
|
||||
|
||||
if ((town->hasBuilt(BuildingID::BLACKSMITH) && town->town->warMachine == aid)
|
||||
|| (town->hasBuilt(BuildingSubID::BALLISTA_YARD) && aid == ArtifactID::BALLISTA))
|
||||
if(town->isWarMachineAvailable(aid))
|
||||
{
|
||||
giveResource(hero->getOwner(),EGameResID::GOLD,-price);
|
||||
return giveHeroNewArtifact(hero, art);
|
||||
|
Reference in New Issue
Block a user