if (game.getOptions().booleanOption("inf_and_protos_move_multi") && (entityUsed instanceof Infantry || entityUsed instanceof Protomech) && !(game.getTurn() instanceof GameTurn.OnlyInfantryAndProtomechTurn)) { int playerId = game.getTurn().getPlayerNum(); int remaining = game.infantryAndProtomechsLeft(playerId); int moreInfAndProtoTurns = Math.min(Game.INF_AND_PROTOS_MOVE_MULTI - 1, remaining);
GameTurn turn = game.getTurn(); final int playerId = (null == entityUsed) ? Player.PLAYER_NONE : entityUsed.getOwnerId(); boolean infMoved = entityUsed instanceof Infantry; boolean infMoveMulti = game.getOptions().booleanOption("inf_move_multi"); boolean protosMoved = entityUsed instanceof Protomech; boolean protosMoveMulti = game.getOptions().booleanOption("protos_move_multi");    int multiMask = 0; if ( infMoveMulti ) { multiMask += GameTurn.CLASS_INFANTRY; } if ( protosMoveMulti ) { multiMask += GameTurn.CLASS_PROTOMECH; }    else if ( protosMoved && game.getPhase() == Game.PHASE_FIRING ) { multiMask = 0; }   boolean isGeneralMoveTurn = ( !(turn instanceof GameTurn.SpecificEntityTurn) && !(turn instanceof GameTurn.UnitNumberTurn) && !(turn instanceof GameTurn.UnloadStrandedTurn) && ( !(turn instanceof GameTurn.EntityClassTurn) || ( (turn instanceof GameTurn.EntityClassTurn) && ( (GameTurn.EntityClassTurn) turn ).isValidClass(~multiMask) ) ) );    if ( protosMoved && !protosMoveMulti && isGeneralMoveTurn && game.getPhase() == Game.PHASE_FIRING ) {   final char movingUnit = entityUsed.getUnitNumber(); final int movingId = entityUsed.getId();   int protoTurns = game.getSelectedEntityCount ( new EntitySelector() { private final int ownerId = playerId; private final int entityId = movingId; private final char unitNum = movingUnit; public boolean accept( Entity entity ) { if ( entity instanceof Protomech && entity.isSelectableThisTurn(Server.this.game) && ownerId == entity.getOwnerId() && entityId != entity.getId() && unitNum == entity.getUnitNumber() ) return true; return false; } } );   for (int i = 0; i < protoTurns; i++) { GameTurn newTurn = new GameTurn.UnitNumberTurn ( playerId, movingUnit ); game.insertNextTurn(newTurn); turnsChanged = true; } }   else if ( ( (infMoved && infMoveMulti) || (protosMoved && protosMoveMulti) ) && isGeneralMoveTurn ) { int remaining = 0;   if ( infMoveMulti ) { remaining += game.getInfantryLeft(playerId); } if ( protosMoveMulti ) { remaining += game.getProtomechsLeft(playerId); } int moreInfAndProtoTurns = Math.min(Game.INF_AND_PROTOS_MOVE_MULTI - 1, remaining);
    private void endCurrentTurn(Entity entityUsed) {        // enforce "inf_and_protos_move_multi" option        boolean turnsChanged = false;        if (game.getOptions().booleanOption("inf_and_protos_move_multi") &&            (entityUsed instanceof Infantry || entityUsed instanceof Protomech)            && !(game.getTurn() instanceof GameTurn.OnlyInfantryAndProtomechTurn)) {            int playerId = game.getTurn().getPlayerNum();            int remaining = game.infantryAndProtomechsLeft(playerId);            int moreInfAndProtoTurns = Math.min(Game.INF_AND_PROTOS_MOVE_MULTI - 1, remaining);            for (int i = 0; i < moreInfAndProtoTurns; i++) {                GameTurn newTurn = new GameTurn.OnlyInfantryAndProtomechTurn(playerId);                game.insertNextTurn(newTurn);                turnsChanged = true;            }        }        // brief everybody on the turn update, if they changed        if (turnsChanged) {            send(createTurnVectorPacket());        }        // move along        changeToNextTurn();    }