/** * Shortcut to game.board */ public IBoard getBoard() { return game.getBoard(); }
/** * Updates the boardSize variable with the proper values for this board. */ private void updateBoardSize() { int width = (game.getBoard().getWidth() * (int) (HEX_WC * scale)) + (int) ((HEX_W / 4) * scale); int height = (game.getBoard().getHeight() * (int) (HEX_H * scale)) + (int) ((HEX_H / 2) * scale); boardSize = new Dimension(width, height); }
@Override public boolean hasActiveECM() { if (!game.getOptions() .booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ECM) || !game.getBoard().inSpace()) { return super.hasActiveECM(); } return fighters.stream().map(fid -> game.getEntity(fid)) .filter(ACTIVE_CHECK).filter(ent -> ent.hasActiveECM()) .findFirst().isPresent(); }
public int getAirMechFlankMP(boolean gravity, boolean ignoremodulararmor) { if (game != null && game.getBoard().inAtmosphere() && (isLocationBad(Mech.LOC_LT) || isLocationBad(Mech.LOC_RT))) { return 0; } return (int) Math.ceil(getAirMechCruiseMP(gravity, ignoremodulararmor) * 1.5); }
@Override protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, IGame game, Server server) { if (game.getBoard().inSpace()) { return new KrakenTHandler(toHit, waa, game, server); } return new CapitalMissileHandler(toHit, waa, game, server); } }
/** * Convenience function encapsulating logic for whether, if we continue forward * along the current path in the current direction, we will run off the board * @return */ public boolean nextForwardStepOffBoard() { return !game.getBoard().contains(getFinalCoords().translated(getFinalFacing())); } }
@Override public boolean isLocationProhibited(Coords c, int currElevation) { IHex hex = game.getBoard().getHex(c); if(hex.containsTerrain(Terrains.SPACE) && doomedInSpace()) { return true; } //gun emplacements must be placed on a building return !hex.containsTerrain(Terrains.BUILDING); }
/** * Convenience method to determine whether this entity should be treated as an airborne aero on a ground map. * @return True if this is an airborne aircraft on a ground map. */ public boolean isAirborneAeroOnGroundMap() { return isAero() && isAirborne() && getGame().getBoard().onGround(); }
public boolean isOnAtmosphericGroundMap() { return ((getGame().getPlanetaryConditions().getAtmosphere() != PlanetaryConditions.ATMO_VACUUM) || (getGame().getPlanetaryConditions().getAtmosphere() != PlanetaryConditions.ATMO_TRACE)) && (getGame().getBoard().onGround() || // doesn't make sense in english, but "atmospheric" map actually // covers maps that are within a planet's gravity well getGame().getBoard().inAtmosphere()); }
/** * Turns VTOL bombing on or off for this step. */ public void setVTOLBombing(boolean bombing) { if (bombing) { setTarget(new HexTarget(getPosition(), getGame().getBoard(), Targetable.TYPE_HEX_AERO_BOMB)); } else { setTarget(null); } }
/** * Turns VTOL strafing on or off for this step. */ public void setStrafing(boolean strafing) { if (strafing) { setTarget(new HexTarget(getPosition(), getGame().getBoard(), Targetable.TYPE_HEX_CLEAR)); } else { setTarget(null); } }
private double potentialBuildingDamage(int x, int y, Entity entity) { Coords coords = new Coords(x, y); Building building = game.getBoard().getBuildingAt(coords); if (building == null) { return 0; } int potentialDmg = (int) Math.ceil((double) building.getCurrentCF(coords) / 10); boolean aptGunnery = entity.hasAbility(OptionsConstants.PILOT_APTITUDE_GUNNERY); double oddsTakeDmg = 1 - (Compute.oddsAbove(entity.getCrew().getPiloting(), aptGunnery) / 100); return potentialDmg * oddsTakeDmg; }
/** * All warships automatically have ECM if in space */ @Override public boolean hasActiveECM() { if (!game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ECM) || !game.getBoard().inSpace()) { return super.hasActiveECM(); } return getECMRange() >= 0; }
/** * In hexes with buildings, returns the elevation relative to the roof. Otherwise returns the elevation * relative to the surface. */ public int getClearance() { IHex hex = entity.getGame().getBoard().getHex(getPosition()); if (hex.containsTerrain(Terrains.BLDG_ELEV)) { return elevation - hex.terrainLevel(Terrains.BLDG_ELEV); } return elevation; }
/** * All military space stations automatically have ECM if in space */ @Override public boolean hasActiveECM() { if (!game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ECM) || !game.getBoard().inSpace()) { return super.hasActiveECM(); } return getECMRange() >= 0; }
/** * All military small craft automatically have ECM if in space */ @Override public boolean hasActiveECM() { if (!game.getOptions().booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ECM) || !game.getBoard().inSpace()) { return super.hasActiveECM(); } return getECMRange() >= 0; }
private void findGeysers() { IBoard b = server.getGame().getBoard(); int height = b.getHeight(); int width = b.getWidth(); for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { if (b.getHex(x, y).containsTerrain(Terrains.GEYSER)) { geysers.add(new GeyserInfo(new Coords(x, y))); } } } }
default PilotingRollData checkVelocityDouble(int velocity, EntityMovementType overallMoveType) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(overallMoveType); if ((velocity > (2 * ((Entity) this).getWalkMP())) && !((Entity) this).getGame().getBoard().inSpace()) { // append the reason modifier roll.append(new PilotingRollData(((Entity) this).getId(), 0, "Velocity greater than 2x safe thrust")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not exceeding 2x safe thrust"); } return roll; }
@Override protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, IGame game, Server server) { AmmoType atype = (AmmoType) game.getEntity(waa.getEntityId()) .getEquipment(waa.getWeaponId()).getLinked().getType(); if (atype.hasFlag(AmmoType.F_TELE_MISSILE) && game.getBoard().inSpace()) return new KillerWhaleTHandler(toHit, waa, game, server); return new KillerWhaleHandler(toHit, waa, game, server); } }
@Override protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, IGame game, Server server) { AmmoType atype = (AmmoType) game.getEntity(waa.getEntityId()) .getEquipment(waa.getWeaponId()).getLinked().getType(); if (atype.hasFlag(AmmoType.F_TELE_MISSILE) && game.getBoard().inSpace()) { return new TeleMissileHandler(toHit, waa, game, server); } return new CapitalMissileHandler (toHit, waa, game, server); } }