Package megamek.server.trigger
Record Class SpecificRoundEndTrigger
java.lang.Object
java.lang.Record
megamek.server.trigger.SpecificRoundEndTrigger
- All Implemented Interfaces:
Trigger
This Trigger reacts at the end of the specified game round. This is more or less the same as a RoundStartTrigger of
the following round, but this can be used to trigger something without actually entering the following round just yet
(e.g. ending the game at the end of round 10 instead of at the beginning of round 11). Note that this Trigger can
react multiple times!
-
Constructor Summary
ConstructorsConstructorDescriptionSpecificRoundEndTrigger
(int gameRound) Creates an instance of aSpecificRoundEndTrigger
record class. -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.int
Returns the value of thegameRound
record component.final int
hashCode()
Returns a hash code value for this object.boolean
isTriggered
(IGame game, TriggerSituation event) Returns true when this Trigger is triggered, i.e.toString()
Returns a string representation of this record class.
-
Constructor Details
-
SpecificRoundEndTrigger
public SpecificRoundEndTrigger(int gameRound) Creates an instance of aSpecificRoundEndTrigger
record class.- Parameters:
gameRound
- the value for thegameRound
record component
-
-
Method Details
-
isTriggered
Description copied from interface:Trigger
Returns 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:
isTriggered
in 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
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
gameRound
public int gameRound()Returns the value of thegameRound
record component.- Returns:
- the value of the
gameRound
record component
-