public int getExtremeRangeModifier() { int mod = 6; if (hasAbility(OptionsConstants.GUNNERY_RANGE_MASTER, Crew.RANGEMASTER_EXTREME)) { mod = 0; } if (hasAbility(OptionsConstants.GUNNERY_SNIPER) && (mod > 0)) { mod = mod / 2; } return mod; }
public int getAllowedPhysicalAttacks() { if ((null != crew) && hasAbility(OptionsConstants.PILOT_MELEE_MASTER)) { return 2; } return 1; }
public int modifyPhysicalDamageForMeleeSpecialist() { if (!hasAbility(OptionsConstants.PILOT_MELEE_SPECIALIST)) { return 0; } return 1; }
public boolean isUsingManAce() { return hasAbility(OptionsConstants.PILOT_MANEUVERING_ACE); }
/** * Calculate the piloting skill roll modifier, based upon the number of * hexes moved this phase. Used for skidding. */ public int getMovementBeforeSkidPSRModifier(int distance) { int mod = -1; if (distance > 24) { mod = 6; } else if (distance > 17) { mod = 5; } else if (distance > 10) { mod = 4; } else if (distance > 7) { mod = 2; } else if (distance > 4) { mod = 1; } else if (distance > 2) { mod = 0; } else { // 0-2 hexes mod = -1; } if (hasAbility(OptionsConstants.PILOT_MANEUVERING_ACE)) { mod--; } return mod; }
public boolean hasActiveEiCockpit() { return (hasEiCockpit() && hasAbility(OptionsConstants.UNOFF_EI_IMPLANT)); }
public int getMediumRangeModifier() { int mod = 2; if (hasAbility(OptionsConstants.GUNNERY_RANGE_MASTER, Crew.RANGEMASTER_MEDIUM)) { mod = 0; } if (hasAbility(OptionsConstants.GUNNERY_SNIPER) && (mod > 0)) { mod = mod / 2; } if (hasQuirk(OptionsConstants.QUIRK_POS_IMP_TARG_M)) { mod--; } if (hasQuirk(OptionsConstants.QUIRK_NEG_POOR_TARG_M)) { mod++; } return mod; }
@Override protected int calcnCluster() { if ((target instanceof Mech) || (target instanceof Aero)) { bSalvo = false; return 1; } int toReturn = 5; if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { toReturn = Compute.d6(2); } bSalvo = true; // pain shunted infantry get half damage if ((target instanceof Infantry) && ((Entity) target).hasAbility(OptionsConstants.MD_PAIN_SHUNT)) { toReturn = Math.max(toReturn / 2, 1); } return toReturn; }
@Override protected int calcDamagePerHit() { int toReturn = super.calcDamagePerHit(); if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { // pain shunted infantry get half damage if (((Entity) target).hasAbility(OptionsConstants.MD_PAIN_SHUNT)) { toReturn = (int) Math.floor(toReturn / 2.0); } } else if ((target instanceof BattleArmor) && ((BattleArmor) target).isFireResistant()) { toReturn = 0; } return toReturn; }
@Override protected int calcDamagePerHit() { int toReturn = super.calcDamagePerHit(); if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { // pain shunted infantry get half damage if (((Entity) target).hasAbility(OptionsConstants.MD_PAIN_SHUNT)) { toReturn = (int) Math.floor(toReturn / 2.0); } } else if ((target instanceof BattleArmor) && ((BattleArmor) target).isFireResistant()) { toReturn = 0; } return toReturn; }
@Override protected int calcDamagePerHit() { if ((target instanceof Mech) || (target instanceof Aero)) { return 0; } int toReturn = 1; if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { toReturn = Compute.d6(3); // pain shunted infantry get half damage if (bDirect) { toReturn += toHit.getMoS() / 3; } if (((Entity) target).hasAbility(OptionsConstants.MD_PAIN_SHUNT)) { toReturn = Math.max(toReturn / 2, 1); } } else if (bDirect) { toReturn = Math.min(toReturn + (toHit.getMoS() / 3), toReturn * 2); } if (bGlancing) { toReturn = (int) Math.floor(toReturn / 2.0); } return toReturn; }
public int getLongRangeModifier() { int mod = 4; if (hasAbility(OptionsConstants.GUNNERY_RANGE_MASTER, Crew.RANGEMASTER_LONG)) { mod = 0; } if (hasAbility(OptionsConstants.GUNNERY_SNIPER) && (mod > 0)) { mod = mod / 2; } if (hasQuirk(OptionsConstants.QUIRK_POS_IMP_TARG_L)) { mod--; } if (hasQuirk(OptionsConstants.QUIRK_NEG_POOR_TARG_L)) { mod++; } if (hasQuirk(OptionsConstants.QUIRK_POS_VAR_RNG_TARG_L)) { mod--; } if (hasQuirk(OptionsConstants.QUIRK_POS_VAR_RNG_TARG_S)) { mod++; } return mod; }
/** * Modifier to physical attack BTH due to pilot advantages */ public static void modifyPhysicalBTHForAdvantages(Entity attacker, Entity target, ToHitData toHit, IGame game) { if (attacker.hasAbility(OptionsConstants.PILOT_MELEE_SPECIALIST) && (attacker instanceof Mech)) { toHit.addModifier(-1, OptionsConstants.PILOT_MELEE_SPECIALIST); } IHex curHex = game.getBoard().getHex(attacker.getPosition()); if (attacker.hasAbility(OptionsConstants.PILOT_TM_FROGMAN) && ((attacker instanceof Mech) || (attacker instanceof Protomech)) && (curHex.terrainLevel(Terrains.WATER) > 1)) { toHit.addModifier(-1, "Frogman"); } if (attacker.hasAbility(OptionsConstants.UNOFF_CLAN_PILOT_TRAINING)) { toHit.addModifier(1, "clan pilot training"); } // Mek targets that are dodging are harder to hit. if ((target != null) && (target instanceof Mech) && target.hasAbility(OptionsConstants.PILOT_DODGE_MANEUVER) && (target.dodging)) { toHit.addModifier(2, "target is dodging"); } }
public boolean hasC3i() { if (isShutDown() || isOffBoard()) { return false; } for (Mounted m : getEquipment()) { if ((m.getType() instanceof MiscType) && m.getType().hasFlag(MiscType.F_C3I) && !m.isInoperable()) { return true; } } // check for Manei Domini implants if ((this instanceof Infantry) && (null != crew) //Fix for Bug Report #1194 && hasAbility(OptionsConstants.MD_ENH_MM_IMPLANTS) && hasAbility(OptionsConstants.MD_BOOST_COMM_IMPLANT)) { return true; } return false; }
/** * 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; }
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; }
@Override protected int calcDamagePerHit() { double toReturn; if ((target instanceof Infantry) && !(target instanceof BattleArmor)) { if (ae instanceof BattleArmor) { toReturn = Compute.d6(3); } else if ((wtype instanceof ISHeavyFlamer) || (wtype instanceof CLHeavyFlamer)) { toReturn = Compute.d6(6); } else { toReturn = Compute.d6(4); } if (bDirect) { toReturn += toHit.getMoS() / 3; } // pain shunted infantry get half damage if (((Entity) target).hasAbility(OptionsConstants.MD_PAIN_SHUNT)) { toReturn /= 2; } if (bGlancing) { toReturn = Math.ceil(toReturn / 2.0); } } else { toReturn = super.calcDamagePerHit(); } return (int) toReturn; }
/** * Returns true if the player has a valid unit with the Tactical Genius * pilot special ability. */ public boolean hasTacticalGenius(IPlayer player) { for (Entity entity : entities) { if (entity.hasAbility(OptionsConstants.MISC_TACTICAL_GENIUS) && entity.getOwner().equals(player) && !entity.isDestroyed() && entity.isDeployed() && !entity.isCarcass() && !entity.getCrew().isUnconscious()) { return true; } } return false; }
/** * Apply PSR modifier for difficult terrain at the specified coordinates * * @param roll the PSR to modify * @param c the coordinates where the PSR happens * @param enteringRubble True if entering rubble, else false */ public void addPilotingModifierForTerrain(PilotingRollData roll, Coords c, boolean enteringRubble) { if ((c == null) || (roll == null)) { return; } if (isOffBoard() || !(isDeployed())) { return; } IHex hex = game.getBoard().getHex(c); hex.terrainPilotingModifier(getMovementMode(), roll, enteringRubble); if (hex.containsTerrain(Terrains.JUNGLE) && hasAbility(OptionsConstants.PILOT_TM_FOREST_RANGER)) { roll.addModifier(-1, "Forest Ranger"); } }
/** * 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; }