mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Can now specify a mod as a 'base ruleset', and the regular base ruleset will not be added
This means that you can 'start from scratch' and build whatever you want - example "Scenario" in unciv-mod-example repo Obviously we'll have to change around a lot of things or this to work well, but it's a start
This commit is contained in:
parent
ffe8691df9
commit
4c48cfe4f3
Binary file not shown.
Before Width: | Height: | Size: 429 KiB After Width: | Height: | Size: 429 KiB |
@ -499,9 +499,9 @@ class MapUnit {
|
|||||||
// addPromotion requires currentTile to be valid because it accesses ruleset through it
|
// addPromotion requires currentTile to be valid because it accesses ruleset through it
|
||||||
currentTile = tile
|
currentTile = tile
|
||||||
|
|
||||||
if(!hasUnique("All healing effects doubled") && type.isLandUnit() && type.isMilitary())
|
if(!hasUnique("All healing effects doubled") && type.isLandUnit() && type.isMilitary()) {
|
||||||
{
|
val gainDoubleHealPromotion = tile.neighbors
|
||||||
val gainDoubleHealPromotion = tile.neighbors.any{it.containsUnique("Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game")}
|
.any { it.containsUnique("Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game") }
|
||||||
if (gainDoubleHealPromotion)
|
if (gainDoubleHealPromotion)
|
||||||
promotions.addPromotion("Rejuvenation", true)
|
promotions.addPromotion("Rejuvenation", true)
|
||||||
}
|
}
|
||||||
@ -607,6 +607,7 @@ class MapUnit {
|
|||||||
.filter { Random.nextFloat() < ANCIENT_RUIN_MAP_REVEAL_CHANCE }
|
.filter { Random.nextFloat() < ANCIENT_RUIN_MAP_REVEAL_CHANCE }
|
||||||
.map { it.position }
|
.map { it.position }
|
||||||
civInfo.exploredTiles.addAll(tilesToReveal)
|
civInfo.exploredTiles.addAll(tilesToReveal)
|
||||||
|
civInfo.updateViewableTiles()
|
||||||
civInfo.addNotification("We have found a crudely-drawn map in the ruins!", tile.position, Color.RED)
|
civInfo.addNotification("We have found a crudely-drawn map in the ruins!", tile.position, Color.RED)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ import com.unciv.models.stats.INamed
|
|||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
|
|
||||||
class ModOptions {
|
class ModOptions {
|
||||||
|
var isBaseRuleset = false
|
||||||
var techsToRemove = HashSet<String>()
|
var techsToRemove = HashSet<String>()
|
||||||
var buildingsToRemove = HashSet<String>()
|
var buildingsToRemove = HashSet<String>()
|
||||||
var unitsToRemove = HashSet<String>()
|
var unitsToRemove = HashSet<String>()
|
||||||
@ -194,11 +195,12 @@ object RulesetCache :HashMap<String,Ruleset>() {
|
|||||||
|
|
||||||
fun getComplexRuleset(mods: LinkedHashSet<String>): Ruleset {
|
fun getComplexRuleset(mods: LinkedHashSet<String>): Ruleset {
|
||||||
val newRuleset = Ruleset()
|
val newRuleset = Ruleset()
|
||||||
|
val loadedMods = mods.filter { containsKey(it) }.map { this[it]!! }
|
||||||
|
if (loadedMods.none { it.modOptions.isBaseRuleset })
|
||||||
newRuleset.add(getBaseRuleset())
|
newRuleset.add(getBaseRuleset())
|
||||||
for (mod in mods)
|
for (mod in loadedMods.sortedByDescending { it.modOptions.isBaseRuleset }) {
|
||||||
if (containsKey(mod)) {
|
newRuleset.add(mod)
|
||||||
newRuleset.add(this[mod]!!)
|
newRuleset.mods += mod.name
|
||||||
newRuleset.mods += mod
|
|
||||||
}
|
}
|
||||||
newRuleset.updateBuildingCosts() // only after we've added all the mods can we calculate the building costs
|
newRuleset.updateBuildingCosts() // only after we've added all the mods can we calculate the building costs
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user