megamek.server.victory
Interface Victory
- All Known Implementing Classes:
- AbstractBVVictory, BVDestroyedVictory, BVRatioVictory, CheckVictory, EnemyCmdrDestroyedVictory, ForceVictory, LastManStandingVictory, NoodleVictory, SpaghettiVictory, SummingThresholdVictory
public interface Victory
interface for classes judging whether a victory occurred or not. these
classes may not modify game state. Reporting must be done via the given
interface. classes also should not have any nasty internal state outside
methods this will guarantee them to act _only_ based on gamestate The only
case where this should be done is in cases where you have to count occurances
of some action or duration of something. In this case the information should
be stored in the context-object NOTE: if you delegate from one victory-class
instance to other, they must be created in similar fashion (ie. constructed
at the same time and destroyed at the same time) to guarantee proper working
also , if you delegate, you should delegate each time to guarantee that
victorypoint-counting and duration-counting implementations get access to
game state every round. NOTE2: calling victory 1 time or n times per round
should not make a difference! victories counting rounds must not assume that
they are called only once per round NOTE3: dont even think about making
different victoryclasses communicate straight or via context-object ;) NOTE4:
victories should take into account in their reporting (adding reports to the
result-object) that their results might be filtered. 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)
|
Nested Class Summary |
static interface |
Victory.Result
result class which can be queried for winner and if victory occurred
victory might be true and winner "None" if the players have drawn winner
might be NONE and team set to winning team. |
victory
Victory.Result victory(IGame game,
java.util.HashMap<java.lang.String,java.lang.Object> context)
- Parameters:
game - - the game (state) we are playingcontext - - a map Strings to simple serializable objects (preferably
Integers , Strings ,Doubles etc) which are used to store state
between executions if such feature is absolutely required.. as
a key you should use something atleast class- specific to
limit namespace collisions
- Returns:
- a result with true if victory occured, false if not must not
return null MUST NOT modify game state!