Package megamek.common.game
Interface InGameObject
- All Superinterfaces:
BTObject
- All Known Subinterfaces:
ForceAssignable,ICarryable,Targetable
- All Known Implementing Classes:
AbstractBuildingEntity,Aero,AeroSpaceFighter,AlphaStrikeElement,BattleArmor,BattlefieldSupportAsset,BipedMek,Briefcase,BuildingEntity,BuildingTarget,Cargo,CombatVehicleEscapePod,ConvFighter,ConvInfantry,Dropship,EjectedCrew,Entity,EscapePods,FighterSquadron,FixedWingSupport,FloorTarget,Formation,GroundObject,GunEmplacement,HandheldWeapon,HexTarget,INarcPod,Infantry,Jumpship,LandAirMek,LargeSupportTank,Mek,MekWarrior,MekWithArms,MinefieldTarget,MobileStructure,ObjectiveMarker,ProtoMek,QuadMek,QuadVee,SBFFormation,SBFIGotSomethingUnitPlaceholder,SBFPartialScanUnitPlaceHolder,SBFSomethingOutThereUnitPlaceHolder,SBFUnitPlaceHolder,SmallCraft,SpaceStation,SuperHeavyTank,SupportTank,SupportVTOL,Tank,TeleMissile,TripodMek,VTOL,Warship
This interface represents all objects that any type of BT Game (TW, Alpha Strike, BattleForce, SBF, ISAW) should
possibly keep in its list of playable "entities" or game units, such as Entity and AlphaStrikeElement and at some
point maybe BFUnits, SBFFormations or ACS Combat Teams, but also Objective Markers, carryable objects or buildings.
Each such InGameObject must have a game-unique id and can, but does not have to have an owning player.
The purpose of this interface is to disentangle Game, Client etc. from Entity and facilitate other types of games than TW.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleanReturns true when the current (remaining) battle strength of this unit/object should be counted for a strength sum, e.g.intgetId()Returns this InGameObject's id.intReturns the unique id of this InGameObject's owning player.intReturns the current (remaining) battle strength of this unit or object.default booleanhasOwner()Returns true when the owner id of this InGameObject is not Player.NONE.voidsetId(int newId) Sets this InGameObject's id.voidsetOwnerId(int newOwnerId) Sets the unique id of this InGameObject's owning player.Methods inherited from interface megamek.common.units.BTObject
generalName, getFluffImage, getIcon, hasAerodyneSpheroidDistinction, isAero, isAerodyne, isAerospace, isAerospaceFighter, isAerospaceSV, isBattleArmor, isBattlefieldSupportAsset, isBattleMek, isCarryableObject, isCombatVehicle, isConventionalFighter, isConventionalInfantry, isDropShip, isFighter, isFixedWingSupport, isGround, isHandheldWeapon, isIndustrialMek, isInfantry, isJumpShip, isLargeAerospace, isMek, isObjectiveMarker, isProtoMek, isQuadMek, isSingleUnit, isSmallCraft, isSpaceStation, isSpheroid, isSupportVehicle, isTripodMek, isUnitGroup, isVehicle, isWarShip, specificName
-
Method Details
-
getId
int getId()Returns this InGameObject's id. The id must be unique to this InGameObject within the current game. equals() must return true for two InGameObject objects with the same id.- Returns:
- The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
-
setId
void setId(int newId) Sets this InGameObject's id. The id must be unique to this InGameObject within the current game. equals() must return true for two InGameObject objects with the same id.- Parameters:
newId- The game-unique id of this InGameObject (Entity, AlphaStrikeElement etc.)
-
getOwnerId
int getOwnerId()Returns the unique id of this InGameObject's owning player. This id may be Player.NONE.- Returns:
- The player id of the owner of this InGameObject.
-
setOwnerId
void setOwnerId(int newOwnerId) Sets the unique id of this InGameObject's owning player. This id may be Player.NONE.- Parameters:
newOwnerId- The player id of the owner of this InGameObject.
-
hasOwner
default boolean hasOwner()Returns true when the owner id of this InGameObject is not Player.NONE.- Returns:
- True when this InGameObject has an owning player
-
getStrength
int getStrength()Returns the current (remaining) battle strength of this unit or object. For combat units, this is the battle value (BV) or the point value (PV).- Returns:
- The current battle strength (BV/PV)
-
countForStrengthSum
default boolean countForStrengthSum()Returns true when the current (remaining) battle strength of this unit/object should be counted for a strength sum, e.g. if it should count for the summed battle value of a player or team. This may be false when the unit is destroyed or trapped or otherwise permanently kept from acting or when it is part of a unit group and its strength will be counted through that unit group (e.g. FighterSquadrons). SeegetStrength().- Returns:
- True when the strength of this should be counted in a strength sum
-