diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e45a3d97..e0a4a2626 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ Unless otherwise specified, any version comparison below is the comparison of se - Plugins are able to create their own world generator implementation now. In previous versions a ClassCastException would be thrown when initializing the dimension. - Explosion now calculates entity exposure correctly. In previous version any non-air block will block the explosion ray. +- Explosion damage now scales with game difficulty, and a bug was fixed that cause the damage two times bigger than the correct damage. ### Removed diff --git a/api/src/main/java/org/allaymc/api/world/Explosion.java b/api/src/main/java/org/allaymc/api/world/Explosion.java index 4950f1c4f..7ab6ac483 100644 --- a/api/src/main/java/org/allaymc/api/world/Explosion.java +++ b/api/src/main/java/org/allaymc/api/world/Explosion.java @@ -213,7 +213,14 @@ public void explode(Dimension dimension, float x, float y, float z) { } affectedEntity.addMotion(MathUtils.normalizeIfNotZero(affectedEntity.getLocation().sub(explosionPos, new Vector3f())).mul(impact * (1.0f - kbResistance))); if (affectedEntity instanceof EntityDamageComponent damageComponent) { - var damage = (float) Math.floor((impact * impact + impact) * 3.5 * size * 2 + 1); + var m = switch (dimension.getWorld().getWorldData().getDifficulty()) { + case PEACEFUL -> 0.0f; + case EASY -> 3.5f; + case NORMAL -> 7.0f; + case HARD -> 10.5f; + }; + var power = size / 2.0f; + var damage = (float) Math.floor((impact * impact + impact) * m * power + 1.0f); if (entity == null) { damageComponent.attack(DamageContainer.blockExplosion(damage)); } else {