/** * return the <code>int</code> Id of the attacking <code>Entity</code> */ public int getAttackerId() { return ae.getId(); }
public MechDisplayEvent(Object source, Entity entity, Mounted weapon) { super(source); this.entity = entity; this.entityId = entity.getId(); this.type = WEAPON_SELECTED; this.equip = weapon; this.weaponId = entity.getEquipmentNum(weapon); }
private void checkEnemyBroken(Entity entity, boolean forcedWithdrawal) { if (forcedWithdrawal && entity.isCrippled()) { brokenEnemies.add(entity.getId()); } }
private void removeEntityPositionLookup(Entity e) { // Remove Entity from cache for (Coords pos : e.getOccupiedCoords()) { HashSet<Integer> posEntities = entityPosLookup.get(pos); if (posEntities != null) { posEntities.remove(e.getId()); } } }
public CEntity get(Entity es) { CEntity result = null; if ((result = super.get(new Integer(es.getId()))) == null) { result = new CEntity(es, tb); this.put(result); } return result; }
protected void receiveEntityAdd(Packet packet) { @SuppressWarnings("unchecked") List<Integer> entityIds = (List<Integer>) packet.getObject(0); @SuppressWarnings("unchecked") List<Entity> entities = (List<Entity>) packet.getObject(1); assert(entityIds.size() == entities.size()); for (int i = 0; i < entityIds.size(); i++) { assert(entityIds.get(i) == entities.get(i).getId()); } game.addEntities(entities); }
private void receiveEntityAdd(Packet packet) { @SuppressWarnings("unchecked") List<Integer> entityIds = (List<Integer>) packet.getObject(0); @SuppressWarnings("unchecked") List<Entity> entities = (List<Entity>) packet.getObject(1); assert (entityIds.size() == entities.size()); for (int i = 0; i < entityIds.size(); i++) { assert (entityIds.get(i) == entities.get(i).getId()); } getGame().addEntities(entities); }
public boolean isAttackingThisTurn() { List<EntityAction> actions = game.getActionsVector(); for (EntityAction ea : actions) { if ((ea.getEntityId() == getId()) && (ea instanceof AbstractAttackAction)) { return true; } } return false; }
private void setNewNetworkID(Entity ent, String net) { ent.setNewRoundNovaNetworkString(net); client.sendNovaChange(ent.getId(), net); }
public void deleteAllUnits(Client c) { ArrayList<Entity> currentUnits = c.getGame().getPlayerEntities( c.getLocalPlayer(), false); ArrayList<Integer> ids = new ArrayList<Integer>(currentUnits.size()); for (Entity e : currentUnits){ ids.add(e.getId()); } c.sendDeleteEntities(ids); }
public void recover(Entity unit) throws IllegalArgumentException { // If we can't load the unit, throw an exception. if (!canLoad(unit)) { throw new IllegalArgumentException("Can not recover " + unit.getShortName() + " into this bay. " + getUnused()); } currentSpace -= 1; // get the closest open recovery slot and make it unavailable closeSlot(); // Add the unit to our list of troops. troops.addElement(unit.getId()); }
public void recover(Entity unit) throws IllegalArgumentException { // If we can't load the unit, throw an exception. if (!canLoad(unit)) { throw new IllegalArgumentException("Can not recover " + unit.getShortName() + " into this bay. " + getUnused()); } currentSpace -= 1; // get the closest open recovery slot and make it unavailable closeSlot(); // Add the unit to our list of troops. troops.addElement(unit.getId()); }
public int getNextDeployableEntityNum(GameTurn turn, int start) { if (start >= 0) { for (int i = start; i < entities.size(); i++) { final Entity entity = entities.get(i); if (turn.isValidEntity(entity, this) && entity.shouldDeploy(getRoundCount())) { return entity.getId(); } } } return getFirstDeployableEntityNum(turn); }
@Override public boolean shouldStay(MovePath movePath) { boolean isLegal = movePath.isMoveLegal(); return isLegal && (Compute.stackingViolation(getGame(), mover.getId(), movePath.getFinalCoords()) == null); } };
@Override protected int calcDamagePerHit() { if (target instanceof Infantry && !(target instanceof BattleArmor)) { int toReturn = Compute.directBlowInfantryDamage( wtype.getRackSize(), bDirect ? toHit.getMoS() / 3 : 0, wtype.getInfantryDamageClass(), ((Infantry) target).isMechanized(), toHit.getThruBldg() != null, ae.getId(), calcDmgPerHitReport); return toReturn; } return 1; }
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 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; }
private WeaponAttackAction buildBombAttackAction(final int[] bombPayload) { final WeaponAttackAction diveBomb = new WeaponAttackAction(getShooter().getId(), getTarget().getTargetType(), getTarget().getTargetId(), getShooter().getEquipmentNum(getWeapon())); diveBomb.setBombPayload(bombPayload); return diveBomb; }