diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index f1905d25a..bc29891ed 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -58,11 +58,16 @@ public class DamageManager extends MiniPlugin public boolean UseSimpleWeaponDamage = false; public boolean DisableDamageChanges = false; + /** + * The value of knockback that is applied when a player is attacked. + * If 0, the value is calculated from log10(damage). + */ + private double _constantKnockback; private boolean _enabled = true; - private final HashMap _protectionTypeModifiers = new HashMap(); - private final HashMap _protectionCauses = new HashMap(); + private final HashMap _protectionTypeModifiers = new HashMap<>(); + private final HashMap _protectionCauses = new HashMap<>(); public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager, DisguiseManager disguiseManager, ConditionManager conditionManager) { @@ -530,13 +535,18 @@ public class DamageManager extends MiniPlugin if (event.IsKnockback() && (event.getKnockbackOrigin() != null || event.GetDamagerEntity(true) != null)) { //Base - double knockback = event.GetDamage(); - if (knockback < 2) knockback = 2; - knockback = Math.log10(knockback); + double knockback = _constantKnockback; + + if (_constantKnockback == 0) + { + knockback = Math.log10(Math.max(event.GetDamage(), 2)); + } //Mults for (double cur : event.GetKnockback().values()) - knockback = knockback * cur; + { + knockback *= cur; + } //Origin Location origin = null; @@ -836,6 +846,24 @@ public class DamageManager extends MiniPlugin _enabled = var; } + /** + * Sets the value of {@link #_constantKnockback}. + **/ + public void setConstantKnockback(double constantKnockback) + { + _constantKnockback = constantKnockback; + } + + /** + * Resets the configuration of damage manager and ensures it is enabled. + */ + public void resetConfiguration() + { + DisableDamageChanges = false; + _constantKnockback = 0; + SetEnabled(true); + } + public CombatManager GetCombatManager() { return _combatManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/CakeWars.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/CakeWars.java index 9c10ace6e..bef729185 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/CakeWars.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/cakewars/CakeWars.java @@ -91,6 +91,10 @@ public class CakeWars extends TeamGame "All players standing on the Resource Generator get the items generated." }; private static final int RESPAWN_TIME = 6; + /** + * This value is the base value of knockback for Cake Wars. it is derived from log10(7). + */ + private static final double GAME_KNOCKBACK = 0.845; private static final LeaderboardManager LEADERBOARD_MANAGER = Managers.get(LeaderboardManager.class); private final Map _averages; @@ -162,7 +166,7 @@ public class CakeWars extends TeamGame new ChatStatData("EatWholeCake", "Whole Cakes", true) ); - manager.GetDamage().SetEnabled(false); + manager.GetDamage().setConstantKnockback(GAME_KNOCKBACK); manager.GetCreature().SetDisableCustomDrops(true); new AbsorptionFix(this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index 58048fb34..bf344df69 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -155,17 +155,14 @@ public class GameCreationManager implements Listener private void CreateGame(GameType gameType) { //Reset Changes - Manager.GetDamage().DisableDamageChanges = false; Manager.GetCreature().SetDisableCustomDrops(false); - Manager.GetDamage().SetEnabled(true); + Manager.GetDamage().resetConfiguration(); Manager.GetExplosion().resetConfiguration(); // Manager.GetAntiStack().SetEnabled(true); Manager.getCosmeticManager().setHideParticles(false); Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.CustomWeaponName); ItemStackFactory.Instance.SetUseCustomNames(false); - HashMap pastTeams = null; - System.out.println(_nextGame == null ? "Next Game = null" : "Next Game = " + _nextGame.GetName()); System.out.println(MapPref == null ? "Map Pref = null" : "Map Pref = " + MapPref);