Package megamek.common

Examples of megamek.common.IHex.terrainLevel()


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

                //check for quicksand that has been around at least one turn
                if(currentHex.terrainLevel(Terrains.SWAMP) == 3) {
                    //sink any units that occupy this hex
                    Enumeration<Entity> entities = game.getEntities(currentCoords);
                    while (entities.hasMoreElements()) {
                        final Entity entity = entities.nextElement();
                        if(entity.isStuck()) {
View Full Code Here


                            server.doSinkEntity(entity);
                        }
                    }
                }
                // check for any quicksand created this turn
                else if (currentHex.terrainLevel(Terrains.SWAMP) == 2){
                    currentHex.removeTerrain(Terrains.SWAMP);
                    currentHex.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.SWAMP, 3));
                    server.sendChangedHex(currentCoords);
                }
            }
View Full Code Here

       
        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

            if (te.isProne()) {
                toHit.addModifier(-2, "target prone and adjacent");
            }

            // water partial cover?
            if ((te.height() > 0) && (te.getElevation() == -1) && (targHex.terrainLevel(Terrains.WATER) == te.height())) {
                toHit.addModifier(1, "target has partial cover");
            }
        }

        // If it has a torso-mounted cockpit and two head sensor hits or three
View Full Code Here

        // determine hit direction
        toHit.setSideTable(te.sideTable(src));

        // all charges resolved against full-body table, except vehicles
        // and charges against mechs in water partial cover
        if ((targHex.terrainLevel(Terrains.WATER) == te.height()) && (te.getElevation() == -1) && (te.height() > 0)) {
            toHit.setHitTable(ToHitData.HIT_PUNCH);
        } else if (ae.getHeight() < target.getHeight()) {
            toHit.setHitTable(ToHitData.HIT_KICK);
        } else {
            toHit.setHitTable(ToHitData.HIT_NORMAL);
View Full Code Here

            }

            IHex targHex = game.getBoard().getHex(te.getPosition());
            // water partial cover?
            if ((te.height() > 0) && (te.getElevation() == -1)
                    && (targHex.terrainLevel(Terrains.WATER) == te.height())) {
                toHit.addModifier(1, "target has partial cover");
            }

            // Pilot skills
            Compute.modifyPhysicalBTHForAdvantages(ae, te, toHit, game);
View Full Code Here

            }
        } 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
View Full Code Here

                // 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));
                }
                // 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,
View Full Code Here

                    // and the bridge exits towards the current hex,
                    // otherwise the bridge has no effect
                    int exitDir = (direction + 3) % 6;
                    exitDir = 1 << exitDir;
                    if ((nextHex.getTerrain(Terrains.BRIDGE).getExits() & exitDir) == exitDir) {
                        nextAltitude = Math.min(curAltitude, Math.max(nextAltitude, nextHex.getElevation() + nextHex.terrainLevel(Terrains.BRIDGE_ELEV)));
                    }
                }
                if ((nextAltitude <= nextHex.surface()) && (curAltitude >= curHex.surface())) {
                    // Hovercraft can "skid" over water.
                    // all units can skid over ice.
View Full Code Here

     */
    private Vector<Report> checkQuickSand(Coords c) {
        Vector<Report> vDesc = new Vector<Report>();
        Report r;
        IHex hex = game.getBoard().getHex(c);
        if(hex.terrainLevel(Terrains.SWAMP== 1) {
            if(Compute.d6(2) == 12) {
                //better find a rope
                hex.removeTerrain(Terrains.SWAMP);
                hex.addTerrain(Terrains.getTerrainFactory().createTerrain(Terrains.SWAMP,2));
                sendChangedHex(c);
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.