Great General bonus affects naval units (as long as we don't have Great Admirals in the game)

This commit is contained in:
Yair Morgenstern 2019-06-30 19:48:47 +03:00
parent 76187efc3d
commit 0eb28b9ae7
3 changed files with 16 additions and 10 deletions

View file

@ -1262,11 +1262,18 @@
French:"Général illustre"
}
"Bonus for land units in 2 radius 15%" :{
"Bonus for units in 2 tile radius 15%" :{
Italian:"15% Bonus per le unità nel raggio di 2 caselle"
French:"Bonus de combat +15% pour les unités dans un rayon de 2 cases"
}
/* Not in use now, but will be when we eventually add Great Admiral and split the job
"Bonus for land units in 2 tile radius 15%" :{
Italian:"15% Bonus per le unità terrestri nel raggio di 2 caselle"
Simplified_Chinese:"周围两格地块内的我方所有陆军单位+15%战斗力"
French:"Bonus de combat +15% pour les unités terrestres dans un rayon de 2 cases"
French:"Bonus de combat +15% pour les unités terrestres dans un rayon de 2 cases"
}
*/
////// Unit Promotions

View file

@ -1118,7 +1118,7 @@
name:"Great General",
unbuildable:true,
unitType:"Civilian",
uniques:["Can start an 8-turn golden age","Bonus for land units in 2 radius 15%"] //to do : should be able to build mega-fort
uniques:["Can start an 8-turn golden age","Bonus for units in 2 tile radius 15%"] //to do : should be able to build mega-fort
movement:2
},

View file

@ -66,16 +66,15 @@ class BattleDamage{
modifiers["Missing resource"]=-0.25f
}
//to do : performance improvement
if (combatant.getUnitType().isLandUnit()) {
//todo : performance improvement
if (combatant.getUnitType()!=UnitType.City) {
val nearbyCivUnits = combatant.unit.getTile().getTilesInDistance(2)
.filter {it.civilianUnit?.civInfo == combatant.unit.civInfo}
.map {it.civilianUnit}
if (nearbyCivUnits.any { it!!.hasUnique("Bonus for land units in 2 radius 15%") }) {
modifiers["Great general"]= when {
combatant.unit.civInfo.getNation().unique == "Great general provides double combat bonus, and spawns 50% faster" -> 0.3f
else -> 0.15f
}
if (nearbyCivUnits.any { it!!.hasUnique("Bonus for units in 2 tile radius 15%") }) {
modifiers["Great General"]= if (combatant.unit.civInfo.getNation().unique ==
"Great general provides double combat bonus, and spawns 50% faster") 0.3f
else 0.15f
}
}
}