Package megamek.server.victory
Interface VictoryCondition
- All Known Subinterfaces:
BVVictoryCondition
- All Known Implementing Classes:
BattlefieldControlVictory,BVDestroyedVictoryCondition,BVRatioVictoryCondition,DrawTriggeredEvent,EnemyCmdrDestroyedVictory,KillCountVictory,PlayerAgreedVictory,VictoryPointVictory,VictoryTriggeredEvent
public interface VictoryCondition
Interface for classes judging whether a victory occurred or not. These classes must not modify the game state.
Reporting must be done via the given interface.
Note: VictoryConditions may be checked any number of times at various points in the game and implementing classes must be able to deal with this. For example, a VictoryCondition that counts rounds must not assume that is called only once per round.
Note: VictoryConditions should add proper reports to their resulting VictoryResult. When doing so, note that their results might be filtered in double-blind games. So, the reports should be mostly of the "what is the score"-type (player A occupies the victory location) or fact-type (Player A has destroyed player B's commander).
Note: The context should use simple serializable objects (preferably Integers, Strings, Doubles etc.) to store state between executions if such a feature is absolutely required.
Note: VictoryConditions may be checked any number of times at various points in the game and implementing classes must be able to deal with this. For example, a VictoryCondition that counts rounds must not assume that is called only once per round.
Note: VictoryConditions should add proper reports to their resulting VictoryResult. When doing so, note that their results might be filtered in double-blind games. So, the reports should be mostly of the "what is the score"-type (player A occupies the victory location) or fact-type (Player A has destroyed player B's commander).
Note: The context should use simple serializable objects (preferably Integers, Strings, Doubles etc.) to store state between executions if such a feature is absolutely required.
-
Method Summary
Modifier and TypeMethodDescriptioncheckVictory(Game game, Map<String, Object> context) Tests if a victory (or draw) has occurred and returns a properly filled in VictoryResult.
-
Method Details
-
checkVictory
Tests if a victory (or draw) has occurred and returns a properly filled in VictoryResult. Should returnVictoryResult.noResult()if this victory condition has not been met.- Parameters:
game- The currentGamecontext- The context to consider, seeVictoryCondition(currently unused)- Returns:
- The result of the victory condition test
-