mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-13 11:30:31 +07:00
Added Cover, March and Charge promotions
This commit is contained in:
parent
5fa9ad0640
commit
ed8e664358
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",
|
||||
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"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 26
|
||||
versionCode 84
|
||||
versionName "2.5.0"
|
||||
versionCode 85
|
||||
versionName "2.5.1"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -30,7 +30,10 @@ class BattleDamage{
|
||||
val modifiers = HashMap<String, Float>()
|
||||
if (combatant is MapUnitCombatant) {
|
||||
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)
|
||||
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(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 isDefenderInRoughTerrain = defenderTile.baseTerrain == "Hill" || defenderTile.terrainFeature == "Forest" || defenderTile.terrainFeature == "Jungle"
|
||||
for (BDM in getBattleDamageModifiersOfUnit(defender.unit)) {
|
||||
@ -99,7 +107,6 @@ class BattleDamage{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (defender.unit.isFortified())
|
||||
modifiers["Fortification"] = 0.2f * defender.unit.getFortificationTurns()
|
||||
|
||||
|
@ -107,7 +107,8 @@ class MapUnit {
|
||||
|
||||
fun endTurn() {
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,10 @@ class PromotionPickerScreen(mapUnit: MapUnit) : PickerScreen() {
|
||||
val availablePromotions = VerticalGroup()
|
||||
availablePromotions.space(10f)
|
||||
val unitType = mapUnit.getBaseUnit().unitType
|
||||
for (promotion in GameBasics.UnitPromotions.values) {
|
||||
if (!promotion.unitTypes.contains(unitType.toString())) continue
|
||||
val isPromotionAvailable = promotion.prerequisites.all { mapUnit.promotions.promotions.contains(it) }
|
||||
val promotionsForUnitType = GameBasics.UnitPromotions.values.filter { it.unitTypes.contains(unitType.toString()) }
|
||||
for (promotion in promotionsForUnitType) {
|
||||
val isPromotionAvailable = promotion.prerequisites.isEmpty()
|
||||
|| promotion.prerequisites.any { mapUnit.promotions.promotions.contains(it) }
|
||||
val unitHasPromotion = mapUnit.promotions.promotions.contains(promotion.name)
|
||||
val promotionButton = Button(skin)
|
||||
|
||||
@ -42,7 +43,9 @@ class PromotionPickerScreen(mapUnit: MapUnit) : PickerScreen() {
|
||||
if(isPromotionAvailable && !unitHasPromotion) rightSideButton.enable()
|
||||
else rightSideButton.disable()
|
||||
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)
|
||||
}
|
||||
availablePromotions.addActor(promotionButton)
|
||||
|
Loading…
Reference in New Issue
Block a user