Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide invisible resources for AI #12772

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ object CityLocationTileRanker {
// We want to found the city on an oasis because it can't be improved otherwise
if (newCityTile.terrainHasUnique(UniqueType.Unbuildable)) tileValue += 3
// If we build the city on a resource tile, then we can't build any special improvements on it
if (newCityTile.resource != null) tileValue -= 4
if (newCityTile.resource != null && newCityTile.tileResource.resourceType == ResourceType.Bonus) tileValue -= 8
if (newCityTile.hasViewableResource(civ)) tileValue -= 4
if (newCityTile.hasViewableResource(civ) && newCityTile.tileResource.resourceType == ResourceType.Bonus) tileValue -= 8
// Settling on bonus resources tends to waste a food
// Settling on luxuries generally speeds up our game, and settling on strategics as well, as the AI cheats and can see them.

Expand Down Expand Up @@ -155,7 +155,7 @@ object CityLocationTileRanker {
// Don't settle near but not on the coast
if (rankTile.isCoastalTile() && !onCoast) locationSpecificTileValue -= 2
// Check if there are any new unique luxury resources
if (rankTile.resource != null && rankTile.tileResource.resourceType == ResourceType.Luxury
if (rankTile.hasViewableResource(civ) && rankTile.tileResource.resourceType == ResourceType.Luxury
&& !(civ.hasResource(rankTile.resource!!) || newUniqueLuxuryResources.contains(rankTile.resource))) {
locationSpecificTileValue += 10
newUniqueLuxuryResources.add(rankTile.resource!!)
Expand All @@ -167,7 +167,7 @@ object CityLocationTileRanker {

var rankTileValue = Automation.rankStatsValue(rankTile.stats.getTileStats(null, civ, uniqueCache), civ)

if (rankTile.resource != null) {
if (rankTile.hasViewableResource(civ)) {
rankTileValue += when (rankTile.tileResource.resourceType) {
ResourceType.Bonus -> 2f
ResourceType.Strategic -> 1.2f * rankTile.resourceAmount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ class WorkerAutomation(

val stats = tile.stats.getStatDiffForImprovement(improvement, civInfo, tile.getCity(), localUniqueCache, currentTileStats)

var isResourceImprovedByNewImprovement = tile.resource != null && tile.tileResource.isImprovedBy(improvementName)
var isResourceImprovedByNewImprovement = tile.hasViewableResource(civInfo) && tile.tileResource.isImprovedBy(improvementName)

if (improvementName.startsWith(Constants.remove)) {
// We need to look beyond what we are doing right now and at the final improvement that will be on this tile
Expand Down
Loading