public boolean hasPilot() { return null != entity.getCrew(); }
/** * determine if an entity has an ability that is identified by its presence or absence only. * The entity may gain this ability from different places, not exclusively the crew. * @param name - name of the ability as recorded in the options * @return true if the entity has this ability from some source */ public boolean hasAbility(String name) { if(null != getCrew()) { return getCrew().getOptions().booleanOption(name); } //TODO: look for the ability at the player level return false; }
/** * determine if an entity has an ability at a given level. * The entity may gain this ability from different places, not exclusively the crew. * @param name - name of the ability as recorded in the optionsme * @param choice - A string indicating the given level being asked about * @return true if the entity has this ability at the given choice from some source */ public boolean hasAbility(String name, String choice) { if(null != getCrew()) { return getCrew().getOptions().stringOption(name).equals(choice); } return false; }
public int getGhostTargetRollMoS() { return ghostTargetRoll - (getCrew().getSensorOps() + 2); }
/** * @return the initiative bonus this Entity grants for quirks */ public int getQuirkIniBonus() { // command battlemech and and battle computer are not cumulative if (hasQuirk(OptionsConstants.QUIRK_POS_BATTLE_COMP) && !getCrew().isDead() && !getCrew().isUnconscious()) { return 2; } else if (hasQuirk(OptionsConstants.QUIRK_POS_COMMAND_MECH) && !getCrew().isDead() && !getCrew().isUnconscious()) { return 1; } return 0; }
public static boolean isDeadCrew(Entity e) { if (Compute.getFullCrewSize(e) == 0 || e.getCrew().isDead()) { return true; } return false; }
public boolean usesSoloPilot() { //return Compute.getFullCrewSize(entity) == 1; //Taharqa: I dont think we should do it based on computed size, but whether the unit logically //is the type of unit that has only one pilot. This is partly because there may be some vees //that only have one pilot and this is also a problem for BA units with only one active suit return ((entity instanceof Mech) || (entity instanceof Protomech) || (entity instanceof Aero && !(entity instanceof SmallCraft) && !(entity instanceof Jumpship))) && (entity.getCrew().getCrewType().getPilotPos() == entity.getCrew().getCrewType().getGunnerPos()); }
private boolean isEnemyGunEmplacement(final Entity entity, final Coords coords) { return entity.hasETypeFlag(Entity.ETYPE_GUN_EMPLACEMENT) && entity.getOwner().isEnemyOf(getLocalPlayer()) && !getStrategicBuildingTargets().contains(coords) && (null != entity.getCrew()) && !entity.getCrew().isDead(); }
public List<Entity> getEnemyEntities() { ArrayList<Entity> result = new ArrayList<>(); for (Entity entity : game.getEntitiesVector()) { if (entity.getOwner().isEnemyOf(getLocalPlayer()) && (entity.getPosition() != null) && !entity.isOffBoard() && (entity.getCrew() != null) && !entity.getCrew().isDead()) { result.add(entity); } } return result; }
public boolean canTakeTechOfficer() { return techOfficer == null && (entity.getCrew().getCrewType().getTechPos() >= 0 //Use techOfficer field for secondary commander || (entity instanceof Tank && entity.hasWorkingMisc(MiscType.F_COMMAND_CONSOLE))); }
public boolean isActive(int turn) { boolean isActive = !shutDown && !isManualShutdown() && !destroyed && getCrew().isActive() && !unloadedThisTurn; if ((turn > -1) && isActive) { isActive = !deployed && shouldDeploy(turn); } else { isActive = isActive && deployed; } return isActive; }
public String getSummaryFor(Person person, Unit unit) { String toReturn = "<html><font size='2'><b>" + person.getFullTitle() + "</b><br/>"; toReturn += person.getSkillSummary() + " " + person.getRoleDesc(); if(null != unit && null != unit.getEntity() && null != unit.getEntity().getCrew() && unit.getEntity().getCrew().getHits() > 0) { toReturn += "<br><font color='red' size='2'>" + unit.getEntity().getCrew().getHits() + " hit(s)"; } toReturn += "</font></html>"; return toReturn; }
public boolean canFire(boolean isStrafing) { // Equipment operational? if (!isReady(isStrafing) || isBreached() || isMissing() || isFired()) { return false; } // Is the entity even active? if (entity.isShutDown() || ((null != entity.getCrew()) && !entity.getCrew().isActive())) { return false; } // Otherwise, the equipment can be fired. return true; }
/** * 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"); } }
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; }
/** * 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; }
private void updateSearchlight() { setSearchlightEnabled((ce() != null) && (target != null) && ce().isUsingSpotlight() && ce().getCrew().isActive() && SearchlightAttackAction.isPossible(clientgui.getClient() .getGame(), cen, target, null)); }
protected void updateSearchlight() { setSearchlightEnabled((ce() != null) && (target != null) && ce().isUsingSpotlight() && ce().getCrew().isActive() && !ce().isHidden() && SearchlightAttackAction.isPossible(clientgui.getClient() .getGame(), cen, target, null) && !((ce() instanceof Tank) && (((Tank) ce()).getStunnedTurns() > 0))); }