/** * Return a List of Entities at Coords <code>c</code> * * @param c The coordinates to check * @return <code>List<Entity></code> */ public List<Entity> getEntitiesVector(Coords c) { return getEntitiesVector(c, false); }
/** * Returns an Enumeration of the active entities at the given coordinates. */ public Iterator<Entity> getEntities(Coords c, boolean ignore) { return getEntitiesVector(c,ignore).iterator(); }
/** * Return a Vector of gun emplacements at Coords <code>c</code> * * @param c The coordinates to check * @return <code>Vector<Entity></code> */ public Vector<GunEmplacement> getGunEmplacements(Coords c) { Vector<GunEmplacement> vector = new Vector<GunEmplacement>(); // Only build the list if the coords are on the board. if (board.contains(c)) { for (Entity entity : getEntitiesVector(c, true)) { if (entity.hasETypeFlag(Entity.ETYPE_GUN_EMPLACEMENT)) { vector.addElement((GunEmplacement) entity); } } } return vector; }
public void rollInitAndResolveTies() { if (getOptions().booleanOption(OptionsConstants.RPG_INDIVIDUAL_INITIATIVE)) { Vector<TurnOrdered> vRerolls = new Vector<TurnOrdered>(); for (int i = 0; i < entities.size(); i++) { Entity e = entities.get(i); if (initiativeRerollRequests.contains(getTeamForPlayer(e.getOwner()))) { vRerolls.add(e); } } TurnOrdered.rollInitAndResolveTies(getEntitiesVector(), vRerolls, false); } else { TurnOrdered.rollInitAndResolveTies(teams, initiativeRerollRequests, getOptions().booleanOption(OptionsConstants.INIT_INITIATIVE_STREAK_COMPENSATION)); } initiativeRerollRequests.removeAllElements(); }
/** * Get Entities that have have a iNarc Nemesis pod attached and are situated * between two Coords * * @param attacker The attacking <code>Entity</code>. * @param target The <code>Coords</code> of the original target. * @return a <code>Enumeration</code> of entities that have nemesis pods * attached and are located between attacker and target and are * friendly with the attacker. */ public Enumeration<Entity> getNemesisTargets(Entity attacker, Coords target) { final Coords attackerPos = attacker.getPosition(); final ArrayList<Coords> in = Coords.intervening(attackerPos, target); Vector<Entity> nemesisTargets = new Vector<Entity>(); for (Coords c : in) { for (Entity entity : getEntitiesVector(c)) { if (entity.isINarcedWith(INarcPod.NEMESIS) && !entity.isEnemyOf(attacker)) { nemesisTargets.addElement(entity); } } } return nemesisTargets.elements(); }
/** * Returns a Target for an Accidental Fall From above, or null if no * possible target is there * * @param c The <code>Coords</code> of the hex in which the accidental * fall from above happens * @param ignore The entity who is falling * @return The <code>Entity</code> that should be an AFFA target. */ public Entity getAffaTarget(Coords c, Entity ignore) { Vector<Entity> vector = new Vector<Entity>(); if (board.contains(c)) { IHex hex = board.getHex(c); for (Entity entity : getEntitiesVector(c)) { if (entity.isTargetable() && ((entity.getElevation() == 0) // Standing on hex surface || (entity.getElevation() == -hex.depth())) // Standing on hex floor && (entity.getAltitude() == 0) && !(entity instanceof Infantry) && (entity != ignore)) { vector.addElement(entity); } } } if (!vector.isEmpty()) { int count = vector.size(); int random = Compute.randomInt(count); return vector.elementAt(random); } return null; }
/** * Determine if the given set of coordinates has a gun emplacement on the roof of a building. * @param c The coordinates to check */ public boolean hasRooftopGunEmplacement(Coords c) { Building building = getBoard().getBuildingAt(c); if(building == null) { return false; } IHex hex = getBoard().getHex(c); for (Entity entity : getEntitiesVector(c, true)) { if (entity.hasETypeFlag(Entity.ETYPE_GUN_EMPLACEMENT) && entity.getElevation() == hex.ceiling()) { return true; } } return false; }
Mockito.when(mockGame.getEntitiesVector()).thenReturn(entitiesVector); Mockito.when(mockGame.getEntitiesVector()).thenReturn(entitiesVector); Mockito.when(ae.getECCMInfo()).thenReturn(null); entitiesVector.add(enemy1); entitiesVector.add(ae); Mockito.when(mockGame.getEntitiesVector()).thenReturn(entitiesVector);
boolean C3iSet = false; for (Entity e : game.getEntitiesVector()) {
Mockito.when(mockGame.getEntitiesVector()).thenReturn(entitiesVector); Mockito.when(mockGame.getEntitiesVector()).thenReturn(entitiesVector); Mockito.when(ae.getECCMInfo()).thenReturn(null); entitiesVector.add(ae); entitiesVector.add(additionalEnemy); Mockito.when(mockGame.getEntitiesVector()).thenReturn(entitiesVector); result = ComputeECM.isAffectedByECM(ae, aePos, aePos); TestCase.assertEquals(false, result);