Added Range, Sentry, Siege and Indirect Fire promotions

Units now get experience when capturing a city
This commit is contained in:
Yair Morgenstern
2018-08-16 08:52:29 +03:00
parent 26b3366d93
commit b1e17a67c6
12 changed files with 81 additions and 22 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -1082,52 +1082,80 @@ UnitPromotionIcons/Drill_I_(Civ5)
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/March_(Civ5)
UnitPromotionIcons/Indirect_Fire_(Civ5)
rotate: false
xy: 940, 418
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Scouting_III_(Civ5)
UnitPromotionIcons/March_(Civ5)
rotate: false
xy: 825, 1693
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Scouting_II_(Civ5)
UnitPromotionIcons/Range_(Civ5)
rotate: false
xy: 472, 97
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Scouting_I_(Civ5)
UnitPromotionIcons/Scouting_III_(Civ5)
rotate: false
xy: 994, 845
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_III_(Civ5)
UnitPromotionIcons/Scouting_II_(Civ5)
rotate: false
xy: 1814, 1479
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_II_(Civ5)
UnitPromotionIcons/Scouting_I_(Civ5)
rotate: false
xy: 940, 396
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_I_(Civ5)
UnitPromotionIcons/Sentry_(Civ5)
rotate: false
xy: 825, 1671
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_III_(Civ5)
rotate: false
xy: 494, 97
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_II_(Civ5)
rotate: false
xy: 1836, 1479
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_I_(Civ5)
rotate: false
xy: 940, 374
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Siege_(Civ5)
rotate: false
xy: 825, 1649
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 818 KiB

After

Width:  |  Height:  |  Size: 824 KiB

View File

@ -108,5 +108,29 @@
effect:"Bonus vs wounded units 33%",
unitTypes:["Mounted"]
}
{
name:"Siege",
prerequisites:["Accuracy I","Barrage I","Shock II","Drill II"],
effect:"Bonus vs City 25%",
unitTypes:["Melee","Ranged","Siege","Mounted"]
}
{
name:"Sentry",
prerequisites:["Accuracy I","Barrage I","Shock II","Drill II"],
effect:"+1 Visibility Range",
unitTypes:["Melee","Mounted"]
}
{
name:"Range",
prerequisites:["Accuracy III","Barrage III"],
effect:"+1 Range",
unitTypes:["Ranged","Siege"]
}
{
name:"Indirect Fire",
prerequisites:["Accuracy III","Barrage III"],
effect:"Ranged attacks may be performed over obstacles",
unitTypes:["Ranged","Siege"]
}
]

View File

@ -278,7 +278,7 @@
range:3,
cost: 320,
requiredTech:"Dynamite",
uniques:["Bonus vs City 200%","No defensive terrain bonus","Must set up to ranged attack","Limited Visibility"],
uniques:["Bonus vs City 200%","No defensive terrain bonus","Must set up to ranged attack","Limited Visibility","Indirect Fire"],
hurryCostModifier:20
},

View File

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.game"
minSdkVersion 14
targetSdkVersion 26
versionCode 120
versionName "2.7.7"
versionCode 121
versionName "2.7.8"
}
buildTypes {
release {

View File

@ -108,7 +108,7 @@ class UnitAutomation{
.filter { containsAttackableEnemy(it,unit.civInfo) }
val distanceToTiles = unit.getDistanceToTiles()
val rangeOfAttack = if(MapUnitCombatant(unit).isMelee()) 1 else unit.getBaseUnit().range
val rangeOfAttack = unit.getRange()
val attackableTiles = ArrayList<AttackableTile>()
// The >0.1 (instead of >0) solves a bug where you've moved 2/3 road tiles,
@ -170,11 +170,12 @@ class UnitAutomation{
}
private fun tryHeadTowardsEnemyCity(unit: MapUnit): Boolean {
if(unit.civInfo.cities.isEmpty()) return false
var enemyCities = unit.civInfo.exploredTiles.map { unit.civInfo.gameInfo.tileMap[it] }
.filter { it.isCityCenter() && it.getOwner() != unit.civInfo }
if(unit.getBaseUnit().unitType.isRanged())
enemyCities = enemyCities.filterNot { it.getCity()!!.health==1 }
if (enemyCities.isNotEmpty() && unit.civInfo.cities.isNotEmpty()) {
val closestReachableEnemyCity = enemyCities
.filter { unit.movementAlgs().canReach(it) }
.minBy { city ->
@ -184,7 +185,6 @@ class UnitAutomation{
unit.movementAlgs().headTowards(closestReachableEnemyCity)
return true
}
}
return false
}

View File

@ -88,7 +88,7 @@ class Battle(val gameInfo:GameInfo=UnCivGame.Current.gameInfo) {
// XP!
if(attacker.isMelee()){
if(defender.getCivilization() != attacker.getCivilization()) // unit was not captured but actually attacked
if(defender.getUnitType()!=UnitType.Civilian) // unit was not captured but actually attacked
{
if (attacker is MapUnitCombatant) attacker.unit.promotions.XP += 5
if (defender is MapUnitCombatant) defender.unit.promotions.XP += 4

View File

@ -221,4 +221,11 @@ class MapUnit {
fun setTransients(){
promotions.unit=this
}
fun getRange(): Int {
if(getBaseUnit().unitType.isMelee()) return 1
var range = getBaseUnit().range
if(hasUnique("+1 Range")) range++
return range
}
}