@Override protected int calcDamagePerHit() { if (target instanceof Infantry && !(target instanceof BattleArmor)) { int toReturn = Compute.directBlowInfantryDamage( wtype.getRackSize(), bDirect ? toHit.getMoS() / 3 : 0, wtype.getInfantryDamageClass(), ((Infantry) target).isMechanized(), toHit.getThruBldg() != null, ae.getId(), calcDmgPerHitReport); return toReturn; } return 1; }
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; }
/** * 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; }
/** * calculate any changes to the PSR modifier for entering difficult terrain */ private void adjustDifficultTerrainPSRModifier(PilotingRollData psr) { if (hasQuirk(OptionsConstants.QUIRK_POS_EASY_PILOT) && (getCrew().getPiloting() > 3)) { psr.addModifier(-1, "easy to pilot"); } if (hasQuirk(OptionsConstants.QUIRK_NEG_UNBALANCED)) { psr.addModifier(+1, "unbalanced"); } }
/** * @return The number of points taken up by all mounted bombs or other external stores. */ default int getBombPoints() { int points = 0; for (Mounted bomb : getBombs()) { if (bomb.getUsableShotsLeft() > 0) { points += BombType.getBombCost(((BombType) bomb.getType()).getBombType()); } } return points; }
/** * Resets techAdvancement to initial value and adjusts for all installed equipment. */ public void recalculateTechAdvancement() { initTechAdvancement(); for (Mounted m : getEquipment()) { compositeTechLevel.addComponent(m.getType()); if (m.isArmored()) { compositeTechLevel.addComponent(TA_ARMORED_COMPONENT); } } }
public boolean usedTag() { for (Mounted weapon : getWeaponList()) { WeaponType wtype = (WeaponType) weapon.getType(); if (weapon.isUsedThisRound() && wtype.hasFlag(WeaponType.F_TAG)) { return true; } } return false; }
default PilotingRollData checkHover(MovePath md) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(md.getLastStepMovementType()); if (md.contains(MoveStepType.HOVER) && (md.getLastStepMovementType() == EntityMovementType.MOVE_OVER_THRUST)) { // append the reason modifier roll.append(new PilotingRollData(((Entity) this).getId(), 0, "hovering above safe thrust")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: entity did not hover"); } return roll; }
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()); }
/** * 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())); } }
public int getFinalVelocity() { if (getLastStep() != null) { return getLastStep().getVelocity(); } if (getEntity().isAero()) { return ((IAero) getEntity()).getCurrentVelocity(); } return 0; }
public int getFinalVelocityLeft() { if (getLastStep() != null) { return getLastStep().getVelocityLeft(); } if (getEntity().isAero()) { return ((IAero) getEntity()).getCurrentVelocity(); } return 0; }
public boolean hasNovaCEWS() { for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_NOVA) && !m.isInoperable()) { return true; } } return false; }
public boolean hasTAG() { for (Mounted m : getWeaponList()) { WeaponType equip = (WeaponType) (m.getType()); if ((equip != null) && (equip.hasFlag(WeaponType.F_TAG))) { return true; } } return false; }
@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); }
/** * does this mech have TSM? */ public boolean hasTSM() { for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_TSM)) { return true; } } return false; }
@Override public void applyBombs() { // Make sure all of the aeros have their bombs applied, otherwise // problems // once the bombs are applied, the choices are cleared, so it's not an // issue if the bombs are applied twice for an Aero for (Integer fId : fighters) { IBomber fighter = (IBomber) game.getEntity(fId); fighter.applyBombs(); } computeSquadronBombLoadout(); }
@Override protected int calcDamagePerHit() { if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { int toReturn = Compute.directBlowInfantryDamage( wtype.getRackSize() * 2, bDirect ? toHit.getMoS() / 3 : 0, wtype.getInfantryDamageClass(), ((Infantry) target).isMechanized(), toHit.getThruBldg() != null, ae.getId(), calcDmgPerHitReport); return toReturn; } return 2; }
/** * does this mech have SCM? */ public boolean hasSCM() { for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_SCM)) { return true; } } return false; }