/** * Returns an entity's base piloting skill roll needed Only use this version * if the entity is through processing movement */ public PilotingRollData getBasePilotingRoll() { return getBasePilotingRoll(moved); }
default PilotingRollData checkDown(int drop, EntityMovementType overallMoveType) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(overallMoveType); if (drop > 2) { // append the reason modifier roll.append(new PilotingRollData(((Entity) this).getId(), drop, "lost more than two altitudes")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: entity did not drop more than two altitudes"); } return roll; }
/** * Calculates the Falling damage after a successful To-Hit. * * @param odds * @param ent The entity that is falling * @return */ private static double calculateFallingDamage(double odds, Entity ent) { double dmg = odds; dmg *= 1.0 - (Compute.oddsAbove(ent.getBasePilotingRoll().getValue(), ent.hasAbility(OptionsConstants.PILOT_APTITUDE_PILOTING)) / 100.0); dmg *= ent.getWeight() * 0.1; return dmg; }
default PilotingRollData checkThrustSITotal(int thrust, EntityMovementType overallMoveType) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(overallMoveType); if (thrust > getSI()) { // append the reason modifier roll.append(new PilotingRollData(((Entity) this).getId(), 0, "Thrust spent this turn exceeds current SI")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not exceeding SI"); } return roll; }
/** * Checks if the entity is attempting to sprint with MASC engaged. If so, * returns the target roll for the piloting skill check. */ public PilotingRollData checkSprintingWithMASC( EntityMovementType overallMoveType, int used) { PilotingRollData roll = getBasePilotingRoll(overallMoveType); if ((overallMoveType == EntityMovementType.MOVE_SPRINT || overallMoveType == EntityMovementType.MOVE_VTOL_SPRINT) && (used > ((int) Math.ceil(2.0 * this.getWalkMP())))) { roll.append(new PilotingRollData(getId(), 0, "sprinting with active MASC/Supercharger")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not attempting to sprint with MASC"); } addPilotingModifierForTerrain(roll); return roll; }
/** * Checks if the entity is attempting to sprint with supercharger engaged. * If so, returns the target roll for the piloting skill check. */ public PilotingRollData checkSprintingWithSupercharger( EntityMovementType overallMoveType, int used) { PilotingRollData roll = getBasePilotingRoll(overallMoveType); if ((overallMoveType == EntityMovementType.MOVE_SPRINT || overallMoveType == EntityMovementType.MOVE_VTOL_SPRINT) && (used > ((int) Math.ceil(2.5 * this.getWalkMP())))) { roll.append(new PilotingRollData(getId(), 0, "sprinting with active MASC/Supercharger")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not attempting to sprint with Supercharger"); } addPilotingModifierForTerrain(roll); return roll; }
default PilotingRollData checkThrustSI(int thrust, EntityMovementType overallMoveType) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(overallMoveType); if (thrust > getSI()) { // append the reason modifier roll.append(new PilotingRollData(((Entity) this).getId(), thrust - getSI(), "Thrust exceeds current SI in a single hex")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not exceeding SI"); } return roll; }
/** * Checks if the entity is attempting to sprint with supercharger engaged. * If so, returns the target roll for the piloting skill check. */ public PilotingRollData checkUsingOverdrive (EntityMovementType overallMoveType) { PilotingRollData roll = getBasePilotingRoll(overallMoveType); if ((overallMoveType == EntityMovementType.MOVE_SPRINT || overallMoveType == EntityMovementType.MOVE_VTOL_SPRINT) && (this instanceof Tank || (this instanceof QuadVee && getConversionMode() == QuadVee.CONV_MODE_VEHICLE))) { roll.append(new PilotingRollData(getId(), 0, "using overdrive")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not using overdrive"); } return roll; }
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; }
default PilotingRollData checkRolls(MoveStep step, EntityMovementType overallMoveType) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(overallMoveType); if (((step.getType() == MoveStepType.ROLL) || (step.getType() == MoveStepType.YAW)) && (step.getNRolls() > 1)) { // append the reason modifier roll.append(new PilotingRollData(((Entity) this).getId(), 0, "More than one roll in the same turn")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not rolling more than once"); } return roll; }
/** * Checks if the entity is landing (from a jump) with a prototype JJ If so, * returns the target roll for the piloting skill check. */ public PilotingRollData checkLandingWithPrototypeJJ( EntityMovementType overallMoveType) { PilotingRollData roll = getBasePilotingRoll(overallMoveType); if (getJumpType() == Mech.JUMP_PROTOTYPE) { // append the reason modifier roll.append(new PilotingRollData(getId(), 3, "landing with prototype jump jets")); addPilotingModifierForTerrain(roll); } else { roll.addModifier( TargetRoll.CHECK_FALSE, "Entity does not have protype jump jets -- checking for purposes of determining PSR after jump."); } return roll; }
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; }
/** * Checks if the entity is being swarmed. If so, returns the target roll for * the piloting skill check to dislodge them. */ public PilotingRollData checkDislodgeSwarmers(MoveStep step, EntityMovementType moveType) { // If we're not being swarmed, return CHECK_FALSE if (Entity.NONE == getSwarmAttackerId()) { return new PilotingRollData(getId(), TargetRoll.CHECK_FALSE, "Check false: No swarmers attached"); } // append the reason modifier PilotingRollData roll = getBasePilotingRoll(moveType); roll.append(new PilotingRollData(getId(), 0, "attempting to dislodge swarmers by dropping prone")); addPilotingModifierForTerrain(roll, step); return roll; }
/** * Checks if the entity is landing (from a jump) on ice-covered water. */ public PilotingRollData checkLandingOnIce( EntityMovementType overallMoveType, IHex curHex) { PilotingRollData roll = getBasePilotingRoll(overallMoveType); if (curHex.containsTerrain(Terrains.ICE) && (curHex.terrainLevel(Terrains.WATER) > 0)) { roll.append(new PilotingRollData(getId(), 0, "landing on ice-covered water")); addPilotingModifierForTerrain(roll); adjustDifficultTerrainPSRModifier(roll); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "hex is not covered by ice"); } return roll; }
/** * Checks if the entity is attempting to increase two speed categories. * If so, returns the target roll for the piloting skill check. */ public PilotingRollData checkGunningIt (EntityMovementType overallMoveType) { PilotingRollData roll = getBasePilotingRoll(overallMoveType); if (game.getOptions().booleanOption(OptionsConstants.ADVGRNDMOV_VEHICLE_ACCELERATION) && (this instanceof Tank || (this instanceof QuadVee && getConversionMode() == QuadVee.CONV_MODE_VEHICLE))) { if (((overallMoveType == EntityMovementType.MOVE_SPRINT || overallMoveType == EntityMovementType.MOVE_VTOL_SPRINT) && (movedLastRound == EntityMovementType.MOVE_WALK || movedLastRound == EntityMovementType.MOVE_VTOL_WALK)) || ((overallMoveType == EntityMovementType.MOVE_RUN || overallMoveType == EntityMovementType.MOVE_VTOL_RUN) && (movedLastRound == EntityMovementType.MOVE_NONE || movedLastRound == EntityMovementType.MOVE_JUMP || movedLastRound == EntityMovementType.MOVE_SKID))) { roll.append(new PilotingRollData(getId(), 0, "gunning it")); return roll; } } roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not gunning it"); return roll; }
/** * Checks if the entity is moving into rubble. If so, returns the target * roll for the piloting skill check. */ public PilotingRollData checkRubbleMove(MoveStep step, EntityMovementType moveType, IHex curHex, Coords lastPos, Coords curPos, boolean isLastStep, boolean isPavementStep) { PilotingRollData roll = getBasePilotingRoll(moveType); boolean enteringRubble = true; addPilotingModifierForTerrain(roll, curPos, enteringRubble); if (!lastPos.equals(curPos) && ((moveType != EntityMovementType.MOVE_JUMP) || isLastStep) && (curHex.terrainLevel(Terrains.RUBBLE) > 0) && !isPavementStep && canFall()) { adjustDifficultTerrainPSRModifier(roll); if (hasAbility(OptionsConstants.PILOT_TM_MOUNTAINEER)) { roll.addModifier(-1, "Mountaineer"); } } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not entering rubble"); } return roll; }
/** * Checks if a maneuver requires a control roll */ default PilotingRollData checkManeuver(MoveStep step, EntityMovementType overallMoveType) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(overallMoveType); if ((step == null) || (step.getType() != MoveStepType.MANEUVER)) { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not attempting to get up."); return roll; } boolean sideSlipMod = (this instanceof ConvFighter) && isVSTOL(); roll.append( new PilotingRollData(((Entity) this).getId(), ManeuverType.getMod(step.getManeuverType(), sideSlipMod), ManeuverType.getTypeName(step.getManeuverType()) + " maneuver")); return roll; }
/** * Checks if the entity is attempting to run with damage that would force a * PSR. If so, returns the target roll for the piloting skill check. */ public PilotingRollData checkRunningWithDamage( EntityMovementType overallMoveType) { PilotingRollData roll = getBasePilotingRoll(overallMoveType); int gyroDamage = getBadCriticals(CriticalSlot.TYPE_SYSTEM, Mech.SYSTEM_GYRO, Mech.LOC_CT); if (getGyroType() == Mech.GYRO_HEAVY_DUTY) { gyroDamage--; // HD gyro ignores 1st damage } if (((overallMoveType == EntityMovementType.MOVE_RUN) || (overallMoveType == EntityMovementType.MOVE_SPRINT)) && canFall() && ((gyroDamage > 0) || hasHipCrit())) { // append the reason modifier roll.append(new PilotingRollData(getId(), 0, "running with damaged hip actuator or gyro")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: Entity is not attempting to run with damage"); } addPilotingModifierForTerrain(roll); return roll; }
/** * Checks if an entity is landing (from a jump) in heavy woods. */ public PilotingRollData checkLandingInHeavyWoods( EntityMovementType overallMoveType, IHex curHex) { PilotingRollData roll = getBasePilotingRoll(overallMoveType); if (curHex.containsTerrain(Terrains.WOODS, 2)) { roll.append(new PilotingRollData(getId(), 0, "landing in heavy woods")); addPilotingModifierForTerrain(roll); } else if (curHex.containsTerrain(Terrains.WOODS, 3)) { roll.append(new PilotingRollData(getId(), 0, "landing in ultra woods")); addPilotingModifierForTerrain(roll); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "hex does not contain heavy or ultra woods"); } return roll; }
default PilotingRollData checkStall(MovePath md) { PilotingRollData roll = ((Entity) this).getBasePilotingRoll(md.getLastStepMovementType()); // if the entity has already moved, its movement got interrupted (probably by a hidden unit, not much else can interrupt an aero unit) // in which case, the movement is complete. We just need to allow the user to hit 'done'. if(((Entity) this).delta_distance > 0) { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: aero has already moved"); // an airborne, aerodyne aero is considered to "stall" if it's not moving anywhere, // hovering, landing, or going off board } else if ((md.getFinalVelocity() == 0) && !md.contains(MoveStepType.HOVER) && isAirborne() && !isSpheroid() && !((Entity) this).getGame().getBoard().inSpace() && !md.contains(MoveStepType.LAND) && !md.contains(MoveStepType.VLAND) && !md.contains(MoveStepType.RETURN) && !md.contains(MoveStepType.OFF) && !md.contains(MoveStepType.FLEE)) { roll.append(new PilotingRollData(((Entity) this).getId(), 0, "stalled out")); } else { roll.addModifier(TargetRoll.CHECK_FALSE, "Check false: entity not stalled out"); } return roll; }