1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

Added "monster strength" info to templates.

This commit is contained in:
DjWarmonger 2014-06-15 11:08:06 +02:00
parent 5c431da0f9
commit 01355a77d8
4 changed files with 57 additions and 14 deletions

View File

@ -10,6 +10,7 @@
{
"type" : "playerStart", "size" : 1, "owner" : 1,
"playerTowns" : { "castles" : 1 }, "neutralTowns" : { "towns" : 1 }, "townsAreSameType" : true,
"monsters" : "normal",
"mines" : {"wood" : 1, "ore" : 1, "gems" : 1, "crystal" : 1, "sulfur" : 1, "mercury" : 1},
"treasure" : [
{"min" : 2100, "max": 3000, "density" : 5},
@ -20,6 +21,7 @@
{
"type" : "playerStart", "size" : 1, "owner" : 2,
"playerTowns" : { "castles" : 1 }, "neutralTowns" : { "towns" : 1 }, "townsAreSameType" : true,
"monsters" : "normal",
"minesLikeZone" : 1,
"treasureLikeZone" : 1
},
@ -27,6 +29,7 @@
{
"type" : "playerStart", "size" : 1, "owner" : 3,
"playerTowns" : { "castles" : 1 }, "neutralTowns" : { "towns" : 1 }, "townsAreSameType" : true,
"monsters" : "normal",
"minesLikeZone" : 1,
"treasureLikeZone" : 1
},
@ -34,6 +37,7 @@
{
"type" : "playerStart", "size" : 1, "owner" : 4,
"playerTowns" : { "castles" : 1 }, "neutralTowns" : { "towns" : 1 }, "townsAreSameType" : true,
"monsters" : "normal",
"minesLikeZone" : 1,
"treasureLikeZone" : 1
},
@ -41,6 +45,7 @@
{
"type" : "treasure", "size" : 2, "terrainTypes" : [ "sand" ], "matchTerrainToTown" : false,
"neutralTowns" : { "castles" : 1 },
"monsters" : "strong",
"mines" : {"gold" : 2},
"treasure" : [
{"min" : 9000, "max": 10000, "density" : 3},
@ -66,6 +71,7 @@
{
"type" : "playerStart", "size" : 1, "owner" : 1,
"playerTowns" : { "castles" : 1 },
"monsters" : "normal",
"mines" : {"wood" : 1, "ore" : 1},
"treasure" : [
{"min" : 400, "max": 1500, "density" : 16},
@ -76,12 +82,14 @@
{
"type" : "playerStart", "size" : 1, "owner" : 2,
"playerTowns" : { "castles" : 1 },
"monsters" : "normal",
"minesLikeZone" : 1,
"treasureLikeZone" : 1
},
"3" :
{
"type" : "treasure", "size" : 2, "neutralTowns" : { "towns" : 1 }, "townTypeLikeZone" : 1,
"monsters" : "weak",
"mines" : {"gems" : 1, "crystal" : 1, "sulfur" : 1, "mercury" : 1, "gold" : 1},
"treasure" : [
{"min" : 2000, "max": 4000, "density" : 15},
@ -91,12 +99,14 @@
"4" :
{
"type" : "treasure", "size" : 2, "neutralTowns" : { "towns" : 1 }, "townTypeLikeZone" : 2,
"monsters" : "weak",
"minesLikeZone" : 3,
"treasureLikeZone" : 3
},
"5" :
{
"type" : "treasure", "size" : 3, "neutralTowns" : { "castles" : 1 }, "terrainTypes" : [ "sand" ],
"monsters" : "strong",
"mines" : {"gold" : 2},
"treasure" : [
{"min" : 11000, "max": 12000, "density" : 5},
@ -124,6 +134,7 @@
{
"type" : "playerStart", "size" : 3, "owner" : 1,
"playerTowns" : { "castles" : 1 },
"monsters" : "normal",
"mines" : {"wood" : 1, "ore" : 1},
"treasure" : [
{"min" : 300, "max": 2000, "density": 15},
@ -134,6 +145,7 @@
{
"type" : "playerStart", "size" : 3, "owner" : 2,
"playerTowns" : { "castles" : 1 },
"monsters" : "normal",
"minesLikeZone" : 1,
"treasureLikeZone" : 1
},
@ -141,30 +153,34 @@
{
"type" : "playerStart", "size" : 3, "owner" : 3,
"playerTowns" : { "castles" : 1 },
"monsters" : "normal",
"minesLikeZone" : 1,
"treasureLikeZone" : 1
},
"4" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 1,
"monsters" : "normal",
"mines" : {"gems" : 1, "crystal" : 1},
"treasure" : [
{"min" : 3000, "max": 10000, "density" : 12},
{"min" : 6000, "max": 10000, "density" : 6}
]},
"5" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 1,
"monsters" : "normal",
"mines" : {"sulfur" : 1, "mercury" : 1},
"treasureLikeZone" : 4},
"6" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 2, "minesLikeZone" : 5, "treasureLikeZone" : 4 },
"7" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 2, "minesLikeZone" : 4, "treasureLikeZone" : 4 },
"8" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 3, "minesLikeZone" : 4, "treasureLikeZone" : 4 },
"9" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 3, "minesLikeZone" : 5, "treasureLikeZone" : 4 },
"6" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 2, "monsters" : "normal", "minesLikeZone" : 5, "treasureLikeZone" : 4 },
"7" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 2, "monsters" : "normal", "minesLikeZone" : 4, "treasureLikeZone" : 4 },
"8" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 3, "monsters" : "normal", "minesLikeZone" : 4, "treasureLikeZone" : 4 },
"9" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 3, "monsters" : "normal", "minesLikeZone" : 5, "treasureLikeZone" : 4 },
"10" : { "type" : "treasure", "size" : 1, "neutralTowns" : { "towns" : 1 },
"monsters" : "strong",
"mines" : {"gold" : 1},
"treasure" : [
{"min" : 21000, "max": 25000, "density" : 3},
{"min" : 10000, "max": 21000, "density" : 10}
]},
"11" : { "type" : "treasure", "size" : 1, "neutralTowns" : { "towns" : 1 }, "minesLikeZone" : 10, "treasureLikeZone" : 10 },
"12" : { "type" : "treasure", "size" : 1, "neutralTowns" : { "towns" : 1 }, "minesLikeZone" : 10, "treasureLikeZone" : 10 }
"11" : { "type" : "treasure", "size" : 1, "neutralTowns" : { "towns" : 1 }, "monsters" : "strong", "minesLikeZone" : 10, "treasureLikeZone" : 10 },
"12" : { "type" : "treasure", "size" : 1, "neutralTowns" : { "towns" : 1 }, "monsters" : "strong", "minesLikeZone" : 10, "treasureLikeZone" : 10 }
},
"connections" :
[
@ -191,25 +207,29 @@
"1" :
{
"type" : "playerStart", "size" : 2, "owner" : 1,
"playerTowns" : { "castles" : 1 }
"playerTowns" : { "castles" : 1 },
"monsters" : "normal",
},
"2" :
{
"type" : "playerStart", "size" : 2, "owner" : 2,
"playerTowns" : { "castles" : 1 }
"playerTowns" : { "castles" : 1 },
"monsters" : "normal",
},
"3" :
{
"type" : "cpuStart", "size" : 3, "owner" : 3,
"playerTowns" : { "castles" : 1 }
"playerTowns" : { "castles" : 1 },
"monsters" : "weak",
},
"4" :
{
"type" : "cpuStart", "size" : 3, "owner" : 4,
"playerTowns" : { "castles" : 1 }
"playerTowns" : { "castles" : 1 },
"monsters" : "weak",
},
"5" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 3 },
"6" : { "type" : "treasure", "size" : 1, "terrainTypeLikeZone" : 4 }
"5" : { "type" : "treasure", "size" : 1, "monsters" : "strong", "terrainTypeLikeZone" : 3 },
"6" : { "type" : "treasure", "size" : 1, "monsters" : "strong", "terrainTypeLikeZone" : 4 }
},
"connections" :
[
@ -232,6 +252,7 @@
"type" : "playerStart", "size" : 30, "owner" : 1,
"playerTowns" : { "castles" : 1 },
"neutralTowns" : { "towns" : 2 },
"monsters" : "weak",
"mines" : {"wood" : 4, "ore" : 4, "gems" : 1, "crystal" : 1, "sulfur" : 1, "mercury" : 1, "gold" : 2},
"treasure" : [
{"min" : 12000, "max": 22000, "density": 1},
@ -244,6 +265,7 @@
"type" : "playerStart", "size" : 30, "owner" : 2,
"playerTowns" : { "castles" : 1 },
"neutralTowns" : { "towns" : 2 },
"monsters" : "weak",
"minesLikeZone" : 1,
"treasureLikeZone" : 1
},
@ -252,6 +274,7 @@
"type" : "playerStart", "size" : 30, "owner" : 3,
"playerTowns" : { "castles" : 1 },
"neutralTowns" : { "towns" : 2 },
"monsters" : "weak",
"minesLikeZone" : 1,
"treasureLikeZone" : 1
},
@ -260,6 +283,7 @@
"type" : "playerStart", "size" : 30, "owner" : 4,
"playerTowns" : { "castles" : 1 },
"neutralTowns" : { "towns" : 2 },
"monsters" : "weak",
"minesLikeZone" : 1,
"treasureLikeZone" : 1
},
@ -268,6 +292,7 @@
"type" : "treasure", "size" : 40,
"neutralTowns" : { "towns" : 2 },
"terrainTypes" : [ "sand" ], "matchTerrainToTown" : false,
"monsters" : "strong",
"mines" : {"gold" : 4},
"treasure" : [
{"min" : 35000, "max": 55000, "density" : 3},

View File

@ -65,6 +65,16 @@ void CJsonRmgTemplateLoader::loadTemplates()
zone->setTerrainTypes(parseTerrainTypes(zoneNode["terrainTypes"].Vector(), zone->getDefaultTerrainTypes()));
zone->setTownsAreSameType((zoneNode["townsAreSameType"].Bool()));
const std::string monsterStrength = zoneNode["monsters"].String();
if (monsterStrength == "weak")
zone->setMonsterStrength(EMonsterStrength::ZONE_WEAK);
else if (monsterStrength == "normal")
zone->setMonsterStrength(EMonsterStrength::ZONE_NORMAL);
else if (monsterStrength == "strong")
zone->setMonsterStrength(EMonsterStrength::ZONE_STRONG);
else
throw (rmgException("incorrect monster power"));
if (!zoneNode["mines"].isNull())
{
auto mines = zoneNode["mines"].Struct();

View File

@ -121,7 +121,8 @@ void CTileInfo::setTerrainType(ETerrainType value)
}
CRmgTemplateZone::CRmgTemplateZone() : id(0), type(ETemplateZoneType::PLAYER_START), size(1),
terrainType (ETerrainType::GRASS), townType(0), townsAreSameType(false), matchTerrainToTown(true), totalDensity(0)
terrainType (ETerrainType::GRASS), townType(0), townsAreSameType(false), matchTerrainToTown(true), totalDensity(0),
zoneMonsterStrength(EMonsterStrength::ZONE_NORMAL)
{
townTypes = getDefaultTownTypes();
terrainTypes = getDefaultTerrainTypes();
@ -276,6 +277,12 @@ std::vector<TRmgTemplateZoneId> CRmgTemplateZone::getConnections() const
return connections;
}
void CRmgTemplateZone::setMonsterStrength (EMonsterStrength::EMonsterStrength val)
{
assert (vstd::iswithin(val, EMonsterStrength::ZONE_WEAK, EMonsterStrength::ZONE_STRONG));
zoneMonsterStrength = val;
}
void CRmgTemplateZone::setTotalDensity (ui16 val)
{
totalDensity = val;
@ -496,7 +503,6 @@ bool CRmgTemplateZone::addMonster(CMapGenerator* gen, int3 &pos, si32 strength)
//precalculate actual (randomized) monster strength based on this post
//http://forum.vcmi.eu/viewtopic.php?p=12426#12426
int zoneMonsterStrength = 0; //TODO: range -1..1 based on template settings
int mapMonsterStrength = gen->mapGenOptions->getMonsterStrength();
int monsterStrength = zoneMonsterStrength + mapMonsterStrength - 1; //array index from 0 to 4
static const int value1[] = {2500, 1500, 1000, 500, 0};

View File

@ -118,6 +118,7 @@ public:
std::set<ETerrainType> getDefaultTerrainTypes() const;
void setMinesAmount (TResource res, ui16 amount);
std::map<TResource, ui16> getMinesInfo() const;
void setMonsterStrength (EMonsterStrength::EMonsterStrength val);
float3 getCenter() const;
void setCenter(const float3 &f);
@ -166,6 +167,7 @@ private:
si32 townType;
ETerrainType terrainType;
EMonsterStrength::EMonsterStrength zoneMonsterStrength;
ui16 totalDensity;
std::vector<CTreasureInfo> treasureInfo;
std::vector<ObjectInfo> possibleObjects;