mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-14 20:06:22 +07:00
More unit unique typing (#5952)
* There are so many of these my gosh * Fixed, good thing we have tests :) * Fixed
This commit is contained in:
parent
aaeb4f36d8
commit
6e95a07572
@ -689,7 +689,7 @@
|
||||
"favoredReligion": "Christianity",
|
||||
"uniqueName": "Viking Fury",
|
||||
"uniques": ["[+1] Movement <for [Embarked] units>", "Units pay only 1 movement point to disembark",
|
||||
"Melee units pay no movement cost to pillage"],
|
||||
"No movement cost to pillage <for [Melee] units>"],
|
||||
"cities": ["Copenhagen","Aarhus","Kaupang","Ribe","Viborg","Tunsberg","Roskilde","Hedeby","Oslo","Jelling","Truso",
|
||||
"Bergen","Faeroerne","Reykjavik","Trondheim","Godthab","Helluland","Lillehammer","Markland","Elsinore",
|
||||
"Sarpsborg","Odense","Aalborg","Stavanger","Vorbasse","Schleswig","Kristiansand","Halogaland","Randers",
|
||||
|
@ -662,7 +662,7 @@
|
||||
"innerColor": [255,255,102],
|
||||
"uniqueName": "Viking Fury",
|
||||
"uniques": ["[+1] Movement <for [Embarked] units>", "Units pay only 1 movement point to disembark",
|
||||
"Melee units pay no movement cost to pillage"],
|
||||
"No movement cost to pillage <for [Melee] units>"],
|
||||
"cities": ["Copenhagen","Aarhus","Kaupang","Ribe","Viborg","Tunsberg","Roskilde","Hedeby","Oslo","Jelling","Truso",
|
||||
"Bergen","Faeroerne","Reykjavik","Trondheim","Godthab","Helluland","Lillehammer","Markland","Elsinore",
|
||||
"Sarpsborg","Odense","Aalborg","Stavanger","Vorbasse","Schleswig","Kristiansand","Halogaland","Randers",
|
||||
|
@ -243,7 +243,7 @@ object UnitAutomation {
|
||||
}
|
||||
|
||||
private fun tryHealUnit(unit: MapUnit): Boolean {
|
||||
if (unit.baseUnit.isRanged() && unit.hasUnique("Unit will heal every turn, even if it performs an action"))
|
||||
if (unit.baseUnit.isRanged() && unit.hasUnique(UniqueType.HealsEvenAfterAction))
|
||||
return false // will heal anyway, and attacks don't hurt
|
||||
|
||||
val unitDistanceToTiles = unit.movement.getDistanceToTiles()
|
||||
|
@ -399,7 +399,7 @@ object Battle {
|
||||
if (attacker is MapUnitCombatant) {
|
||||
val unit = attacker.unit
|
||||
unit.attacksThisTurn += 1
|
||||
if (unit.hasUnique("Can move after attacking") || unit.maxAttacksPerTurn() > unit.attacksThisTurn) {
|
||||
if (unit.hasUnique(UniqueType.CanMoveAfterAttacking) || unit.maxAttacksPerTurn() > unit.attacksThisTurn) {
|
||||
// if it was a melee attack and we won, then the unit ALREADY got movement points deducted,
|
||||
// for the movement to the enemy's tile!
|
||||
// and if it's an air unit, it only has 1 movement anyway, so...
|
||||
|
@ -760,7 +760,7 @@ class MapUnit {
|
||||
currentTile.neighbors.flatMap { it.getUnits() }.forEach { it.healBy(15) }
|
||||
|
||||
if (currentMovement == getMaxMovement().toFloat() // didn't move this turn
|
||||
|| hasUnique("Unit will heal every turn, even if it performs an action")
|
||||
|| hasUnique(UniqueType.HealsEvenAfterAction)
|
||||
) heal()
|
||||
|
||||
if (action != null && health > 99)
|
||||
|
@ -310,6 +310,12 @@ enum class UniqueType(val text:String, vararg targets: UniqueTarget, val flags:
|
||||
NoDefensiveTerrainPenalty("No defensive terrain penalty", UniqueTarget.Unit, UniqueTarget.Global),
|
||||
Uncapturable("Uncapturable", UniqueTarget.Unit),
|
||||
SelfDestructs("Self-destructs when attacking", UniqueTarget.Unit),
|
||||
HealsEvenAfterAction("Unit will heal every turn, even if it performs an action", UniqueTarget.Unit),
|
||||
NoMovementToPillage("No movement cost to pillage", UniqueTarget.Unit, UniqueTarget.Global),
|
||||
@Deprecated("As of 3.18.17", ReplaceWith("No movement cost to pillage <for [Melee] units>"), DeprecationLevel.WARNING)
|
||||
NoMovementToPillageMelee("Melee units pay no movement cost to pillage", UniqueTarget.Unit, UniqueTarget.Global),
|
||||
CanMoveAfterAttacking("Can move after attacking", UniqueTarget.Unit),
|
||||
MoveImmediatelyOnceBought("Can move immediately once bought", UniqueTarget.Unit),
|
||||
BlastRadius("Blast radius [amount]", UniqueTarget.Unit),
|
||||
|
||||
HealsOutsideFriendlyTerritory("May heal outside of friendly territory", UniqueTarget.Unit, UniqueTarget.Global),
|
||||
|
@ -471,7 +471,7 @@ class BaseUnit : RulesetObject(), INonPerpetualConstruction {
|
||||
?: return false // couldn't place the unit, so there's actually no unit =(
|
||||
|
||||
//movement penalty
|
||||
if (boughtWith != null && !civInfo.gameInfo.gameParameters.godMode && !unit.hasUnique("Can move immediately once bought"))
|
||||
if (boughtWith != null && !civInfo.gameInfo.gameParameters.godMode && !unit.hasUnique(UniqueType.MoveImmediatelyOnceBought))
|
||||
unit.currentMovement = 0f
|
||||
|
||||
// If this unit has special abilities that need to be kept track of, start doing so here
|
||||
|
@ -285,9 +285,10 @@ object UnitActions {
|
||||
tile.improvement = null
|
||||
if (tile.resource != null) tile.getOwner()?.updateDetailedCivResources() // this might take away a resource
|
||||
|
||||
val freePillage = unit.hasUnique("No movement cost to pillage")
|
||||
|| unit.civInfo.hasUnique("No movement cost to pillage")
|
||||
|| (unit.baseUnit.isMelee() && unit.civInfo.hasUnique("Melee units pay no movement cost to pillage"))
|
||||
val freePillage = unit.hasUnique(UniqueType.NoMovementToPillage)
|
||||
|| unit.civInfo.hasUnique(UniqueType.NoMovementToPillage)
|
||||
// Deprecated 3.18.17
|
||||
|| (unit.baseUnit.isMelee() && unit.civInfo.hasUnique(UniqueType.NoMovementToPillageMelee))
|
||||
if (!freePillage) unit.useMovementPoints(1f)
|
||||
|
||||
unit.healBy(25)
|
||||
|
Loading…
Reference in New Issue
Block a user