mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
- if special victory condition is present AND there is only one player normal victory condition will be disabled - added new triggered condition, constant value - if target of CONTROL/DESTROY condition is removed from map, triggered condition will be replaced with constant - fixed randomization of armies with random stacks
This commit is contained in:
@@ -117,7 +117,8 @@ struct DLL_LINKAGE EventCondition
|
||||
DAYS_PASSED, // value - number of days from start of the game
|
||||
IS_HUMAN, // value - 0 = player is AI, 1 = player is human
|
||||
DAYS_WITHOUT_TOWN, // value - how long player can live without town, 0=instakill
|
||||
STANDARD_WIN // normal defeat all enemies condition
|
||||
STANDARD_WIN, // normal defeat all enemies condition
|
||||
CONST_VALUE // condition that always evaluates to "value" (0 = false, 1 = true)
|
||||
};
|
||||
|
||||
EventCondition(EWinLoseType condition = STANDARD_WIN);
|
||||
|
||||
@@ -337,6 +337,17 @@ void CMapLoaderH3M::readVictoryLossConditions()
|
||||
bool allowNormalVictory = reader.readBool();
|
||||
bool appliesToAI = reader.readBool();
|
||||
|
||||
if (allowNormalVictory)
|
||||
{
|
||||
size_t playersOnMap = boost::range::count_if(mapHeader->players,[](const PlayerInfo & info) { return info.canAnyonePlay();});
|
||||
|
||||
if (playersOnMap == 1)
|
||||
{
|
||||
logGlobal->warnStream() << "Map " << mapHeader->name << " has only one player but allows normal victory?";
|
||||
allowNormalVictory = false; // makes sense? Not much. Works as H3? Yes!
|
||||
}
|
||||
}
|
||||
|
||||
switch(vicCondition)
|
||||
{
|
||||
case EVictoryConditionType::ARTIFACT:
|
||||
@@ -1660,7 +1671,8 @@ void CMapLoaderH3M::readCreatureSet(CCreatureSet * out, int number)
|
||||
count = reader.readUInt16();
|
||||
|
||||
// Empty slot
|
||||
if(creID == maxID) continue;
|
||||
if(creID == maxID)
|
||||
continue;
|
||||
|
||||
auto hlp = new CStackInstance();
|
||||
hlp->count = count;
|
||||
@@ -1668,8 +1680,7 @@ void CMapLoaderH3M::readCreatureSet(CCreatureSet * out, int number)
|
||||
if(creID > maxID - 0xf)
|
||||
{
|
||||
//this will happen when random object has random army
|
||||
creID = CreatureID(maxID + 1 - creID + VLC->creh->creatures.size());
|
||||
hlp->idRand = creID;
|
||||
hlp->idRand = maxID - creID - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
#include "../VCMI_Lib.h"
|
||||
|
||||
static const std::string conditionNames[] = {
|
||||
"haveArtifact", "haveCreatures", "haveResources", "haveBuilding",
|
||||
"control", "destroy", "transport",
|
||||
"daysPassed", "isHuman", "daysWithoutTown", "standardWin"
|
||||
"haveArtifact", "haveCreatures", "haveResources", "haveBuilding",
|
||||
"control", "destroy", "transport", "daysPassed",
|
||||
"isHuman", "daysWithoutTown", "standardWin", "constValue"
|
||||
};
|
||||
|
||||
static const std::string typeNames[] = { "victory", "defeat" };
|
||||
|
||||
Reference in New Issue
Block a user