mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-26 23:58:43 +07:00
Changed all hardcoded Great General references to unique-based
This commit is contained in:
@ -5,7 +5,6 @@ object Constants {
|
|||||||
const val workerUnique = "Can build improvements on tiles"
|
const val workerUnique = "Can build improvements on tiles"
|
||||||
const val settler = "Settler"
|
const val settler = "Settler"
|
||||||
const val settlerUnique = "Founds a new city"
|
const val settlerUnique = "Founds a new city"
|
||||||
const val greatGeneral = "Great General"
|
|
||||||
|
|
||||||
const val impassable = "Impassable"
|
const val impassable = "Impassable"
|
||||||
const val ocean = "Ocean"
|
const val ocean = "Ocean"
|
||||||
|
@ -451,7 +451,7 @@ object NextTurnAutomation {
|
|||||||
when {
|
when {
|
||||||
unit.type.isRanged() -> rangedUnits.add(unit)
|
unit.type.isRanged() -> rangedUnits.add(unit)
|
||||||
unit.type.isMelee() -> meleeUnits.add(unit)
|
unit.type.isMelee() -> meleeUnits.add(unit)
|
||||||
unit.name == Constants.greatGeneral || unit.baseUnit.replaces == Constants.greatGeneral
|
unit.hasUnique("Bonus for units in 2 tile radius 15%")
|
||||||
-> generals.add(unit) //generals move after military units
|
-> generals.add(unit) //generals move after military units
|
||||||
else -> civilianUnits.add(unit)
|
else -> civilianUnits.add(unit)
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ object UnitAutomation {
|
|||||||
if (unit.name == "Work Boats")
|
if (unit.name == "Work Boats")
|
||||||
return SpecificUnitAutomation.automateWorkBoats(unit)
|
return SpecificUnitAutomation.automateWorkBoats(unit)
|
||||||
|
|
||||||
if (unit.name == Constants.greatGeneral || unit.baseUnit.replaces == Constants.greatGeneral)
|
if (unit.hasUnique("Bonus for units in 2 tile radius 15%"))
|
||||||
return SpecificUnitAutomation.automateGreatGeneral(unit)
|
return SpecificUnitAutomation.automateGreatGeneral(unit)
|
||||||
|
|
||||||
if (unit.hasUnique("Can construct []"))
|
if (unit.hasUnique("Can construct []"))
|
||||||
|
@ -269,10 +269,13 @@ object Battle {
|
|||||||
if(thisCombatant.getCivInfo().isMajorCiv()) {
|
if(thisCombatant.getCivInfo().isMajorCiv()) {
|
||||||
var greatGeneralPointsModifier = 1f
|
var greatGeneralPointsModifier = 1f
|
||||||
val unitUniques = thisCombatant.unit.getMatchingUniques("[] is earned []% faster")
|
val unitUniques = thisCombatant.unit.getMatchingUniques("[] is earned []% faster")
|
||||||
val civUniques = thisCombatant.unit.civInfo.getMatchingUniques("[] is earned []% faster")
|
val civUniques = thisCombatant.getCivInfo().getMatchingUniques("[] is earned []% faster")
|
||||||
for (unique in unitUniques + civUniques)
|
for (unique in unitUniques + civUniques) {
|
||||||
if (unique.params[0] == Constants.greatGeneral)
|
val unitName = unique.params[0]
|
||||||
|
val unit = thisCombatant.getCivInfo().gameInfo.ruleSet.units[unitName]
|
||||||
|
if (unit != null && unit.uniques.contains("Great Person - [War]"))
|
||||||
greatGeneralPointsModifier += unique.params[1].toFloat() / 100
|
greatGeneralPointsModifier += unique.params[1].toFloat() / 100
|
||||||
|
}
|
||||||
|
|
||||||
val greatGeneralPointsGained = (XPGained * greatGeneralPointsModifier).toInt()
|
val greatGeneralPointsGained = (XPGained * greatGeneralPointsModifier).toInt()
|
||||||
thisCombatant.getCivInfo().greatPeople.greatGeneralPoints += greatGeneralPointsGained
|
thisCombatant.getCivInfo().greatPeople.greatGeneralPoints += greatGeneralPointsGained
|
||||||
|
Reference in New Issue
Block a user