mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-10 07:48:31 +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 settler = "Settler"
|
||||
const val settlerUnique = "Founds a new city"
|
||||
const val greatGeneral = "Great General"
|
||||
|
||||
const val impassable = "Impassable"
|
||||
const val ocean = "Ocean"
|
||||
|
@ -451,7 +451,7 @@ object NextTurnAutomation {
|
||||
when {
|
||||
unit.type.isRanged() -> rangedUnits.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
|
||||
else -> civilianUnits.add(unit)
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ object UnitAutomation {
|
||||
if (unit.name == "Work Boats")
|
||||
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)
|
||||
|
||||
if (unit.hasUnique("Can construct []"))
|
||||
|
@ -269,10 +269,13 @@ object Battle {
|
||||
if(thisCombatant.getCivInfo().isMajorCiv()) {
|
||||
var greatGeneralPointsModifier = 1f
|
||||
val unitUniques = thisCombatant.unit.getMatchingUniques("[] is earned []% faster")
|
||||
val civUniques = thisCombatant.unit.civInfo.getMatchingUniques("[] is earned []% faster")
|
||||
for (unique in unitUniques + civUniques)
|
||||
if (unique.params[0] == Constants.greatGeneral)
|
||||
val civUniques = thisCombatant.getCivInfo().getMatchingUniques("[] is earned []% faster")
|
||||
for (unique in unitUniques + civUniques) {
|
||||
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
|
||||
}
|
||||
|
||||
val greatGeneralPointsGained = (XPGained * greatGeneralPointsModifier).toInt()
|
||||
thisCombatant.getCivInfo().greatPeople.greatGeneralPoints += greatGeneralPointsGained
|
||||
|
Reference in New Issue
Block a user