mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Added Great Wall wonder
This commit is contained in:
parent
064488ca37
commit
12719c1e0e
@ -158,6 +158,7 @@ All the following are from [the Noun Project](https://thenounproject.com) licenc
|
||||
* [Bazaar](https://thenounproject.com/term/bazaar/902288/) By Tokka Elkholy
|
||||
* [Shekel Coin](https://thenounproject.com/term/shekel-coin/204154/) By Till Teenck for Mint
|
||||
* [Aqueduct](https://thenounproject.com/term/aqueduct/24639/) By Arthur Shlain
|
||||
* [Great Wall](https://thenounproject.com/search/?q=great%20wall&i=545909) By icon 54
|
||||
|
||||
### Medieval Era
|
||||
|
||||
|
BIN
android/Images/BuildingIcons/Great Wall.png
Normal file
BIN
android/Images/BuildingIcons/Great Wall.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 939 KiB After Width: | Height: | Size: 947 KiB |
@ -42,6 +42,13 @@
|
||||
greatPersonPoints:{production:1},
|
||||
requiredTech:"Calendar"
|
||||
},
|
||||
{
|
||||
name:"Library",
|
||||
hurryCostModifier:25,
|
||||
maintenance:1,
|
||||
uniques:["+1 Science Per 2 Population"],
|
||||
requiredTech:"Writing"
|
||||
},
|
||||
{
|
||||
name:"The Great Library",
|
||||
science:3,
|
||||
@ -52,13 +59,6 @@
|
||||
freeTechs:1,
|
||||
requiredTech:"Writing"
|
||||
},
|
||||
{
|
||||
name:"Library",
|
||||
hurryCostModifier:25,
|
||||
maintenance:1,
|
||||
uniques:["+1 Science Per 2 Population"],
|
||||
requiredTech:"Writing"
|
||||
},
|
||||
{
|
||||
name:"Paper Maker",
|
||||
replaces:"Library",
|
||||
@ -234,6 +234,16 @@
|
||||
uniques:["40% of food is carried over after a new citizen is born"]
|
||||
requiredTech:"Engineering"
|
||||
},
|
||||
{
|
||||
name:"Great Wall",
|
||||
culture:1,
|
||||
greatPersonPoints:{production:1},
|
||||
isWonder:true,
|
||||
providesFreeBuilding: "Walls",
|
||||
freeTechs:1,
|
||||
uniques:["Enemy land units must spend 1 extra movement point when inside your territory (obsolete upon Dynamite)"]
|
||||
requiredTech:"Engineering"
|
||||
},
|
||||
|
||||
// Medieval Era
|
||||
|
||||
|
@ -47,6 +47,9 @@ class CivilizationInfo {
|
||||
@Transient var viewableTiles = HashSet<TileInfo>()
|
||||
@Transient var viewableInvisibleUnitsTiles = HashSet<TileInfo>()
|
||||
|
||||
// This is for performance since every movement calculation depends on this, see MapUnit comment
|
||||
@Transient var hasActiveGreatWall = false
|
||||
|
||||
var gold = 0
|
||||
var happiness = 15
|
||||
@Deprecated("As of 2.11.1") var difficulty = "Chieftain"
|
||||
@ -351,6 +354,12 @@ class CivilizationInfo {
|
||||
}
|
||||
setCitiesConnectedToCapitalTransients()
|
||||
updateViewableTiles()
|
||||
updateHasActiveGreatWall()
|
||||
}
|
||||
|
||||
fun updateHasActiveGreatWall(){
|
||||
hasActiveGreatWall = !tech.isResearched("Dynamite") &&
|
||||
getBuildingUniques().contains("Enemy land units must spend 1 extra movement point when inside your territory (obsolete upon Dynamite)")
|
||||
}
|
||||
|
||||
fun startTurn(){
|
||||
@ -402,6 +411,7 @@ class CivilizationInfo {
|
||||
goldenAges.endTurn(happiness)
|
||||
getCivUnits().forEach { it.endTurn() }
|
||||
diplomacy.values.forEach{it.nextTurn()}
|
||||
updateHasActiveGreatWall()
|
||||
}
|
||||
|
||||
fun getGreatPersonPointsForNextTurn(): Stats {
|
||||
|
@ -1,10 +1,19 @@
|
||||
package com.unciv.logic.map
|
||||
|
||||
import com.badlogic.gdx.math.Vector2
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
|
||||
class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
val tileMap = unit.getTile().tileMap
|
||||
|
||||
private fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo, civInfo: CivilizationInfo): Float {
|
||||
var cost = getMovementCostBetweenAdjacentTiles(from,to)
|
||||
|
||||
val toOwner = to.getOwner()
|
||||
if(toOwner!=null && civInfo.isAtWarWith(toOwner) && toOwner.hasActiveGreatWall) cost += 1
|
||||
return cost
|
||||
}
|
||||
|
||||
private fun getMovementCostBetweenAdjacentTiles(from: TileInfo, to: TileInfo): Float {
|
||||
|
||||
if(unit.type.isLandUnit() && (from.isLand() != to.isLand()))
|
||||
@ -50,7 +59,7 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
// cities and units goes kaput.
|
||||
|
||||
else {
|
||||
val distanceBetweenTiles = getMovementCostBetweenAdjacentTiles(tileToCheck, neighbor)
|
||||
val distanceBetweenTiles = getMovementCostBetweenAdjacentTiles(tileToCheck, neighbor, unit.civInfo)
|
||||
totalDistanceToTile = distanceToTiles[tileToCheck]!! + distanceBetweenTiles
|
||||
}
|
||||
|
||||
@ -169,12 +178,12 @@ class UnitMovementAlgorithms(val unit:MapUnit) {
|
||||
reversedList.add(currentTile)
|
||||
val distanceToCurrentTile = distanceToTiles[currentTile]!!
|
||||
if(currentUnitTile in currentTile.neighbors
|
||||
&& getMovementCostBetweenAdjacentTiles(currentUnitTile,currentTile) == distanceToCurrentTile)
|
||||
&& getMovementCostBetweenAdjacentTiles(currentUnitTile,currentTile,unit.civInfo) == distanceToCurrentTile)
|
||||
return reversedList.reversed()
|
||||
|
||||
for(tile in currentTile.neighbors)
|
||||
currentTile = currentTile.neighbors.first{it in distanceToTiles
|
||||
&& getMovementCostBetweenAdjacentTiles(it,currentTile) == distanceToCurrentTile - distanceToTiles[it]!!}
|
||||
&& getMovementCostBetweenAdjacentTiles(it,currentTile,unit.civInfo) == distanceToCurrentTile - distanceToTiles[it]!!}
|
||||
}
|
||||
throw Exception("We couldn't get the path between the two tiles")
|
||||
}
|
||||
|
@ -265,6 +265,8 @@ class Building : NamedStats(), IConstruction{
|
||||
city.population.autoAssignPopulation()
|
||||
}
|
||||
}
|
||||
"Enemy land units must spend 1 extra movement point when inside your territory (obsolete upon Dynamite)" in uniques ->
|
||||
civInfo.updateHasActiveGreatWall()
|
||||
}
|
||||
|
||||
if (freeTechs != 0) civInfo.tech.freeTechs += freeTechs
|
||||
|
Loading…
x
Reference in New Issue
Block a user