Examples of containsTerrain()


Examples of megamek.common.IHex.containsTerrain()

            if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {
                doSkillCheckInPlace(entity, rollTarget);
            }
            // jumped into water?
            int waterLevel = curHex.terrainLevel(Terrains.WATER);
            if (curHex.containsTerrain(Terrains.ICE) && (waterLevel > 0)) {
                if(!(entity instanceof Infantry)) {
                    waterLevel = 0;
                    // check for breaking ice
                    int roll = Compute.d6(1);
                    r = new Report(2122);
View Full Code Here

Examples of megamek.common.IHex.containsTerrain()

                                curPos = entity.getPosition();
                            }
                        }
                    }
                }
            } else if (!(prevStep.climbMode() && curHex.containsTerrain(Terrains.BRIDGE))) {
                rollTarget = entity.checkWaterMove(waterLevel, overallMoveType);
                if (rollTarget.getValue() != TargetRoll.CHECK_FALSE) {
                    doSkillCheckInPlace(entity, rollTarget);
                }
                if (waterLevel > 1) {
View Full Code Here

Examples of megamek.common.IHex.containsTerrain()

            for (int currentYCoord = 0; currentYCoord < height; currentYCoord++) {
                Coords currentCoords = new Coords(currentXCoord, currentYCoord);
                IHex currentHex = board.getHex(currentXCoord, currentYCoord);

                //check for fires and potentially put them out
                if (currentHex.containsTerrain(Terrains.FIRE)) {
                    //only standard fires get put out
                    if(currentHex.terrainLevel(Terrains.FIRE) == 1) {
                        if(conditions.putOutFire()) {
                            server.removeFire(currentCoords, "weather conditions");   
                        }
View Full Code Here

Examples of megamek.common.IHex.containsTerrain()

                        currentHex.addTerrain(tf.createTerrain(Terrains.FIRE,1));
                        server.sendChangedHex(currentCoords);
                    }
                }  
               
                if(ice && !currentHex.containsTerrain(Terrains.ICE)
                        && currentHex.containsTerrain(Terrains.WATER)) {
                    currentHex.addTerrain(tf.createTerrain(Terrains.ICE, 1));
                    server.sendChangedHex(currentCoords);
                }
               
View Full Code Here

Examples of megamek.common.IHex.containsTerrain()

                        server.sendChangedHex(currentCoords);
                    }
                }  
               
                if(ice && !currentHex.containsTerrain(Terrains.ICE)
                        && currentHex.containsTerrain(Terrains.WATER)) {
                    currentHex.addTerrain(tf.createTerrain(Terrains.ICE, 1));
                    server.sendChangedHex(currentCoords);
                }
               
                if(lightSnow
View Full Code Here

Examples of megamek.common.IHex.containsTerrain()

    public void createSmokeTerrain(SmokeCloud cloud){
       
        for( Coords coords : cloud.getCoordsList() ){
            IHex smokeHex = game.getBoard().getHex(coords);
            if ( smokeHex != null ){
                if ( smokeHex.containsTerrain(Terrains.SMOKE) ) {
                    if ( smokeHex.terrainLevel(Terrains.SMOKE) == 1 ) {
                        smokeHex.removeTerrain(Terrains.SMOKE);
                        smokeHex.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.SMOKE, 2));
                        server.sendChangedHex(coords);
                    }
View Full Code Here

Examples of megamek.common.IHex.containsTerrain()

        } else if (game.getBoard().getBuildingAt(pos) != null) {
            // non flying unit unloading units into a building
            // -> sit in the building at the same elevation
            unit.setElevation(elevation);
        } else if (hex.terrainLevel(Terrains.WATER) > 0) {
            if ((unit.getMovementMode() == IEntityMovementMode.HOVER) || (unit.getMovementMode() == IEntityMovementMode.WIGE) || (unit.getMovementMode() == IEntityMovementMode.HYDROFOIL) || (unit.getMovementMode() == IEntityMovementMode.NAVAL) || (unit.getMovementMode() == IEntityMovementMode.SUBMARINE) || (unit.getMovementMode() == IEntityMovementMode.INF_UMU) || hex.containsTerrain(Terrains.ICE) || isBridge) {
                // units that can float stay on the surface, or we go on the
                // bridge
                // this means elevation 0, because elevation is relative to the
                // surface
                unit.setElevation(0);
View Full Code Here

Examples of megamek.common.IHex.containsTerrain()

            // but VTOL keep altitude
            if (entity.getMovementMode() == IEntityMovementMode.VTOL) {
                nextAltitude = Math.max(nextAltitude, curAltitude);
            } else {
                // Is there a building to "catch" the unit?
                if (nextHex.containsTerrain(Terrains.BLDG_ELEV)) {
                    // unit will land on the roof, if at a higher level,
                    // otherwise it will skid through the wall onto the same
                    // floor.
                    nextAltitude = Math.min(curAltitude, nextHex.getElevation() + nextHex.terrainLevel(Terrains.BLDG_ELEV));
                }
View Full Code Here

Examples of megamek.common.IHex.containsTerrain()

                    // otherwise it will skid through the wall onto the same
                    // floor.
                    nextAltitude = Math.min(curAltitude, nextHex.getElevation() + nextHex.terrainLevel(Terrains.BLDG_ELEV));
                }
                // Is there a bridge to "catch" the unit?
                if (nextHex.containsTerrain(Terrains.BRIDGE)) {
                    // unit will land on the bridge, if at a higher level,
                    // and the bridge exits towards the current hex,
                    // otherwise the bridge has no effect
                    int exitDir = (direction + 3) % 6;
                    exitDir = 1 << exitDir;
View Full Code Here

Examples of megamek.common.IHex.containsTerrain()

                }
                if ((nextAltitude <= nextHex.surface()) && (curAltitude >= curHex.surface())) {
                    // Hovercraft can "skid" over water.
                    // all units can skid over ice.
                    if ((entity instanceof Tank) && ((entity.getMovementMode() == IEntityMovementMode.HOVER) || (entity.getMovementMode() == IEntityMovementMode.WIGE))) {
                        if (nextHex.containsTerrain(Terrains.WATER)) {
                            nextAltitude = nextHex.surface();
                        }
                    } else {
                        if (nextHex.containsTerrain(Terrains.ICE)) {
                            nextAltitude = nextHex.surface();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.