mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-20 20:59:18 +07: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:
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
|
||||
currentTile = tile
|
||||
|
||||
if(!hasUnique("All healing effects doubled") && type.isLandUnit() && type.isMilitary())
|
||||
{
|
||||
val gainDoubleHealPromotion = tile.neighbors.any{it.containsUnique("Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game")}
|
||||
if(!hasUnique("All healing effects doubled") && type.isLandUnit() && type.isMilitary()) {
|
||||
val gainDoubleHealPromotion = tile.neighbors
|
||||
.any { it.containsUnique("Grants Rejuvenation (all healing effects doubled) to adjacent military land units for the rest of the game") }
|
||||
if (gainDoubleHealPromotion)
|
||||
promotions.addPromotion("Rejuvenation", true)
|
||||
}
|
||||
@ -607,6 +607,7 @@ class MapUnit {
|
||||
.filter { Random.nextFloat() < ANCIENT_RUIN_MAP_REVEAL_CHANCE }
|
||||
.map { it.position }
|
||||
civInfo.exploredTiles.addAll(tilesToReveal)
|
||||
civInfo.updateViewableTiles()
|
||||
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
|
||||
|
||||
class ModOptions {
|
||||
var isBaseRuleset = false
|
||||
var techsToRemove = HashSet<String>()
|
||||
var buildingsToRemove = HashSet<String>()
|
||||
var unitsToRemove = HashSet<String>()
|
||||
@ -194,11 +195,12 @@ object RulesetCache :HashMap<String,Ruleset>() {
|
||||
|
||||
fun getComplexRuleset(mods: LinkedHashSet<String>): Ruleset {
|
||||
val newRuleset = Ruleset()
|
||||
val loadedMods = mods.filter { containsKey(it) }.map { this[it]!! }
|
||||
if (loadedMods.none { it.modOptions.isBaseRuleset })
|
||||
newRuleset.add(getBaseRuleset())
|
||||
for (mod in mods)
|
||||
if (containsKey(mod)) {
|
||||
newRuleset.add(this[mod]!!)
|
||||
newRuleset.mods += mod
|
||||
for (mod in loadedMods.sortedByDescending { it.modOptions.isBaseRuleset }) {
|
||||
newRuleset.add(mod)
|
||||
newRuleset.mods += mod.name
|
||||
}
|
||||
newRuleset.updateBuildingCosts() // only after we've added all the mods can we calculate the building costs
|
||||
|
||||
|
Reference in New Issue
Block a user