mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Correct strength of zone guards. Logs for guard strength.
This commit is contained in:
parent
173111955e
commit
be8c9c8378
@ -259,7 +259,7 @@ void CMapGenerator::createConnections()
|
||||
if (guardPos.valid())
|
||||
{
|
||||
setOccupied (guardPos, ETileType::FREE); //just in case monster is too weak to spawn
|
||||
zoneA->addMonster (this, guardPos, connection.getGuardStrength(), false);
|
||||
zoneA->addMonster (this, guardPos, connection.getGuardStrength(), false, true);
|
||||
//zones can make paths only in their own area
|
||||
zoneA->crunchPath (this, guardPos, posA, zoneA->getId(), zoneA->getFreePaths()); //make connection towards our zone center
|
||||
zoneB->crunchPath (this, guardPos, posB, zoneB->getId(), zoneB->getFreePaths()); //make connection towards other zone center
|
||||
|
@ -567,13 +567,13 @@ void CRmgTemplateZone::addRequiredObject(CGObjectInstance * obj, si32 strength)
|
||||
requiredObjects.push_back(std::make_pair(obj, strength));
|
||||
}
|
||||
|
||||
bool CRmgTemplateZone::addMonster(CMapGenerator* gen, int3 &pos, si32 strength, bool clearSurroundingTiles)
|
||||
bool CRmgTemplateZone::addMonster(CMapGenerator* gen, int3 &pos, si32 strength, bool clearSurroundingTiles, bool zoneGuard)
|
||||
{
|
||||
//precalculate actual (randomized) monster strength based on this post
|
||||
//http://forum.vcmi.eu/viewtopic.php?p=12426#12426
|
||||
|
||||
int mapMonsterStrength = gen->mapGenOptions->getMonsterStrength();
|
||||
int monsterStrength = zoneMonsterStrength + mapMonsterStrength - 1; //array index from 0 to 4
|
||||
int monsterStrength = (zoneGuard ? 0 : zoneMonsterStrength) + mapMonsterStrength - 1; //array index from 0 to 4
|
||||
static const int value1[] = {2500, 1500, 1000, 500, 0};
|
||||
static const int value2[] = {7500, 7500, 7500, 5000, 5000};
|
||||
static const float multiplier1[] = {0.5, 0.75, 1.0, 1.5, 1.5};
|
||||
@ -619,6 +619,9 @@ bool CRmgTemplateZone::addMonster(CMapGenerator* gen, int3 &pos, si32 strength,
|
||||
//will be set during initialization
|
||||
guard->putStack(SlotID(0), hlp);
|
||||
|
||||
logGlobal->traceStream() << boost::format ("Adding stack of %d %s. Map monster strenght %d, zone monster strength %d, base monster value %d")
|
||||
% amount % VLC->creh->creatures[creId]->namePl % mapMonsterStrength % zoneMonsterStrength % strength;
|
||||
|
||||
placeObject(gen, guard, pos);
|
||||
|
||||
if (clearSurroundingTiles)
|
||||
@ -1054,8 +1057,8 @@ bool CRmgTemplateZone::createRequiredObjects(CMapGenerator* gen)
|
||||
}
|
||||
logGlobal->traceStream() << "Place found";
|
||||
|
||||
placeObject(gen, obj.first, pos);
|
||||
guardObject (gen, obj.first, obj.second);
|
||||
placeObject (gen, obj.first, pos);
|
||||
guardObject (gen, obj.first, obj.second, (obj.first->ID == Obj::MONOLITH_TWO_WAY));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -1363,10 +1366,10 @@ void CRmgTemplateZone::placeObject(CMapGenerator* gen, CGObjectInstance* object,
|
||||
}
|
||||
}
|
||||
|
||||
void CRmgTemplateZone::placeAndGuardObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos, si32 str)
|
||||
void CRmgTemplateZone::placeAndGuardObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos, si32 str, bool zoneGuard)
|
||||
{
|
||||
placeObject(gen, object, pos);
|
||||
guardObject(gen, object, str);
|
||||
guardObject(gen, object, str, zoneGuard);
|
||||
}
|
||||
|
||||
std::vector<int3> CRmgTemplateZone::getAccessibleOffsets (CMapGenerator* gen, CGObjectInstance* object)
|
||||
@ -1395,7 +1398,7 @@ std::vector<int3> CRmgTemplateZone::getAccessibleOffsets (CMapGenerator* gen, CG
|
||||
return tiles;
|
||||
}
|
||||
|
||||
bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object, si32 str)
|
||||
bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object, si32 str, bool zoneGuard)
|
||||
{
|
||||
logGlobal->traceStream() << boost::format("Guard object at %s") % object->pos();
|
||||
|
||||
@ -1418,7 +1421,7 @@ bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (addMonster (gen, guardTile, str, false)) //do not place obstacles around unguarded object
|
||||
if (addMonster (gen, guardTile, str, false, zoneGuard)) //do not place obstacles around unguarded object
|
||||
{
|
||||
for (auto pos : tiles)
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ public:
|
||||
void discardDistantTiles (CMapGenerator* gen, float distance);
|
||||
|
||||
void addRequiredObject(CGObjectInstance * obj, si32 guardStrength=0);
|
||||
bool addMonster(CMapGenerator* gen, int3 &pos, si32 strength, bool clearSurroundingTiles = true);
|
||||
bool addMonster(CMapGenerator* gen, int3 &pos, si32 strength, bool clearSurroundingTiles = true, bool zoneGuard = false);
|
||||
bool createTreasurePile (CMapGenerator* gen, int3 &pos);
|
||||
bool fill (CMapGenerator* gen);
|
||||
bool placeMines (CMapGenerator* gen);
|
||||
@ -170,7 +170,7 @@ public:
|
||||
|
||||
ObjectInfo getRandomObject (CMapGenerator* gen, CTreasurePileInfo &info, ui32 value);
|
||||
|
||||
void placeAndGuardObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos, si32 str);
|
||||
void placeAndGuardObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos, si32 str, bool zoneGuard = false);
|
||||
|
||||
private:
|
||||
//template info
|
||||
@ -213,5 +213,5 @@ private:
|
||||
bool canObstacleBePlacedHere(CMapGenerator* gen, ObjectTemplate &temp, int3 &pos);
|
||||
void checkAndPlaceObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos);
|
||||
void placeObject(CMapGenerator* gen, CGObjectInstance* object, const int3 &pos);
|
||||
bool guardObject(CMapGenerator* gen, CGObjectInstance* object, si32 str);
|
||||
bool guardObject(CMapGenerator* gen, CGObjectInstance* object, si32 str, bool zoneGuard = false);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user