diff --git a/android/assets/jsons/Units.json b/android/assets/jsons/Units.json index 0e6566068c..cb9b7466f4 100644 --- a/android/assets/jsons/Units.json +++ b/android/assets/jsons/Units.json @@ -81,7 +81,6 @@ obsoleteTech:"Metal Casting", upgradesTo:"Swordsman", attackSound:"nonmetalhit" - //Barbarian unique unit }, { name:"Archer", @@ -92,8 +91,8 @@ cost: 40, hurryCostModifier:20, requiredTech:"Archery", - obsoleteTech:"Machinery",//Should be Construction - upgradesTo:"Crossbowman",//Should be Composite Bowman + obsoleteTech:"Machinery", + upgradesTo:"Crossbowman" attackSound:"arrow" }, { diff --git a/android/assets/mods/ExampleIncaMod/Images/ImprovementIcons/Terrace farm.png b/android/assets/mods/ExampleIncaMod/Images/ImprovementIcons/Terrace farm.png new file mode 100644 index 0000000000..ff9c11c13b Binary files /dev/null and b/android/assets/mods/ExampleIncaMod/Images/ImprovementIcons/Terrace farm.png differ diff --git a/android/assets/mods/ExampleIncaMod/Images/NationIcons/Inca.png b/android/assets/mods/ExampleIncaMod/Images/NationIcons/Inca.png new file mode 100644 index 0000000000..7e2c79f179 Binary files /dev/null and b/android/assets/mods/ExampleIncaMod/Images/NationIcons/Inca.png differ diff --git a/android/assets/mods/ExampleIncaMod/Images/UnitIcons/Slinger.png b/android/assets/mods/ExampleIncaMod/Images/UnitIcons/Slinger.png new file mode 100644 index 0000000000..457515aeaa Binary files /dev/null and b/android/assets/mods/ExampleIncaMod/Images/UnitIcons/Slinger.png differ diff --git a/android/assets/mods/ExampleIncaMod/game.atlas b/android/assets/mods/ExampleIncaMod/game.atlas new file mode 100644 index 0000000000..7e06b8b2f8 --- /dev/null +++ b/android/assets/mods/ExampleIncaMod/game.atlas @@ -0,0 +1,27 @@ + +game.png +size: 512,128 +format: RGBA8888 +filter: MipMapLinearLinear,MipMapLinearLinear +repeat: none +ImprovementIcons/Terrace farm + rotate: false + xy: 206, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +NationIcons/Inca + rotate: false + xy: 2, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 +UnitIcons/Slinger + rotate: false + xy: 104, 2 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 diff --git a/android/assets/mods/ExampleIncaMod/game.png b/android/assets/mods/ExampleIncaMod/game.png new file mode 100644 index 0000000000..8a84b5dca1 Binary files /dev/null and b/android/assets/mods/ExampleIncaMod/game.png differ diff --git a/android/assets/mods/ExampleIncaMod/jsons/Nations/Nations.json b/android/assets/mods/ExampleIncaMod/jsons/Nations/Nations.json new file mode 100644 index 0000000000..e38d64e72c --- /dev/null +++ b/android/assets/mods/ExampleIncaMod/jsons/Nations/Nations.json @@ -0,0 +1,41 @@ +[ + + { + name:"Inca", + leaderName:"Pachacuti", + adjective:["Incan"], + startBias:["Hill"], + preferredVictoryType:"Cultural", + + startIntroPart1: "Oh ye who remakes the world, your loyal subjects greet you, King Pachacuti Sapa Inca, ruler of the Inca people! From the beginnings in the small state of Cusco, the Incans displayed their potential for greatness, marching to war against their many enemies, crushing their armies into dust and carving for themselves a mighty empire stretching from Ecuador to Chile. Indeed, they build the greatest empire ever seen in all pre-Columbian Americas. More than mere soldiers, your people were great builders and artists as well, and the remnants of their works still awe and inspire the world today." + startIntroPart2: "Oh King Pachacuti, truly are you called 'Earth Shaker'! Will you once again call upon the ground itself to a fight at your side? Your armies await your signal. Will you restore the glory of your empire? Can you build a civilization that will stand the test of time?" + + declaringWar:"Resistance is futile! You cannot hope to stand against the mighty Incan empire. If you will not surrender immediately, then prepare for war!" + attacked:"Declare war on me?!? You can't, because I declare war on you first!" + defeated:"How did you darken the sun? I ruled with diligence and mercy—see that you do so as well." + introduction:"How are you? You stand before Pachacuti Inca Yupanqui." + + neutralHello:"How are you doing?" + neutralLetsHearIt:["Go on.","What do you say?","You may begin."] + neutralNo:["We absolutely refuse.","No!","I refuse."] + neutralYes:["Very good.","Of course, yes","That is very good."] + + hateHello:"What do you want now?" + hateLetsHearIt:["Speak!","What do you say?","Go on."] + hateNo:["That is not possible!","We are not agreeing to that!","I beg your pardon?"] + hateYes:["That is fine.","That is good enough.","Very well..."] + + afterPeace:"Viracocha has frowned upon our war, and has agreed to our peace agreements." + tradeRequest:"The Incan people offer this fair trade." + + outerColor:[255,255,51], + innerColor:[0,204,102], + uniqueName:"Great Andean Road" + unique:"", + //unique:"Units ignore terrain costs when moving into any tile with Hills. No maintenance costs for improvements in Hills; half cost elsewhere.", + cities:["Cuzco","Tiwanaku","Machu","Ollantaytambo","Corihuayrachina","Huamanga","Vilcas","Vilcabamba","Vitcos", + "Andahuaylas","Ica","Arequipa","Nasca","Atico","Juli","Chuito","Chuquiapo","Huanuco Pampa","Tamboccocha", + "Huaras","Riobamba","Caxamalca","Sausa","Tambo Colorado","Huaca","Tumbes","Chan Chan","Sipan","Pachacamac", + "Llactapata","Pisac","Kuelap","Pajaten","Chucuito","Choquequirao"] + } +] \ No newline at end of file diff --git a/android/assets/mods/ExampleIncaMod/jsons/TileImprovements.json b/android/assets/mods/ExampleIncaMod/jsons/TileImprovements.json new file mode 100644 index 0000000000..ea04aa80cb --- /dev/null +++ b/android/assets/mods/ExampleIncaMod/jsons/TileImprovements.json @@ -0,0 +1,11 @@ +[ + { + name:"Terrace farm", + uniqueTo:"Inca", + food:2, + turnsToBuild:4, + improvingTech:"Construction", + improvingTechStats:{food:1} + terrainsCanBeBuiltOn:["Hills"], + }, +] \ No newline at end of file diff --git a/android/assets/mods/ExampleIncaMod/jsons/Units.json b/android/assets/mods/ExampleIncaMod/jsons/Units.json new file mode 100644 index 0000000000..6c56f5da6a --- /dev/null +++ b/android/assets/mods/ExampleIncaMod/jsons/Units.json @@ -0,0 +1,16 @@ +[ + { + name:"Slinger", + unitType:"Melee", + uniqueTo:"Inca", + replaces:"Archer", + movement:2, + strength:4, + rangedStrength:7, + requiredTech:"Archery", + obsoleteTech:"Machinery", + upgradesTo:"Crossbowman", + uniques:["Can move after attacking"], + attackSound:"arrow", + }, +] \ No newline at end of file diff --git a/android/assets/modss/myFirstMod/Images/UnitIcons/Maori Warrior.png b/android/assets/modss/myFirstMod/Images/UnitIcons/Maori Warrior.png deleted file mode 100644 index 5b9139b57b..0000000000 Binary files a/android/assets/modss/myFirstMod/Images/UnitIcons/Maori Warrior.png and /dev/null differ diff --git a/android/assets/modss/myFirstMod/game.atlas b/android/assets/modss/myFirstMod/game.atlas deleted file mode 100644 index edc265c261..0000000000 --- a/android/assets/modss/myFirstMod/game.atlas +++ /dev/null @@ -1,13 +0,0 @@ - -game.png -size: 128,128 -format: RGBA8888 -filter: MipMapLinearLinear,MipMapLinearLinear -repeat: none -UnitIcons/Maori Warrior - rotate: false - xy: 2, 2 - size: 100, 100 - orig: 100, 100 - offset: 0, 0 - index: -1 diff --git a/android/assets/modss/myFirstMod/game.png b/android/assets/modss/myFirstMod/game.png deleted file mode 100644 index 170be4d1e8..0000000000 Binary files a/android/assets/modss/myFirstMod/game.png and /dev/null differ diff --git a/android/assets/modss/myFirstMod/jsons/Units.json b/android/assets/modss/myFirstMod/jsons/Units.json deleted file mode 100644 index ec9d5aef4c..0000000000 --- a/android/assets/modss/myFirstMod/jsons/Units.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - name:"Maori Warrior", - unitType:"Melee", - uniqueTo:"Polynesia", - replaces:"Warrior", - movement:2, - strength:80, - cost: 40, - hurryCostModifier:20, - obsoleteTech:"Metal Casting", - promotions:["Haka War Dance"], - upgradesTo:"Swordsman", - attackSound:"nonmetalhit" - }, -] \ No newline at end of file diff --git a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt index fc978e4a0b..a17175fdd5 100644 --- a/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt +++ b/core/src/com/unciv/ui/newgamescreen/NewGameScreen.kt @@ -25,7 +25,7 @@ class NewGameScreen: PickerScreen(){ val newGameParameters= UncivGame.Current.gameInfo.gameParameters val mapParameters = UncivGame.Current.gameInfo.tileMap.mapParameters - val ruleSet = RulesetCache.getComplexRuleset(newGameParameters.mods) + val ruleset = RulesetCache.getComplexRuleset(newGameParameters.mods) init { setDefaultCloseAction() diff --git a/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt b/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt index f1cfdfd68b..363ae03071 100644 --- a/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/NewGameScreenOptionsTable.kt @@ -13,13 +13,14 @@ import com.unciv.models.ruleset.VictoryType import com.unciv.models.ruleset.tech.TechEra import com.unciv.models.translations.tr import com.unciv.ui.utils.CameraStageBaseScreen +import com.unciv.ui.utils.ImageGetter import com.unciv.ui.utils.toLabel class NewGameScreenOptionsTable(val newGameScreen: NewGameScreen, val updatePlayerPickerTable:()->Unit) : Table(CameraStageBaseScreen.skin) { val newGameParameters = newGameScreen.newGameParameters val mapParameters = newGameScreen.mapParameters - val ruleset = newGameScreen.ruleSet + val ruleset = newGameScreen.ruleset init { pad(10f) @@ -225,6 +226,10 @@ class NewGameScreenOptionsTable(val newGameScreen: NewGameScreen, val updatePlay fun reloadMods(){ ruleset.clear() ruleset.add(RulesetCache.getComplexRuleset(newGameParameters.mods)) + ruleset.mods+=newGameParameters.mods + + ImageGetter.ruleset=ruleset + ImageGetter.setTextureRegionDrawables() } add("{Mods}:".tr()).colspan(2).row() diff --git a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt index 6a51a4dd8d..be470ab20f 100644 --- a/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt +++ b/core/src/com/unciv/ui/newgamescreen/PlayerPickerTable.kt @@ -30,9 +30,12 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters: fun update() { playerListTable.clear() - val gameBasics = newGameScreen.ruleSet // when we add mods, this will need to change - for (player in newGameParameters.players) - playerListTable.add(getPlayerTable(player,gameBasics)).pad(10f).row() + val gameBasics = newGameScreen.ruleset // the mod picking changes this ruleset + for (player in newGameParameters.players) { + if(!newGameScreen.ruleset.nations.containsKey(player.chosenCiv)) // this was in a mod we disabled + player.chosenCiv="Random" + playerListTable.add(getPlayerTable(player, gameBasics)).pad(10f).row() + } if(newGameParameters.players.count() < gameBasics.nations.values.count { it.isMajorCiv() }) { playerListTable.add("+".toLabel(Color.BLACK,30).apply { this.setAlignment(Align.center) } .surroundWithCircle(50f).onClick { newGameParameters.players.add(Player()); update() }) @@ -108,7 +111,7 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters: val nationImage = if (player.chosenCiv == "Random") "?".toLabel(Color.BLACK,30) .apply { this.setAlignment(Align.center) } .surroundWithCircle(50f) - else ImageGetter.getNationIndicator(newGameScreen.ruleSet.nations[player.chosenCiv]!!, 50f) + else ImageGetter.getNationIndicator(newGameScreen.ruleset.nations[player.chosenCiv]!!, 50f) nationTable.add(nationImage) nationTable.add(player.chosenCiv.toLabel()).pad(20f) nationTable.touchable = Touchable.enabled @@ -138,11 +141,11 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters: nationListTable.add(randomPlayerTable).pad(10f).width(nationsPopupWidth).row() - for (nation in newGameScreen.ruleSet.nations.values.filter { !it.isCityState() && it.name != "Barbarians" }) { + for (nation in newGameScreen.ruleset.nations.values.filter { !it.isCityState() && it.name != "Barbarians" }) { if (player.chosenCiv != nation.name && newGameParameters.players.any { it.chosenCiv == nation.name }) continue - nationListTable.add(NationTable(nation, nationsPopupWidth,newGameScreen.ruleSet).onClick { + nationListTable.add(NationTable(nation, nationsPopupWidth,newGameScreen.ruleset).onClick { player.chosenCiv = nation.name nationsPopup.close() update()