Unviewable resources no longer affect improvement yield (e.g. mine on unviewable coal)

Resource-requiring units no longer get a penalty when civ is breaking even on that resource
This commit is contained in:
Yair Morgenstern 2018-11-19 20:44:26 +02:00
parent 30ea16d251
commit 8a7719e634
3 changed files with 5 additions and 5 deletions

View file

@ -47,7 +47,7 @@ class UnitAutomation{
if (tryUpgradeUnit(unit, unitActions)) return
// Accompany settlers
if (tryAccompanySettler(unit,unitDistanceToTiles)) return
if (tryAccompanySettler(unit)) return
if (unit.health < 50) {
healUnit(unit,unitDistanceToTiles)
@ -183,9 +183,9 @@ class UnitAutomation{
return false
}
private fun tryAccompanySettler(unit: MapUnit, unitDistanceToTiles: HashMap<TileInfo, Float>): Boolean {
private fun tryAccompanySettler(unit: MapUnit): Boolean {
val settlerToAccompany = unit.civInfo.getCivUnits()
.firstOrNull { val tile = it.currentTile;
.firstOrNull { val tile = it.currentTile
it.name=="Settler" && tile.militaryUnit==null
&& unit.canMoveTo(tile) && unit.movementAlgs().canReach(tile) }
if(settlerToAccompany==null) return false

View file

@ -49,7 +49,7 @@ class BattleDamage{
modifiers["Discipline"] = 0.15f
val requiredResource = combatant.unit.baseUnit.requiredResource
if(requiredResource!=null && !combatant.getCivilization().hasResource(requiredResource)){
if(requiredResource!=null && combatant.getCivilization().getCivResourcesByName()[requiredResource]!!<0){
modifiers["Missing resource"]=-0.25f
}
}

View file

@ -151,7 +151,7 @@ open class TileInfo {
val improvement = getTileImprovement()
if (improvement != null) {
if (resource != null && getTileResource().improvement == improvement.name)
if (hasViewableResource(observingCiv) && getTileResource().improvement == improvement.name)
stats.add(getTileResource().improvementStats!!) // resource-specifc improvement
else
stats.add(improvement) // basic improvement