New civilization: Denmark (#2370)

* Enable the Denmark civilization

* Nation unique ability is implemented

* Units unique abilities are implemented

* Unit icons

* Misprint in the tech name is corrected
This commit is contained in:
Jack Rainy 2020-04-11 22:31:53 +03:00 committed by GitHub
parent 2b120f0b2a
commit 0624542fd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 18 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -607,9 +607,7 @@
"Huaras","Riobamba","Caxamalca","Sausa","Tambo Colorado","Huaca","Tumbes","Chan Chan","Sipan","Pachacamac", "Huaras","Riobamba","Caxamalca","Sausa","Tambo Colorado","Huaca","Tumbes","Chan Chan","Sipan","Pachacamac",
"Llactapata","Pisac","Kuelap","Pajaten","Chucuito","Choquequirao"] "Llactapata","Pisac","Kuelap","Pajaten","Chucuito","Choquequirao"]
}, },
/*
{ {
//NEEDS SNOW AND ICE
"name": "Denmark", "name": "Denmark",
"leaderName": "Harald Bluetooth", "leaderName": "Harald Bluetooth",
"adjective": ["Danish"], "adjective": ["Danish"],
@ -633,7 +631,7 @@
"Sarpsborg","Odense","Aalborg","Stavanger","Vorbasse","Schleswig","Kristiansand","Halogaland","Randers", "Sarpsborg","Odense","Aalborg","Stavanger","Vorbasse","Schleswig","Kristiansand","Halogaland","Randers",
"Fredrikstad","Kolding","Horsens","Tromsoe","Vejle","Koge","Sandnes","Holstebro","Slagelse","Drammen", "Fredrikstad","Kolding","Horsens","Tromsoe","Vejle","Koge","Sandnes","Holstebro","Slagelse","Drammen",
"Hillerod","Sonderborg","Skien","Svendborg","Holbaek","Hjorring","Fladstrand","Haderslev","Ringsted","Skrive"] "Hillerod","Sonderborg","Skien","Svendborg","Holbaek","Hjorring","Fladstrand","Haderslev","Ringsted","Skrive"]
}, }, /*
{ {
"name": "Sweden", "name": "Sweden",
"leaderName": "Gustavus Adolphus", "leaderName": "Gustavus Adolphus",

View File

@ -484,7 +484,6 @@
"attackSound": "metalhit" "attackSound": "metalhit"
//Aside from the Great Generals II promotion, Samurai should also create Fishing Boats (not now, surely) //Aside from the Great Generals II promotion, Samurai should also create Fishing Boats (not now, surely)
}, },
/*
{ {
"name": "Berserker", "name": "Berserker",
"replaces": "Longswordsman", "replaces": "Longswordsman",
@ -493,7 +492,7 @@
"movement": 3, "movement": 3,
"strength": 21, "strength": 21,
"cost": 120, "cost": 120,
"requiredTech": "Steel", "requiredTech": "Metal Casting",
"upgradesTo": "Musketman", "upgradesTo": "Musketman",
"obsoleteTech": "Metallurgy", "obsoleteTech": "Metallurgy",
"requiredResource": "Iron", "requiredResource": "Iron",
@ -503,7 +502,6 @@
"attackSound": "metalhit" "attackSound": "metalhit"
//Danish unique unit. Can attack from the sea without any penalty, and moves faster. //Danish unique unit. Can attack from the sea without any penalty, and moves faster.
}, },
*/
{ {
"name": "Pikeman", "name": "Pikeman",
"unitType": "Melee", "unitType": "Melee",
@ -894,10 +892,8 @@
"hurryCostModifier": 20, "hurryCostModifier": 20,
"attackSound": "shot" "attackSound": "shot"
}, },
/*
{ {
"name": "Norvegian Ski Infantry", "name": "Norwegian Ski Infantry",
"unitType": "Melee", "unitType": "Melee",
"replaces": "Rifleman", "replaces": "Rifleman",
"uniqueTo": "Denmark", "uniqueTo": "Denmark",
@ -907,11 +903,10 @@
"requiredTech": "Rifling", "requiredTech": "Rifling",
"obsoleteTech": "Replaceable Parts", "obsoleteTech": "Replaceable Parts",
"upgradesTo": "Great War Infantry", "upgradesTo": "Great War Infantry",
"uniques": ["Bonus in Snow, Tundra and Hills"], "uniques": ["+25% bonus in Snow, Tundra and Hills", "Double movement in Snow, Tundra and Hills"],
"hurryCostModifier": 20, "hurryCostModifier": 20,
"attackSound": "shot" "attackSound": "shot"
}, },
*/
{ {
"name": "Cavalry", "name": "Cavalry",
"unitType": "Mounted", "unitType": "Mounted",

View File

@ -125,7 +125,7 @@ object BattleDamage {
else modifiers["Attacker Bonus"] = bonus else modifiers["Attacker Bonus"] = bonus
} }
if(attacker.unit.isEmbarked()) if(attacker.unit.isEmbarked() && !attacker.unit.hasUnique("Amphibious"))
modifiers["Landing"] = -0.5f modifiers["Landing"] = -0.5f
if (attacker.isMelee()) { if (attacker.isMelee()) {
@ -206,6 +206,14 @@ object BattleDamage {
if(!tile.isFriendlyTerritory(unit.getCivInfo()) && unit.unit.hasUnique("+20% bonus outside friendly territory")) if(!tile.isFriendlyTerritory(unit.getCivInfo()) && unit.unit.hasUnique("+20% bonus outside friendly territory"))
modifiers["Foreign Land"] = 0.2f modifiers["Foreign Land"] = 0.2f
if (unit.unit.hasUnique("+25% bonus in Snow, Tundra and Hills") &&
(tile.baseTerrain == Constants.snow
|| tile.baseTerrain == Constants.tundra
|| tile.baseTerrain == Constants.hill) &&
// except when there is a vegetation
(tile.terrainFeature != Constants.forest
|| tile.terrainFeature != Constants.jungle))
modifiers[tile.baseTerrain] = 0.25f
if(unit.getCivInfo().nation.unique == UniqueAbility.WAYFINDING && tile.getTilesInDistance(2).any { it.improvement=="Moai" }) if(unit.getCivInfo().nation.unique == UniqueAbility.WAYFINDING && tile.getTilesInDistance(2).any { it.improvement=="Moai" })
modifiers["Moai"] = 0.1f modifiers["Moai"] = 0.1f

View File

@ -38,6 +38,7 @@ class MapUnit {
@Transient var roughTerrainPenalty = false @Transient var roughTerrainPenalty = false
@Transient var doubleMovementInCoast = false @Transient var doubleMovementInCoast = false
@Transient var doubleMovementInForestAndJungle = false @Transient var doubleMovementInForestAndJungle = false
@Transient var doubleMovementInSnowTundraAndHills = false
lateinit var owner: String lateinit var owner: String
lateinit var name: String lateinit var name: String
@ -133,10 +134,11 @@ class MapUnit {
uniques.addAll(promotions.promotions.map { currentTile.tileMap.gameInfo.ruleSet.unitPromotions[it]!!.effect }) uniques.addAll(promotions.promotions.map { currentTile.tileMap.gameInfo.ruleSet.unitPromotions[it]!!.effect })
tempUniques = uniques tempUniques = uniques
if("Ignores terrain cost" in uniques) ignoresTerrainCost=true if("Ignores terrain cost" in uniques) ignoresTerrainCost = true
if("Rough terrain penalty" in uniques) roughTerrainPenalty=true if("Rough terrain penalty" in uniques) roughTerrainPenalty = true
if("Double movement in coast" in uniques) doubleMovementInCoast=true if("Double movement in coast" in uniques) doubleMovementInCoast = true
if("Double movement rate through Forest and Jungle" in uniques) doubleMovementInForestAndJungle=true if("Double movement rate through Forest and Jungle" in uniques) doubleMovementInForestAndJungle = true
if("Double movement in Snow, Tundra and Hills" in uniques) doubleMovementInSnowTundraAndHills = true
} }
fun hasUnique(unique:String): Boolean { fun hasUnique(unique:String): Boolean {
@ -227,6 +229,7 @@ class MapUnit {
fun getEmbarkedMovement(): Int { fun getEmbarkedMovement(): Int {
var movement=2 var movement=2
movement += civInfo.tech.getTechUniques().count { it == "Increases embarked movement +1" } movement += civInfo.tech.getTechUniques().count { it == "Increases embarked movement +1" }
if (civInfo.nation.unique == UniqueAbility.VIKING_FURY) movement +=1
return movement return movement
} }

View File

@ -10,7 +10,8 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
// This function is called ALL THE TIME and should be as time-optimal as possible! // This function is called ALL THE TIME and should be as time-optimal as possible!
fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo, civInfo: CivilizationInfo): Float { fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo, civInfo: CivilizationInfo): Float {
if ((from.isLand != to.isLand) && unit.type.isLandUnit()) if ((from.isLand != to.isLand) && unit.type.isLandUnit() &&
(unit.civInfo.nation.unique != UniqueAbility.VIKING_FURY))
return 100f // this is embarkment or disembarkment, and will take the entire turn return 100f // this is embarkment or disembarkment, and will take the entire turn
var extraCost = 0f var extraCost = 0f
@ -39,6 +40,11 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
if (unit.doubleMovementInCoast && to.baseTerrain == Constants.coast) if (unit.doubleMovementInCoast && to.baseTerrain == Constants.coast)
return 1 / 2f + extraCost return 1 / 2f + extraCost
if (unit.doubleMovementInSnowTundraAndHills && to.baseTerrain == Constants.hill)
return 1f + extraCost // usually hills take 2
if (unit.doubleMovementInSnowTundraAndHills && (to.baseTerrain == Constants.snow || to.baseTerrain == Constants.tundra))
return 1 / 2f + extraCost
return to.getLastTerrain().movementCost.toFloat() + extraCost // no road return to.getLastTerrain().movementCost.toFloat() + extraCost // no road
} }

View File

@ -3,6 +3,7 @@ package com.unciv.ui.worldscreen.unit
import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.Color
import com.unciv.Constants import com.unciv.Constants
import com.unciv.UncivGame import com.unciv.UncivGame
import com.unciv.UniqueAbility
import com.unciv.logic.automation.UnitAutomation import com.unciv.logic.automation.UnitAutomation
import com.unciv.logic.automation.WorkerAutomation import com.unciv.logic.automation.WorkerAutomation
import com.unciv.logic.civilization.CivilizationInfo import com.unciv.logic.civilization.CivilizationInfo
@ -183,8 +184,13 @@ object UnitActions {
} }
tile.improvement = null tile.improvement = null
if (tile.resource!=null) tile.getOwner()?.updateDetailedCivResources() // this might take away a resource if (tile.resource!=null) tile.getOwner()?.updateDetailedCivResources() // this might take away a resource
if (!unit.hasUnique("No movement cost to pillage")) unit.useMovementPoints(1f)
if (!unit.hasUnique("No movement cost to pillage") &&
(!unit.type.isMelee() || unit.civInfo.nation.unique != UniqueAbility.VIKING_FURY))
unit.useMovementPoints(1f)
unit.healBy(25) unit.healBy(25)
}.takeIf { unit.currentMovement > 0 && canPillage(unit, tile) }) }.takeIf { unit.currentMovement > 0 && canPillage(unit, tile) })
} }