Package megamek.server.trigger
Class ActiveUnitsTrigger
java.lang.Object
megamek.server.trigger.ActiveUnitsTrigger
- All Implemented Interfaces:
Trigger
This Trigger reacts when the count of active units is equal to the given count. When the playerName is blank, units
of all players are counted, otherwise only those of the given player. When a list of unit IDs is given, only those
units will be considered. Note that immobile units or those with stunned crews or the like are still active. Only
units that have fled or are destroyed are no longer active. Note that destroyed units can spawn pilots and some other
objects are counted as in-game, so providing an ID list can make sense. Note that this trigger will react multiple
times. Use
OnceTrigger to limit it to one-time-only.-
Constructor Summary
ConstructorsConstructorDescriptionActiveUnitsTrigger(String playerName, int fledUnitCount) Deprecated, for removal: This API element is subject to removal in a future version.ActiveUnitsTrigger(String playerName, int minUnitCount, int maxUnitCount) Deprecated, for removal: This API element is subject to removal in a future version.ActiveUnitsTrigger(String playerName, List<Integer> unitIds, int fledUnitCount) ActiveUnitsTrigger(String playerName, List<Integer> unitIds, int minUnitCount, int maxUnitCount) -
Method Summary
Modifier and TypeMethodDescriptionbooleanisTriggered(IGame game, TriggerSituation event) Returns true when this Trigger is triggered, i.e.toString()
-
Constructor Details
-
ActiveUnitsTrigger
-
ActiveUnitsTrigger
-
ActiveUnitsTrigger
@Deprecated(since="0.51.0", forRemoval=true) public ActiveUnitsTrigger(@Nullable String playerName, int fledUnitCount) Deprecated, for removal: This API element is subject to removal in a future version. -
ActiveUnitsTrigger
@Deprecated(since="0.51.0", forRemoval=true) public ActiveUnitsTrigger(@Nullable String playerName, int minUnitCount, int maxUnitCount) Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
isTriggered
Description copied from interface:TriggerReturns true when this Trigger is triggered, i.e. if the prerequisites for its associated event are deemed to be satisfied. Note that the event is itself responsible for making sure that it only returns true once, if it should only trigger once. If it returns true on multiple occasions, the triggered event may happen multiple times. The given TriggerEvent specifies when at what moment of the game this method is called.- Specified by:
isTriggeredin interfaceTrigger- Parameters:
game- The gameevent- The type of event that caused the trigger to be called- Returns:
- True when this Trigger considers itself triggered, false otherwise
-
toString
-