1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-21 17:17:06 +02:00

Tower: use bonus system for lookout tower and grail extra sight radius

Skyship code in GH::newTurn can be also dropped since darkness will never cover tiles team have sight over.
This commit is contained in:
Arseniy Shestakov 2016-09-22 09:42:44 +03:00
parent c8d8e38a31
commit 7eed456753
3 changed files with 4 additions and 29 deletions

View File

@ -59,7 +59,7 @@ void CPrivilagedInfoCallback::getTilesInRange(std::unordered_set<int3, ShashInt3
logGlobal->error("Illegal call to getTilesInRange!");
return;
}
if (radious == -1) //reveal entire map
if (radious > 5000) //reveal entire map
getAllTiles (tiles, player, -1, 0);
else
{

View File

@ -434,14 +434,7 @@ void CGDwelling::serializeJsonOptions(JsonSerializeFormat & handler)
int CGTownInstance::getSightRadius() const //returns sight distance
{
if (subID == ETownType::TOWER)
{
if (hasBuilt(BuildingID::GRAIL)) //skyship
return -1; //entire map
if (hasBuilt(BuildingID::LOOKOUT_TOWER)) //lookout tower
return 20;
}
return 5;
return 5 + valOfBonuses(Bonus::SIGHT_RADIOUS);
}
void CGTownInstance::setPropertyDer(ui8 what, ui32 val)
@ -1089,6 +1082,8 @@ void CGTownInstance::recreateBuildingsBonuses()
}
else if(subID == ETownType::TOWER) //tower
{
addBonusIfBuilt(BuildingID::LOOKOUT_TOWER, Bonus::SIGHT_RADIOUS, +20);
addBonusIfBuilt(BuildingID::GRAIL, Bonus::SIGHT_RADIOUS, +5001); //more than 5000 reveal entire map
addBonusIfBuilt(BuildingID::GRAIL, Bonus::PRIMARY_SKILL, +15, PrimarySkill::KNOWLEDGE); //grail
}
else if(subID == ETownType::INFERNO) //Inferno

View File

@ -1698,26 +1698,6 @@ void CGameHandler::newTurn()
{
n.res[player] = n.res[player] + t->dailyIncome();
}
if (t->hasBuilt(BuildingID::GRAIL, ETownType::TOWER))
{
// Skyship, probably easier to handle same as Veil of darkness
//do it every new day after veils apply
if (player != PlayerColor::NEUTRAL) //do not reveal fow for neutral player
{
FoWChange fw;
fw.mode = FoWChange::REVEALED;
fw.player = player;
// find all hidden tiles
const auto & fow = getPlayerTeam(player)->fogOfWarMap;
for (size_t i=0; i<fow.size(); i++)
for (size_t j=0; j<fow.at(i).size(); j++)
for (size_t k=0; k<fow.at(i).at(j).size(); k++)
if (!fow.at(i).at(j).at(k))
fw.tiles.insert(int3(i,j,k));
sendAndApply (&fw);
}
}
if (t->hasBonusOfType (Bonus::DARKNESS))
{
for (auto & player : gs->players)