mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-14 02:33:51 +02:00
Don't remove zone guards in a zone with monsters: none, remove extra parentheses and add comments
This commit is contained in:
parent
42d6cb4f8a
commit
05e72e2e7f
@ -409,8 +409,8 @@ CGCreature * ObjectManager::chooseGuard(si32 strength, bool zoneGuard)
|
|||||||
//precalculate actual (randomized) monster strength based on this post
|
//precalculate actual (randomized) monster strength based on this post
|
||||||
//http://forum.vcmi.eu/viewtopic.php?p=12426#12426
|
//http://forum.vcmi.eu/viewtopic.php?p=12426#12426
|
||||||
|
|
||||||
if(zone.zoneMonsterStrength == EMonsterStrength::ZONE_NONE)
|
if(!zoneGuard && zone.zoneMonsterStrength == EMonsterStrength::ZONE_NONE)
|
||||||
return nullptr; //no guards in this zone
|
return nullptr; //no guards inside this zone
|
||||||
|
|
||||||
int mapMonsterStrength = map.getMapGenOptions().getMonsterStrength();
|
int mapMonsterStrength = map.getMapGenOptions().getMonsterStrength();
|
||||||
int monsterStrength = (zoneGuard ? 0 : zone.zoneMonsterStrength) + mapMonsterStrength - 1; //array index from 0 to 4
|
int monsterStrength = (zoneGuard ? 0 : zone.zoneMonsterStrength) + mapMonsterStrength - 1; //array index from 0 to 4
|
||||||
|
@ -527,8 +527,8 @@ size_t TreasurePlacer::getPossibleObjectsSize() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool TreasurePlacer::isGuardNeededForTreasure(int value)
|
bool TreasurePlacer::isGuardNeededForTreasure(int value)
|
||||||
{
|
{// no guard in a zone with "monsters: none", in a water zone and for small treasures
|
||||||
return ((zone.zoneMonsterStrength != EMonsterStrength::ZONE_NONE) && (zone.getType() != ETemplateZoneType::WATER) && (value > minGuardedValue));
|
return zone.zoneMonsterStrength != EMonsterStrength::ZONE_NONE && zone.getType() != ETemplateZoneType::WATER && value > minGuardedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ObjectInfo*> TreasurePlacer::prepareTreasurePile(const CTreasureInfo& treasureInfo)
|
std::vector<ObjectInfo*> TreasurePlacer::prepareTreasurePile(const CTreasureInfo& treasureInfo)
|
||||||
@ -687,8 +687,7 @@ void TreasurePlacer::createTreasures(ObjectManager & manager)
|
|||||||
const int maxAttempts = 2;
|
const int maxAttempts = 2;
|
||||||
|
|
||||||
int mapMonsterStrength = map.getMapGenOptions().getMonsterStrength();
|
int mapMonsterStrength = map.getMapGenOptions().getMonsterStrength();
|
||||||
int monsterStrength = (zone.zoneMonsterStrength == EMonsterStrength::ZONE_NONE ? 0 : zone.zoneMonsterStrength + mapMonsterStrength - 1); //array index from 0 to 4
|
int monsterStrength = (zone.zoneMonsterStrength == EMonsterStrength::ZONE_NONE ? 0 : zone.zoneMonsterStrength + mapMonsterStrength - 1); //array index from 0 to 4; pick any correct value for ZONE_NONE, minGuardedValue won't be used in this case anyway
|
||||||
// pick any correct value for ZONE_NONE, minGuardedValue won't be used in this case anyway
|
|
||||||
static int minGuardedValues[] = { 6500, 4167, 3000, 1833, 1333 };
|
static int minGuardedValues[] = { 6500, 4167, 3000, 1833, 1333 };
|
||||||
minGuardedValue = minGuardedValues[monsterStrength];
|
minGuardedValue = minGuardedValues[monsterStrength];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user