Added Foreign Legion unique unit - #563

This commit is contained in:
Yair Morgenstern 2019-04-12 13:33:59 +03:00
parent a969c8f479
commit dc2f88765b
6 changed files with 43 additions and 11 deletions

View file

@ -68,6 +68,7 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
### Modern
* [Helmet](https://thenounproject.com/term/helmet/25216/) By Daniel Turner for Great War Infantry
* [Cap](https://thenounproject.com/search/?q=kepi&i=950267) By Creative Mania for Foreign Legion
* [Tank](https://thenounproject.com/term/tank/1287510/) By corpus delicti for Landship
* [Warship](https://thenounproject.com/term/warship/1597474/) By zidney for Destroyer
* [Battleship](https://thenounproject.com/search/?q=battleship&i=1986807) By Vitaliy Gorbachev, KZ for Battleship

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -6763,7 +6763,7 @@
German:"Panzerschiff"
}
// Modern units (do these, yes)
// Modern units
"Landship":{
Italian:"Nave di terra"
Romanian:"Vehicul terestru"
@ -6773,6 +6773,7 @@
German:"Landschiff"
French:"Véhicule terrestre" //official translation but ugly
}
"Great War Infantry":{
Italian:"Fante della Grande Guerra"
Romanian:"Infanteria Marelui Război"
@ -6782,6 +6783,13 @@
German:"Weltkriegs Infanterie"
French:"Infanterie de la grande guerre"
}
"Foreign Legion":{}
"+20% bonus outside friendly territory":{}
"Foreign Land":{ // for battle table combat percentage
}
"Destroyer":{
Italian:"Cacciatorpediniere"
Romanian:"Distrugător"

View file

@ -991,6 +991,20 @@
obsoleteTech:"Plastics"
attackSound:"shot"
},
{
name:"Foreign Legion",
unitType:"Melee",
replaces:"Great War Infantry",
uniqueTo:"France",
movement:2,
strength:50,
cost: 320,
requiredTech:"Replaceable Parts",
hurryCostModifier:20,
upgradesTo:"Infantry",
obsoleteTech:"Plastics"
attackSound:"shot"
},
{
name:"Infantry",
unitType:"Melee",

View file

@ -21,8 +21,8 @@ android {
applicationId "com.unciv.app"
minSdkVersion 14
targetSdkVersion 28
versionCode 226
versionName "2.14.6"
versionCode 227
versionName "2.14.7"
}
// Had to add this crap for Travis to build, it wanted to sign the app

View file

@ -1,6 +1,7 @@
package com.unciv.logic.battle
import com.unciv.logic.map.MapUnit
import com.unciv.logic.map.TileInfo
import com.unciv.models.gamebasics.unit.UnitType
import kotlin.math.max
@ -88,6 +89,8 @@ class BattleDamage{
val modifiers = getGeneralModifiers(attacker, defender)
if(attacker is MapUnitCombatant) {
modifiers.putAll(getTileSpecificModifiers(attacker,defender.getTile()))
val defenderTile = defender.getTile()
val isDefenderInRoughTerrain = defenderTile.baseTerrain=="Hill" || defenderTile.terrainFeature == "Forest" || defenderTile.terrainFeature == "Jungle"
for (BDM in getBattleDamageModifiersOfUnit(attacker.unit)) {
@ -112,11 +115,8 @@ class BattleDamage{
modifiers["Attacker Bonus"] =modifiers["Attacker Bonus"]!! + bonus
else modifiers["Attacker Bonus"] = bonus
}
if(defenderTile.getOwner()!=null && !attacker.getCivInfo().isAtWarWith(defenderTile.getOwner()!!)
&& attacker.getCivInfo().getBuildingUniques().contains("+15% combat strength for units fighting in friendly territory"))
modifiers["Himeji Castle"] = 0.15f
}
else if (attacker is CityCombatant) {
if (attacker.getCivInfo().policies.isAdopted("Oligarchy") && attacker.city.getCenterTile().militaryUnit != null)
modifiers["Oligarchy"] = 0.5f
@ -144,6 +144,8 @@ class BattleDamage{
val modifiers = getGeneralModifiers(defender, attacker)
modifiers.putAll(getTileSpecificModifiers(defender, defender.getTile()))
if (!defender.unit.hasUnique("No defensive terrain bonus")) {
val tileDefenceBonus = defender.getTile().getDefensiveBonus()
if (tileDefenceBonus > 0) modifiers["Terrain"] = tileDefenceBonus
@ -170,16 +172,23 @@ class BattleDamage{
}
}
if(defenderTile.getOwner()!=null && !defender.getCivInfo().isAtWarWith(defenderTile.getOwner()!!)
&& defender.getCivInfo().getBuildingUniques().contains("+15% combat strength for units fighting in friendly territory"))
modifiers["Himeji Castle"] = 0.15f
if (defender.unit.isFortified())
modifiers["Fortification"] = 0.2f * defender.unit.getFortificationTurns()
return modifiers
}
private fun getTileSpecificModifiers(unit: MapUnitCombatant, tile: TileInfo): HashMap<String,Float> {
val modifiers = HashMap<String,Float>()
val isFriendlyTerritory = tile.getOwner()!=null && !unit.getCivInfo().isAtWarWith(tile.getOwner()!!)
if(isFriendlyTerritory && unit.getCivInfo().getBuildingUniques().contains("+15% combat strength for units fighting in friendly territory"))
modifiers["Himeji Castle"] = 0.15f
if(!isFriendlyTerritory && unit.unit.hasUnique("+20% bonus outside friendly territory"))
modifiers["Foreign Land"] = 0.2f
return modifiers
}
private fun modifiersToMultiplicationBonus(modifiers: HashMap<String, Float>): Float {
// modifiers are like 0.1 for a 10% bonus, -0.1 for a 10% loss
var finalModifier = 1f