Class SBFVisibilityHelper
java.lang.Object
megamek.common.strategicBattleSystems.SBFVisibilityHelper
- All Implemented Interfaces:
SBFRuleOptionsUser
This class holds visibility information for an SBF game. In SBF games, visibility is not instantaneous but checked
and updated in the Detection and Recon phase, see IO:BF p.194. Note that this class checks the game options by itself
and will always indicate that formations are visible when detection and recon is not used.
Note that while this class is used by SBFGame (as it needs to be saved with the game) it should only be used by the server (SBFGameManager). The Clients must accept what they get from the server as a result of testing visibility.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method must be implemented to provide access to the SBF options used in the present game so that the convenience methods of this interface work correctly.getVisibility(int viewingPlayer, int formationID) Returns the visibility status for the given formation to the given player, depending on the game's options.booleanisVisible(int viewingPlayer, int formationID) Returns true when the given formation is fully visible to the given player, depending on the game's options.voidsetInvisible(int viewingPlayer, int formationID) Sets the given formation as invisible to the given player.voidsetVisibility(int viewingPlayer, int formationID, SBFVisibilityStatus visibilityStatus) Sets the givenSBFVisibilityStatusfor the given formation as viewed by the given player.voidsetVisible(int viewingPlayer, int formationID) Sets the given formation as fully visible to the given player.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface megamek.common.strategicBattleSystems.SBFRuleOptionsUser
usesAdjustingFormations, usesAdvancedInitiative, usesBattlefieldInt, usesDoubleBlind, usesSprintingMove, usesTeamVision
-
Constructor Details
-
SBFVisibilityHelper
-
-
Method Details
-
isVisible
public boolean isVisible(int viewingPlayer, int formationID) Returns true when the given formation is fully visible to the given player, depending on the game's options. When double-blind rules are not used, this is always true. Otherwise, it depends on previous detection. Players always see their own units.- Parameters:
viewingPlayer- the player that is doing the lookingformationID- the formation in question- Returns:
- True when the formation is fully visible, false otherwise
-
getVisibility
Returns the visibility status for the given formation to the given player, depending on the game's options. When double-blind rules are not used, the status is alwaysSBFVisibilityStatus.VISIBLE. Otherwise, it depends on previous detection. Players always see their own units.- Parameters:
viewingPlayer- the player that is doing the lookingformationID- the formation in question- Returns:
- The
SBFVisibilityStatus - See Also:
-
setVisible
public void setVisible(int viewingPlayer, int formationID) Sets the given formation as fully visible to the given player.Note: that the ID values are not checked; when they don't map to anything, no error will happen, and they will have no effect.
- Parameters:
viewingPlayer- The playerformationID- The formation to make visible
-
setInvisible
public void setInvisible(int viewingPlayer, int formationID) Sets the given formation as invisible to the given player.Note: that the ID values are not checked; when they don't map to anything, no error will happen, and they will have no effect.
- Parameters:
viewingPlayer- The playerformationID- The formation to make invisible
-
setVisibility
Sets the givenSBFVisibilityStatusfor the given formation as viewed by the given player.Note: that the ID values are not checked; when they don't map to anything, no error will happen, and they will have no effect.
- Parameters:
viewingPlayer- The playerformationID- The formationvisibilityStatus- The new visibility status- See Also:
-
getOptions
Description copied from interface:SBFRuleOptionsUserThis method must be implemented to provide access to the SBF options used in the present game so that the convenience methods of this interface work correctly.- Specified by:
getOptionsin interfaceSBFRuleOptionsUser- Returns:
- the SBFRuleOptions used by the present SBF game
-