mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-10 15:59:33 +07:00
Added Cover, March and Charge promotions
This commit is contained in:
BIN
android/assets/UnitPromotionIcons/Charge_(Civ5).png
Normal file
BIN
android/assets/UnitPromotionIcons/Charge_(Civ5).png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/Cover_II_(Civ5).png
Normal file
BIN
android/assets/UnitPromotionIcons/Cover_II_(Civ5).png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/Cover_I_(Civ5).png
Normal file
BIN
android/assets/UnitPromotionIcons/Cover_I_(Civ5).png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
android/assets/UnitPromotionIcons/March_(Civ5).png
Normal file
BIN
android/assets/UnitPromotionIcons/March_(Civ5).png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
@ -85,4 +85,28 @@
|
|||||||
effect:"+1 Visibility Range",
|
effect:"+1 Visibility Range",
|
||||||
unitTypes:["Scout"]
|
unitTypes:["Scout"]
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
name:"Cover I",
|
||||||
|
effect:"+25% Defence against ranged attacks",
|
||||||
|
unitTypes:["Melee","Ranged","Siege"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Cover II",
|
||||||
|
prerequisites:["Cover I"],
|
||||||
|
effect:"+25% Defence against ranged attacks",
|
||||||
|
unitTypes:["Melee","Ranged","Siege"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"March",
|
||||||
|
prerequisites:["Accuracy II","Barrage II","Shock III","Drill III"],
|
||||||
|
effect:"Unit will heal every turn, even if it performs an action",
|
||||||
|
unitTypes:["Melee","Ranged","Siege","Mounted"]
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name:"Charge",
|
||||||
|
prerequisites:["Shock II","Drill II"],
|
||||||
|
effect:"Bonus vs wounded units 33%",
|
||||||
|
unitTypes:["Mounted"]
|
||||||
|
}
|
||||||
|
|
||||||
]
|
]
|
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.game"
|
applicationId "com.unciv.game"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 84
|
versionCode 85
|
||||||
versionName "2.5.0"
|
versionName "2.5.1"
|
||||||
}
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
|
@ -30,7 +30,10 @@ class BattleDamage{
|
|||||||
val modifiers = HashMap<String, Float>()
|
val modifiers = HashMap<String, Float>()
|
||||||
if (combatant is MapUnitCombatant) {
|
if (combatant is MapUnitCombatant) {
|
||||||
for (BDM in getBattleDamageModifiersOfUnit(combatant.unit)) {
|
for (BDM in getBattleDamageModifiersOfUnit(combatant.unit)) {
|
||||||
if (BDM.vs == enemy.getUnitType().toString()) modifiers[BDM.getText()] = BDM.modificationAmount
|
if (BDM.vs == enemy.getUnitType().toString())
|
||||||
|
modifiers[BDM.getText()] = BDM.modificationAmount
|
||||||
|
if(BDM.vs == "wounded units" && enemy is MapUnitCombatant && enemy.getHealth()<100)
|
||||||
|
modifiers[BDM.getText()] = BDM.modificationAmount
|
||||||
}
|
}
|
||||||
if (combatant.getCivilization().happiness < 0)
|
if (combatant.getCivilization().happiness < 0)
|
||||||
modifiers["Unhappiness"] = 0.02f * combatant.getCivilization().happiness //https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
|
modifiers["Unhappiness"] = 0.02f * combatant.getCivilization().happiness //https://www.carlsguides.com/strategy/civilization5/war/combatbonuses.php
|
||||||
@ -83,6 +86,11 @@ class BattleDamage{
|
|||||||
if (tileDefenceBonus > 0) modifiers["Terrain"] = tileDefenceBonus
|
if (tileDefenceBonus > 0) modifiers["Terrain"] = tileDefenceBonus
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(attacker.isRanged()){
|
||||||
|
val defenceVsRanged = 0.25f * defender.unit.getSpecialAbilities().count{it=="+25% Defence against ranged attacks"}
|
||||||
|
if(defenceVsRanged>0) modifiers["defence vs ranged"] = defenceVsRanged
|
||||||
|
}
|
||||||
|
|
||||||
val defenderTile = defender.getTile()
|
val defenderTile = defender.getTile()
|
||||||
val isDefenderInRoughTerrain = defenderTile.baseTerrain == "Hill" || defenderTile.terrainFeature == "Forest" || defenderTile.terrainFeature == "Jungle"
|
val isDefenderInRoughTerrain = defenderTile.baseTerrain == "Hill" || defenderTile.terrainFeature == "Forest" || defenderTile.terrainFeature == "Jungle"
|
||||||
for (BDM in getBattleDamageModifiersOfUnit(defender.unit)) {
|
for (BDM in getBattleDamageModifiersOfUnit(defender.unit)) {
|
||||||
@ -99,7 +107,6 @@ class BattleDamage{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (defender.unit.isFortified())
|
if (defender.unit.isFortified())
|
||||||
modifiers["Fortification"] = 0.2f * defender.unit.getFortificationTurns()
|
modifiers["Fortification"] = 0.2f * defender.unit.getFortificationTurns()
|
||||||
|
|
||||||
|
@ -107,7 +107,8 @@ class MapUnit {
|
|||||||
|
|
||||||
fun endTurn() {
|
fun endTurn() {
|
||||||
doPostTurnAction()
|
doPostTurnAction()
|
||||||
if(currentMovement==maxMovement.toFloat()){ // didn't move this turn
|
if(currentMovement==maxMovement.toFloat() // didn't move this turn
|
||||||
|
|| getSpecialAbilities().contains("Unit will heal every turn, even if it performs an action")){
|
||||||
heal()
|
heal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,10 @@ class PromotionPickerScreen(mapUnit: MapUnit) : PickerScreen() {
|
|||||||
val availablePromotions = VerticalGroup()
|
val availablePromotions = VerticalGroup()
|
||||||
availablePromotions.space(10f)
|
availablePromotions.space(10f)
|
||||||
val unitType = mapUnit.getBaseUnit().unitType
|
val unitType = mapUnit.getBaseUnit().unitType
|
||||||
for (promotion in GameBasics.UnitPromotions.values) {
|
val promotionsForUnitType = GameBasics.UnitPromotions.values.filter { it.unitTypes.contains(unitType.toString()) }
|
||||||
if (!promotion.unitTypes.contains(unitType.toString())) continue
|
for (promotion in promotionsForUnitType) {
|
||||||
val isPromotionAvailable = promotion.prerequisites.all { mapUnit.promotions.promotions.contains(it) }
|
val isPromotionAvailable = promotion.prerequisites.isEmpty()
|
||||||
|
|| promotion.prerequisites.any { mapUnit.promotions.promotions.contains(it) }
|
||||||
val unitHasPromotion = mapUnit.promotions.promotions.contains(promotion.name)
|
val unitHasPromotion = mapUnit.promotions.promotions.contains(promotion.name)
|
||||||
val promotionButton = Button(skin)
|
val promotionButton = Button(skin)
|
||||||
|
|
||||||
@ -42,7 +43,9 @@ class PromotionPickerScreen(mapUnit: MapUnit) : PickerScreen() {
|
|||||||
if(isPromotionAvailable && !unitHasPromotion) rightSideButton.enable()
|
if(isPromotionAvailable && !unitHasPromotion) rightSideButton.enable()
|
||||||
else rightSideButton.disable()
|
else rightSideButton.disable()
|
||||||
var descriptionText = promotion.effect
|
var descriptionText = promotion.effect
|
||||||
if(promotion.prerequisites.isNotEmpty()) descriptionText +="\nRequires: "+promotion.prerequisites.joinToString()
|
if(promotion.prerequisites.isNotEmpty()) descriptionText +="\nRequires: "+
|
||||||
|
promotion.prerequisites.filter { promotionsForUnitType.any { promotion -> promotion.name==it } }
|
||||||
|
.joinToString(" OR ")
|
||||||
descriptionLabel.setText(descriptionText)
|
descriptionLabel.setText(descriptionText)
|
||||||
}
|
}
|
||||||
availablePromotions.addActor(promotionButton)
|
availablePromotions.addActor(promotionButton)
|
||||||
|
Reference in New Issue
Block a user