public int elevationOccupied(IHex hex, int elevation) { if (hex == null) { return 0; } if ((movementMode == EntityMovementMode.VTOL) || (movementMode == EntityMovementMode.WIGE)) { return hex.surface() + elevation; } else if (((movementMode == EntityMovementMode.HOVER) || (movementMode == EntityMovementMode.NAVAL) || (movementMode == EntityMovementMode.HYDROFOIL) || hex.containsTerrain(Terrains.ICE)) && hex.containsTerrain(Terrains.WATER)) { return hex.surface(); } else { return hex.floor(); } }
int assumedAlt = assumedElevation + hex.surface(); int maxAlt = hex.surface(); switch (getMovementMode()) { case INF_JUMP: break; case VTOL: maxAlt = hex.surface() + 50; break; case AERODYNE: maxAlt = hex.surface() - getHeight(); break; case INF_UMU: maxAlt = hex.surface() - (getHeight() + 1); break; case WIGE: return false; maxAlt = hex.surface() + 25; } else if (this instanceof Protomech) { maxAlt = hex.surface() + 12; } else if (hex.containsTerrain(Terrains.BLDG_ELEV)) { maxAlt = Math.max(hex.surface(), hex.terrainLevel(Terrains.BLDG_ELEV)) + 1; } else { maxAlt = hex.surface() + 1;
/** * Checks to see if the entities' elevation is below the surface of a water * hex. * * @return True if the entity is underwater, else false. */ public boolean isUnderwater() { IHex occupiedHex = game.getBoard().getHex(getPosition()); if (occupiedHex.containsTerrain(Terrains.WATER) && (relHeight() < occupiedHex.surface())) { return true; } return false; }
ai.attackAbsHeight = srcHex.surface() + elevation + this.boardView1.selectedEntity.getHeight(); } else { ai.attackHeight = guip.getMechInFirst() ? 1 : 0; ai.attackAbsHeight = srcHex.surface() + ai.attackHeight; int trAbsheight = dstHex.surface() + ent.relHeight(); if (trAbsheight > ai.targetAbsHeight) { ai.targetHeight = ent.getHeight(); && (ai.targetAbsHeight == Integer.MIN_VALUE)) { ai.targetHeight = guip.getMechInSecond() ? 1 : 0; ai.targetAbsHeight = dstHex.surface() + ai.targetHeight;
public static ArrayList<Entity> getMountableUnits(Entity en, Coords pos, int elev, IGame game) { ArrayList<Entity> mountable = new ArrayList<Entity>(); // for the moment only allow small craft/dropship mounting, but // this could be expanded to include other unit types // the rules don't say that the unit must be facing loader // so lets take the ring for (Coords c : coordsAtRange(pos, 1)) { IHex hex = game.getBoard().getHex(c); if (null == hex) { continue; } for (Entity other : game.getEntitiesVector(c)) { // Is the other unit friendly and not the current entity? if ((en.getOwner().equals(other.getOwner()) || (en.getOwner() .getTeam() == other.getOwner().getTeam())) && !en.equals(other) && (other instanceof SmallCraft) && other.canLoad(en) && !other.isAirborne() && (Math.abs((hex.surface() + other.getElevation()) - elev) < 3) && !mountable.contains(other)) { mountable.add(other); } } } return mountable; }
int level = current.surface() + assumedElevation; int curSurface = current.surface(); if (current.containsTerrain(Terrains.BLDG_ELEV)) { curSurface += current.terrainLevel(Terrains.BLDG_ELEV); int nextSurface = next.surface(); if (next.containsTerrain(Terrains.BLDG_ELEV)) { nextSurface += next.terrainLevel(Terrains.BLDG_ELEV); retVal = nextLevel - next.surface(); } else if ((getMovementMode() == EntityMovementMode.SUBMARINE) || ((getMovementMode() == EntityMovementMode.INF_UMU) || ((getMovementMode() == EntityMovementMode.QUAD_SWIM) && hasUMU()) || ((getMovementMode() == EntityMovementMode.BIPED_SWIM) && hasUMU())) { retVal += current.surface(); retVal -= next.surface(); } else { || (retVal > bldnex)) { retVal = bldnex; } else if ((bldnex + next.surface()) > (bldcur + current.surface())) { int nextBasement = next.terrainLevel(Terrains.BLDG_BASEMENT_TYPE); next.terrainLevel(Terrains.BLDG_BASE_COLLAPSED); if (climb || isJumpingNow) {
int assumedAlt = assumedElevation + hex.surface(); if (getMovementMode() == EntityMovementMode.VTOL) { if ((this instanceof Infantry) && getMovementMode() == EntityMovementMode.INF_UMU) { return assumedAlt >= Math.max(hex.floor(), -2) && (assumedAlt <= hex.surface()); return ((assumedAlt >= hex.floor()) && (assumedAlt <= hex.surface())); } else if ((getMovementMode() == EntityMovementMode.HYDROFOIL) || (getMovementMode() == EntityMovementMode.NAVAL)) { return assumedAlt == hex.surface(); } else if (getMovementMode() == EntityMovementMode.WIGE) { hex.containsTerrain(Terrains.WATER))) { if (assumedAlt == hex.surface()) { return true; && (assumedAlt < hex.surface()) && !(this instanceof Mech) && !(this instanceof Protomech)) { return false; if ((assumedAlt >= (hex.surface() - hex.depth(true))) && (assumedAlt <= hex.ceiling())) { return true;
&& (h.surface() > (self.getEntity().getElevation() + ((option .getFinalProne()) ? 0 : 1)))) { double mod = ((self.getEntity().heat + option
ce().setElevation(0); } else { ce().setElevation(deployhex.floor() - deployhex.surface());
elevation = Math.max(0, elevation - (hex.ceiling() - hex.surface() + 1));
} else { attUnderWater = attHex.containsTerrain(Terrains.WATER) && (attHex.depth() > 0) && (attEl < attHex.surface()); attInWater = attHex.containsTerrain(Terrains.WATER) && (attHex.depth() > 0) && (attEl == attHex.surface()); attOnLand = !(attUnderWater || attInWater); } else { targetUnderWater = targetHex.containsTerrain(Terrains.WATER) && (targetHex.depth() > 0) && (targEl < targetHex.surface()); targetInWater = targetHex.containsTerrain(Terrains.WATER) && (targetHex.depth() > 0) && (targEl == targetHex.surface()); targetOnLand = !(targetUnderWater || targetInWater);
int hexEl = ai.underWaterCombat ? hex.floor() : hex.surface();
if (attHex.containsTerrain(Terrains.WATER) && (attHex.surface() > attEl)) { toHita.addModifier(TargetRoll.IMPOSSIBLE, "Attacker in depth 2+ water"); toHitd.addModifier(TargetRoll.IMPOSSIBLE, "Defender in depth 2+ water"); } else if ((attHex.surface() == attEl) && (ae.height() > 0)) { apc = true; if ((targHex.surface() == targEl) && (te.height() > 0)) { pc = true; } else if (targHex.surface() > targEl) { toHita.addModifier(TargetRoll.IMPOSSIBLE, "Attacker in depth 2+ water");
&& !(entity.getElevation() > destHex.surface()) && !((entity.getMovementMode() == EntityMovementMode.HOVER) || (entity.getMovementMode() == EntityMovementMode.NAVAL)
boolean isUnderwater = ((entityTarget != null) && (hex != null)) && hex.containsTerrain(Terrains.WATER) && (hex.depth() > 0) && (entityTarget.getElevation() < hex.surface()); ToHitData toHit = new ToHitData();
&& (getHeight() >= hex.terrainLevel(Terrains.BRIDGE_ELEV) - hex.surface())) { return true;