mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
modding: Added "upon gaining a [unitFilter] unit" trigger condition
This commit is contained in:
parent
8565762df3
commit
7b1a5e296c
Binary file not shown.
Before Width: | Height: | Size: 888 KiB After Width: | Height: | Size: 887 KiB |
@ -7,6 +7,7 @@ import com.unciv.logic.civilization.Civilization
|
||||
import com.unciv.logic.civilization.NotificationCategory
|
||||
import com.unciv.logic.map.mapunit.MapUnit
|
||||
import com.unciv.logic.map.tile.Tile
|
||||
import com.unciv.models.ruleset.unique.UniqueTriggerActivation
|
||||
import com.unciv.models.ruleset.unique.UniqueType
|
||||
import com.unciv.models.ruleset.unit.BaseUnit
|
||||
|
||||
@ -67,7 +68,12 @@ class UnitManager(val civInfo:Civilization) {
|
||||
* @return created [MapUnit] or null if no suitable location was found
|
||||
* */
|
||||
fun placeUnitNearTile(location: Vector2, unitName: String): MapUnit? {
|
||||
return civInfo.gameInfo.tileMap.placeUnitNearTile(location, unitName, civInfo)
|
||||
val unit = civInfo.gameInfo.tileMap.placeUnitNearTile(location, unitName, civInfo)
|
||||
|
||||
if (unit != null)
|
||||
for (unique in civInfo.getTriggeredUniques(UniqueType.TriggerUponGainingUnit))
|
||||
UniqueTriggerActivation.triggerCivwideUnique(unique, civInfo)
|
||||
return unit
|
||||
}
|
||||
fun getCivUnitsSize(): Int = unitList.size
|
||||
fun getCivUnits(): Sequence<MapUnit> = unitList.asSequence()
|
||||
|
@ -715,6 +715,7 @@ enum class UniqueType(val text: String, vararg targets: UniqueTarget, val flags:
|
||||
TriggerUponConstructingBuilding("upon constructing [buildingFilter]", UniqueTarget.TriggerCondition),
|
||||
// We have a separate trigger to include the cityFilter, since '[in all cities]' can be read '*only* if it's in all cities'
|
||||
TriggerUponConstructingBuildingCityFilter("upon constructing [buildingFilter] [cityFilter]", UniqueTarget.TriggerCondition),
|
||||
TriggerUponGainingUnit("upon gaining a [unitFilter] unit", UniqueTarget.TriggerCondition),
|
||||
|
||||
TriggerUponFoundingPantheon("upon founding a Pantheon", UniqueTarget.TriggerCondition),
|
||||
TriggerUponFoundingReligion("upon founding a Religion", UniqueTarget.TriggerCondition),
|
||||
|
@ -65,10 +65,6 @@ object UnitActionsUpgrade{
|
||||
unit.destroy(destroyTransportedUnit = false)
|
||||
val newUnit = civInfo.units.placeUnitNearTile(unitTile.position, upgradedUnit.name)
|
||||
|
||||
/** We were UNABLE to place the new unit, which means that the unit failed to upgrade!
|
||||
* The only known cause of this currently is "land units upgrading to water units" which fail to be placed.
|
||||
*/
|
||||
|
||||
/** We were UNABLE to place the new unit, which means that the unit failed to upgrade!
|
||||
* The only known cause of this currently is "land units upgrading to water units" which fail to be placed.
|
||||
*/
|
||||
|
@ -1918,6 +1918,11 @@ Simple unique parameters are explained by mouseover. Complex parameters are expl
|
||||
|
||||
Applicable to: TriggerCondition
|
||||
|
||||
??? example "<upon gaining a [unitFilter] unit>"
|
||||
Example: "<upon gaining a [Unknown] unit>"
|
||||
|
||||
Applicable to: TriggerCondition
|
||||
|
||||
??? example "<upon founding a Pantheon>"
|
||||
Applicable to: TriggerCondition
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user