Finished off promotions, adding Formation I, Formation II, Blitz, Logistics, Mobility, and Volley promotions
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.5 KiB |
BIN
android/Images/OtherIcons/CircleOld.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
android/Images/UnitPromotionIcons/Blitz_(Civ5).png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
android/Images/UnitPromotionIcons/Formation_II_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/Images/UnitPromotionIcons/Formation_I_(Civ5).png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
android/Images/UnitPromotionIcons/Logistics_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/Images/UnitPromotionIcons/Mobility_(Civ5).png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
android/Images/UnitPromotionIcons/Volley_(Civ5).png
Normal file
After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 472 KiB After Width: | Height: | Size: 491 KiB |
|
@ -76,7 +76,7 @@
|
|||
{
|
||||
name:"Scouting II",
|
||||
prerequisites:["Scouting I"],
|
||||
effect:"+1 Visibility Range",
|
||||
effect:"+1 Movement",
|
||||
unitTypes:["Scout"]
|
||||
}
|
||||
{
|
||||
|
@ -110,9 +110,15 @@
|
|||
}
|
||||
{
|
||||
name:"Siege",
|
||||
prerequisites:["Accuracy I","Barrage I","Shock II","Drill II"],
|
||||
effect:"Bonus vs City 25%",
|
||||
unitTypes:["Melee","Ranged","Siege","Mounted"]
|
||||
prerequisites:["Shock II","Drill II"],
|
||||
effect:"Bonus vs City 50%",
|
||||
unitTypes:["Melee"]
|
||||
}
|
||||
{
|
||||
name:"Volley",
|
||||
prerequisites:["Accuracy I","Barrage I"],
|
||||
effect:"Bonus vs City 50%",
|
||||
unitTypes:["Ranged","Siege"]
|
||||
}
|
||||
{
|
||||
name:"Sentry",
|
||||
|
@ -133,4 +139,35 @@
|
|||
unitTypes:["Ranged","Siege"]
|
||||
}
|
||||
|
||||
{
|
||||
name:"Formation I",
|
||||
prerequisites:["Shock II","Drill II"],
|
||||
effect:"Bonus vs Mounted 33%",
|
||||
unitTypes:["Melee","Mounted"]
|
||||
}
|
||||
{
|
||||
name:"Formation II",
|
||||
prerequisites:["Formation I"],
|
||||
effect:"Bonus vs Mounted 33%",
|
||||
unitTypes:["Melee","Mounted"]
|
||||
}
|
||||
{
|
||||
name:"Blitz",
|
||||
prerequisites:["Shock III","Drill III"],
|
||||
effect:"1 additional attack per turn",
|
||||
unitTypes:["Melee","Mounted"]
|
||||
}
|
||||
{
|
||||
name:"Logistics",
|
||||
prerequisites:["Accuracy III","Barrage III"],
|
||||
effect:"1 additional attack per turn",
|
||||
unitTypes:["Ranged","Siege"]
|
||||
}
|
||||
{
|
||||
name:"Mobility",
|
||||
prerequisites:["Shock III","Drill III"],
|
||||
effect:"+1 Movement",
|
||||
unitTypes:["Mounted"]
|
||||
}
|
||||
|
||||
]
|
|
@ -76,7 +76,8 @@ class Battle(val gameInfo:GameInfo) {
|
|||
|
||||
if(attacker is MapUnitCombatant) {
|
||||
val unit = attacker.unit
|
||||
if (unit.hasUnique("Can move after attacking")){
|
||||
if (unit.hasUnique("Can move after attacking")
|
||||
|| (unit.hasUnique("1 additional attack per turn") && unit.attacksThisTurn==0)){
|
||||
if(!attacker.getUnitType().isMelee() || !defender.isDefeated()) // if it was a melee attack and we won, then the unit ALREADY got movement points deducted, for the movement to the enemie's tile!
|
||||
unit.currentMovement = max(0f, unit.currentMovement - 1)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class BattleDamage{
|
|||
|
||||
private fun getBattleDamageModifiersOfUnit(unit:MapUnit): MutableList<BattleDamageModifier> {
|
||||
val modifiers = mutableListOf<BattleDamageModifier>()
|
||||
for (ability in unit.getSpecialAbilities()) {
|
||||
for (ability in unit.getUniques()) {
|
||||
// This beut allows us to have generic unit uniques: "Bonus vs City 75%", "Penatly vs Mounted 25%" etc.
|
||||
val regexResult = Regex("""(Bonus|Penalty) vs (.*) (\d*)%""").matchEntire(ability)
|
||||
if (regexResult == null) continue
|
||||
|
@ -87,7 +87,7 @@ class BattleDamage{
|
|||
}
|
||||
|
||||
if(attacker.isRanged()){
|
||||
val defenceVsRanged = 0.25f * defender.unit.getSpecialAbilities().count{it=="+25% Defence against ranged attacks"}
|
||||
val defenceVsRanged = 0.25f * defender.unit.getUniques().count{it=="+25% Defence against ranged attacks"}
|
||||
if(defenceVsRanged>0) modifiers["defence vs ranged"] = defenceVsRanged
|
||||
}
|
||||
|
||||
|
|
|
@ -37,14 +37,18 @@ class MapUnit {
|
|||
fun baseUnit(): BaseUnit = baseUnit
|
||||
fun getMovementString(): String = DecimalFormat("0.#").format(currentMovement.toDouble()) + "/" + getMaxMovement()
|
||||
fun getTile(): TileInfo = currentTile
|
||||
fun getMaxMovement() = baseUnit.movement
|
||||
fun getMaxMovement(): Int {
|
||||
var movement = baseUnit.movement
|
||||
movement += getUniques().count{it=="+1 Movement"}
|
||||
return movement
|
||||
}
|
||||
|
||||
fun getDistanceToTiles(): HashMap<TileInfo, Float> {
|
||||
val tile = getTile()
|
||||
return movementAlgs().getDistanceToTilesWithinTurn(tile.position,currentMovement)
|
||||
}
|
||||
|
||||
fun getSpecialAbilities(): MutableList<String> {
|
||||
fun getUniques(): MutableList<String> {
|
||||
val abilities = mutableListOf<String>()
|
||||
val baseUnit = baseUnit()
|
||||
if(baseUnit.uniques!=null) abilities.addAll(baseUnit.uniques!!)
|
||||
|
@ -53,12 +57,12 @@ class MapUnit {
|
|||
}
|
||||
|
||||
fun hasUnique(unique:String): Boolean {
|
||||
return getSpecialAbilities().contains(unique)
|
||||
return getUniques().contains(unique)
|
||||
}
|
||||
|
||||
fun getViewableTiles(): MutableList<TileInfo> {
|
||||
var visibilityRange = 2
|
||||
visibilityRange += getSpecialAbilities().count{it=="+1 Visibility Range"}
|
||||
visibilityRange += getUniques().count{it=="+1 Visibility Range"}
|
||||
if(hasUnique("Limited Visibility")) visibilityRange-=1
|
||||
val tile = getTile()
|
||||
if (tile.baseTerrain == "Hill") visibilityRange += 1
|
||||
|
@ -102,7 +106,8 @@ class MapUnit {
|
|||
|
||||
fun canAttack(): Boolean {
|
||||
if(currentMovement==0f) return false
|
||||
if(attacksThisTurn>0) return false
|
||||
if(attacksThisTurn>0 && !hasUnique("1 additional attack per turn")) return false
|
||||
if(attacksThisTurn>1) return false
|
||||
if(hasUnique("Must set up to ranged attack") && action != "Set Up") return false
|
||||
return true
|
||||
}
|
||||
|
@ -211,7 +216,7 @@ class MapUnit {
|
|||
fun endTurn() {
|
||||
doPostTurnAction()
|
||||
if(currentMovement== getMaxMovement().toFloat() // didn't move this turn
|
||||
|| getSpecialAbilities().contains("Unit will heal every turn, even if it performs an action")){
|
||||
|| getUniques().contains("Unit will heal every turn, even if it performs an action")){
|
||||
heal()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,8 +76,8 @@ class BaseUnit : INamed, IConstruction, ICivilopedia {
|
|||
fun getMapUnit(): MapUnit {
|
||||
val unit = MapUnit()
|
||||
unit.name = name
|
||||
unit.currentMovement = movement.toFloat()
|
||||
unit.setTransients()
|
||||
unit.setTransients() // must be after setting name because it sets the bseUnit according to the name
|
||||
unit.currentMovement = unit.getMaxMovement().toFloat() // must be after setTransients because it relies on having the baseUnit set
|
||||
return unit
|
||||
}
|
||||
|
||||
|
|