Added Bowman as first unique unit!

This commit is contained in:
Yair Morgenstern 2018-06-17 23:39:25 +03:00
parent 8116a72fdf
commit 5df93757f2
4 changed files with 20 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -49,6 +49,20 @@
obsoleteTech:"Machinery",
upgradesTo:"Crossbowman"
},
{
name:"Bowman",
unitType:"Ranged",
movement:2,
strength:7,
rangedStrength:9,
cost: 40,
hurryCostModifier:20
requiredTech:"Archery",
obsoleteTech:"Machinery",
replaces:"Archer",
uniqueTo:"Babylon"
upgradesTo:"Crossbowman"
},
{
name:"Chariot Archer",
unitType:"Ranged",

View File

@ -131,7 +131,7 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) {
// Remove all national wonders when conquering a city
for(building in city.cityConstructions.getBuiltBuildings().filter { it.requiredBuildingInAllCities!=null })
city.cityConstructions.builtBuildings.remove(building.name)
(attacker as MapUnitCombatant).unit.moveToTile(city.getCenterTile())
city.civInfo.gameInfo.updateTilesToCities()
}

View File

@ -4,6 +4,7 @@ import com.unciv.logic.city.CityConstructions
import com.unciv.logic.city.IConstruction
import com.unciv.logic.civilization.CivilizationInfo
import com.unciv.logic.map.MapUnit
import com.unciv.models.gamebasics.GameBasics
import com.unciv.models.gamebasics.ICivilopedia
import com.unciv.models.stats.INamed
import com.unciv.ui.utils.tr
@ -24,6 +25,8 @@ class Unit : INamed, IConstruction, ICivilopedia {
var uniques:HashSet<String>?=null
var obsoleteTech:String?=null
var upgradesTo:String? = null
var replaces:String?=null
var uniqueTo:String?=null
override val description: String
@ -81,6 +84,8 @@ class Unit : INamed, IConstruction, ICivilopedia {
if (unbuildable) return false
if (requiredTech!=null && !civInfo.tech.isResearched(requiredTech!!)) return false
if (obsoleteTech!=null && civInfo.tech.isResearched(obsoleteTech!!)) return false
if(uniqueTo!=null && uniqueTo!=civInfo.civName) return false
if(GameBasics.Units.values.any { it.uniqueTo==civInfo.civName && it.replaces==name }) return false
if (requiredResource!=null && !civInfo.getCivResources().keys.any { it.name == requiredResource }) return false
return true
}