diff --git a/megamek/i18n/megamek/common/report-messages.properties b/megamek/i18n/megamek/common/report-messages.properties index 7b30819ee88..0a285b8d386 100755 --- a/megamek/i18n/megamek/common/report-messages.properties +++ b/megamek/i18n/megamek/common/report-messages.properties @@ -201,6 +201,7 @@ 2395= () breaks through magma crust on a 6+, rolls . 2396= () breaks through magma crust on a 4+, rolls . 2400= () falls into liquid magma, and is instantly destroyed! +2404= () takes additional damage from beginning and ending movement in a magma hex! 2405= () is damaged by the extreme heat of liquid magma! 2410= () breaks through ice from below 2415= collapes due to nuclear explosion ground zero. diff --git a/megamek/src/megamek/server/GameManager.java b/megamek/src/megamek/server/GameManager.java index d4aa8a4fc07..4cd184c740d 100644 --- a/megamek/src/megamek/server/GameManager.java +++ b/megamek/src/megamek/server/GameManager.java @@ -4921,6 +4921,7 @@ else if ((target instanceof Infantry) && (bldg != null)) { // note that this must sequentially occur before the next 'entering liquid magma' check // otherwise, magma crust won't have a chance to break ServerHelper.checkAndApplyMagmaCrust(nextHex, nextElevation, entity, curPos, false, vPhaseReport, this); + ServerHelper.checkEnteringMagma(nextHex, nextElevation, entity, this); // is the next hex a swamp? PilotingRollData rollTarget = entity.checkBogDown(step, moveType, nextHex, curPos, nextPos, @@ -5923,6 +5924,7 @@ private void processMovement(Entity entity, MovePath md, Map doEntityDisplacement(Entity entity, Coords src, } ServerHelper.checkAndApplyMagmaCrust(destHex, entity.getElevation(), entity, dest, false, vPhaseReport, this); + ServerHelper.checkEnteringMagma(destHex, entity.getElevation(), entity, this); Entity violation = Compute.stackingViolation(game, entity.getId(), dest); if (violation == null) { diff --git a/megamek/src/megamek/server/ServerHelper.java b/megamek/src/megamek/server/ServerHelper.java index 7e992098aca..693f4cc7f7e 100644 --- a/megamek/src/megamek/server/ServerHelper.java +++ b/megamek/src/megamek/server/ServerHelper.java @@ -445,12 +445,24 @@ public static void checkAndApplyMagmaCrust(Hex hex, int elevation, Entity entity hex.addTerrain(new Terrain(Terrains.MAGMA, 2)); gameManager.sendChangedHex(curPos); for (Entity en : entity.getGame().getEntitiesVector(curPos)) { - gameManager.doMagmaDamage(en, false); + if (en != entity) { + gameManager.doMagmaDamage(en, false); + } } } } } + /** + * Check for movement into magma hex and apply damage. + */ + public static void checkEnteringMagma(Hex hex, int elevation, Entity entity, GameManager gameManager) { + + if ((hex.terrainLevel(Terrains.MAGMA) == 2) && (elevation == 0) && (entity.getMovementMode() != EntityMovementMode.HOVER)) { + gameManager.doMagmaDamage(entity, false); + } + } + /** * Loops through all active entities in the game and performs mine detection */