/*** * get a vector of units that are unloadable on the ground */ public Vector<Entity> getUnloadableUnits() { Vector<Entity> unloadable = new Vector<Entity>(); // TODO: we need to handle aeros and VTOLs differently for (int i = 0; i < troops.size(); i++) { Entity nextUnit = game.getEntity(troops.elementAt(i)); unloadable.add(nextUnit); } return unloadable; }
private double getAimModifier(int target_id, int location) { double loc_total; // TODO: change the factor of 0.1 to float depending on critical item // type loc_total = 0.1 * game.getEntity(target_id).getHittableCriticals( location); return loc_total; }
@Override public void useFuel(int fuel) { for (Integer fId : fighters) { IAero fighter = (IAero) game.getEntity(fId); fighter.useFuel(fuel); } }
@Override public void setBombChoices(int[] bc) { // Set the bombs for the squadron if (bc.length == bombChoices.length) { bombChoices = bc; } // Update each fighter in the squadron for (Integer fId : fighters) { IBomber fighter = (IBomber) game.getEntity(fId); fighter.setBombChoices(bc); } }
@Override public Optional<List<Entity>> getSubEntities() { return Optional.of(fighters.stream().map(fid -> game.getEntity(fid)) .collect(Collectors.toList())); }
@Override public int getHeatSinks() { return fighters.stream().map(fid -> game.getEntity(fid)) .filter(ACTIVE_CHECK).mapToInt(ent -> ((IAero)ent).getHeatSinks()).sum(); }
public void actionPerformed(ActionEvent e) { try { FiringDisplay display = (FiringDisplay) currentPanel; int id = Integer.parseInt(e.getActionCommand()); display.updateFlipArms(!game.getEntity(id).getArmsFlipped()); } catch (Exception ex) { ex.printStackTrace(); } } });
@Override public int getSI() { return fighters.stream().map(fid -> game.getEntity(fid)) .filter(ACTIVE_CHECK).mapToInt(ent -> ((IAero)ent).getSI()).min().orElse(0); }
@Override public int getFuel() { return fighters.stream().map(fid -> game.getEntity(fid)) .filter(ACTIVE_CHECK).mapToInt(ent -> ((IAero)ent).getFuel()).min().orElse(0); }
@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(); }
/** * Returns the current entity. */ private synchronized Entity ce() { if (clientgui != null) { return clientgui.getClient().getGame().getEntity(cen); } else { return null; } }
/** * Returns the current entity. */ Entity ce() { return clientgui.getClient().getGame().getEntity(cen); }
@Override public boolean hasActiveECM() { if (!game.getOptions() .booleanOption(OptionsConstants.ADVAERORULES_STRATOPS_ECM) || !game.getBoard().inSpace()) { return super.hasActiveECM(); } return fighters.stream().map(fid -> game.getEntity(fid)) .filter(ACTIVE_CHECK).filter(ent -> ent.hasActiveECM()) .findFirst().isPresent(); }
@Override public void applyDamage() { m_bImmobile |= m_bImmobileHit; //Towed trailers need to use the values of the tractor, or they return Immobile due to 0 MP... if (isTrailer() && getTractor() != Entity.NONE && game.getEntity(getTractor()).hasETypeFlag(Entity.ETYPE_TANK)) { Tank Tractor = (Tank) game.getEntity(getTractor()); m_bImmobile = Tractor.m_bImmobile; m_bImmobileHit = Tractor.m_bImmobileHit; } super.applyDamage(); }
public ToHitData toHit(IGame game) { final Entity entity = game.getEntity(getEntityId()); return DfaAttackAction.toHit(game, getEntityId(), game.getTarget(getTargetType(), getTargetId()), entity.getPosition()); }
@Override protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, IGame game, Server server) { if ((game.getEntity(waa.getEntityId()).getEquipment(waa.getWeaponId()) .curMode().equals("Heat"))) { return new FlamerHeatHandler(toHit, waa, game, server); } return new FlamerHandler(toHit, waa, game, server); }
public ToHitData toHit(IGame game, boolean skid) { final Entity entity = game.getEntity(getEntityId()); return toHit(game, game.getTarget(getTargetType(), getTargetId()), entity.getPosition(), entity.getElevation(), entity.moved, skid, false); }
/** * To-hit number for a ram, assuming that movement has been handled */ public ToHitData toHit(IGame game) { final Entity entity = game.getEntity(getEntityId()); return toHit(game, game.getTarget(getTargetType(), getTargetId()), entity.getPosition(), entity.getElevation(), entity.getPriorPosition(), entity.moved); }
@Override protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, IGame game, Server server) { AmmoType atype = (AmmoType) game.getEntity(waa.getEntityId()) .getEquipment(waa.getWeaponId()).getLinked().getType(); if ((atype.getMunitionType() == AmmoType.M_NARC_EX) || (atype.getMunitionType() == AmmoType.M_EXPLOSIVE)) { return new NarcExplosiveHandler(toHit, waa, game, server); } return new NarcHandler(toHit, waa, game, server); } }
@Override protected AttackHandler getCorrectHandler(ToHitData toHit, WeaponAttackAction waa, IGame game, Server server) { AmmoType atype = (AmmoType) game.getEntity(waa.getEntityId()) .getEquipment(waa.getWeaponId()).getLinked().getType(); if (atype.hasFlag(AmmoType.F_TELE_MISSILE) && game.getBoard().inSpace()) return new KillerWhaleTHandler(toHit, waa, game, server); return new KillerWhaleHandler(toHit, waa, game, server); } }