if (game.getOptions().booleanOption("push_off_board") && !game.board.contains(dest)) { game.removeEntity(te.getId(), Entity.REMOVE_PUSHED); send(createRemoveEntityPacket(te.getId(), Entity.REMOVE_PUSHED)); phaseReport.append("\n*** " ).append( te.getDisplayName() ).append( " has been forced from the field. ***\n");  ae.setPosition(src); } else { phaseReport.append("succeeds, but target can't be moved.\n"); game.addPSR(pushPRD); }
phaseReport.append("succeeds, but target can't be moved.\n"); game.addPSR(pushPRD);
    private void resolvePushAttack(PhysicalResult pr, int lastEntityId) {        final PushAttackAction paa = (PushAttackAction)pr.aaa;    	        final Entity ae = game.getEntity(paa.getEntityId());        // PLEASE NOTE: buildings are *never* the target of a "push".        final Entity te = game.getEntity(paa.getTargetId());        // get roll and ToHitData from the PhysicalResult        int roll = pr.roll;        final ToHitData toHit = pr.toHit;                // was this push resolved earlier?        if (pr.pushBackResolved) {        	return;        }                if (lastEntityId != paa.getEntityId()) {            phaseReport.append("\nPhysical attacks for " ).append( ae.getDisplayName() ).append( "\n");        }        phaseReport.append("    Pushing " ).append( te.getDisplayName());//        // should we even bother?//        if (te.isDestroyed() || te.isDoomed() || te.crew.isDead()) {//            phaseReport.append(" but the target is already destroyed!\n");//            return;//        }        if (toHit.getValue() == ToHitData.IMPOSSIBLE) {            phaseReport.append(", but the push is impossible (" ).append( toHit.getDesc() ).append( ")\n");            return;        }        phaseReport.append("; needs " ).append( toHit.getValue() ).append( ", ");        // report the roll        phaseReport.append("rolls " ).append( roll ).append( " : ");        // check if our target has a push against us, too, and get it        PhysicalResult targetPushResult = null;        for (Enumeration i = physicalResults.elements(); i.hasMoreElements();) {            PhysicalResult tpr = (PhysicalResult)i.nextElement();            if (tpr.aaa.getEntityId() == te.getId() &&                tpr.aaa instanceof PushAttackAction &&				tpr.aaa.getTargetId() == ae.getId() ) {            	targetPushResult = tpr;            }        }        // if our target has a push against us, we need to resolve both now        if (targetPushResult != null) {        	// do both hit?        	if (targetPushResult.roll >= targetPushResult.toHit.getValue() &&        		roll >= toHit.getValue()) {        		phaseReport.append("succeeds: but ")				           .append(te.getDisplayName())						   .append("  pushed back!.\n")        		           .append("\nPhysical attacks for " )				           .append( te.getDisplayName() ).append( "\n")        		           .append("    Pushing " ).append( ae.getDisplayName())                           .append("; needs " ).append( toHit.getValue() )						   .append( ", ")						   .append("rolls " ).append( roll ).append( " : ")                           .append("succeeds: but ")                           .append(ae.getDisplayName())                           .append("  pushed back!.\n");        		PilotingRollData targetPushPRD = new PilotingRollData(te.getId(), getKickPushPSRMod(ae, te, 0), "was pushed");                targetPushPRD.setCumulative(false); // see Bug# 811987 for more info                PilotingRollData pushPRD = new PilotingRollData(ae.getId(), getKickPushPSRMod(ae, te, 0), "was pushed");                pushPRD.setCumulative(false); // see Bug# 811987 for more info                game.addPSR(pushPRD);                game.addPSR(targetPushPRD);                targetPushResult.pushBackResolved = true;                return;        	}        }                      // do we hit?        if (roll < toHit.getValue()) {            phaseReport.append("misses.\n");            return;        }        // we hit...        int direction = ae.getFacing();        Coords src = te.getPosition();        Coords dest = src.translated(direction);        PilotingRollData pushPRD = new PilotingRollData(te.getId(), getKickPushPSRMod(ae, te, 0), "was pushed");        pushPRD.setCumulative(false); // see Bug# 811987 for more info        if (Compute.isValidDisplacement(game, te.getId(), te.getPosition(), direction)) {            phaseReport.append("succeeds: target is pushed into hex "            ).append( dest.getBoardNum()            ).append( "\n");            doEntityDisplacement(te, src, dest, pushPRD);            // if push actually moved the target, attacker follows thru            if (!te.getPosition().equals(src)) {                ae.setPosition(src);            }        } else {            if (game.getOptions().booleanOption("push_off_board") && !game.board.contains(dest)) {                game.removeEntity(te.getId(),                                  Entity.REMOVE_PUSHED);                send(createRemoveEntityPacket(te.getId(),                                              Entity.REMOVE_PUSHED));                phaseReport.append("\n*** " ).append( te.getDisplayName() ).append( " has been forced from the field. ***\n");                // TODO: remove passengers and swarmers.                ae.setPosition(src);            } else {                phaseReport.append("succeeds, but target can't be moved.\n");                game.addPSR(pushPRD);            }        }        phaseReport.append("\n");    }