From 482cf71a94a1da5752f5d9a0eafe1487403da59a Mon Sep 17 00:00:00 2001 From: Ryan <2804894-ryannathans@users.noreply.gitlab.com> Date: Sun, 23 Jan 2022 11:09:47 +0000 Subject: [PATCH] fix ruby bolt (e) damage calculation and general bolt audio --- .../entity/combat/equipment/BoltEffect.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Server/src/main/java/core/game/node/entity/combat/equipment/BoltEffect.java b/Server/src/main/java/core/game/node/entity/combat/equipment/BoltEffect.java index f14f180c0..8e57e735f 100644 --- a/Server/src/main/java/core/game/node/entity/combat/equipment/BoltEffect.java +++ b/Server/src/main/java/core/game/node/entity/combat/equipment/BoltEffect.java @@ -111,17 +111,16 @@ public enum BoltEffect { super.impact(state); } }, - RUBY(9242, new Graphics(754), new Audio(2915)) { + RUBY(9242, new Graphics(754), new Audio(2915)) { // should be sound 2911 but it bugs out @Override - public void impact(BattleState state) { + public void impact(BattleState state) { // hit target for 20% of their HP, hit self for 10% of HP int victimPoints = (int) (state.getVictim().getSkills().getLifepoints() * 0.20); int playerPoints = (int) (state.getAttacker().getSkills().getLifepoints() * 0.10); - int total = state.getEstimatedHit() + victimPoints; - if (total >= 100 && state.getVictim().getId() == NPCs.CORPOREAL_BEAST_8133) { - total = 100; + if (victimPoints >= 100 && state.getVictim().getId() == NPCs.CORPOREAL_BEAST_8133) { + victimPoints = 100; } - state.setEstimatedHit(total); + state.setEstimatedHit(victimPoints); state.getAttacker().getImpactHandler().manualHit(state.getVictim(), playerPoints, HitsplatType.NORMAL); super.impact(state); } @@ -138,7 +137,7 @@ public enum BoltEffect { DIAMOND(9243, new Graphics(758), new Audio(2913)) { @Override public void impact(BattleState state) { - state.setEstimatedHit(state.getEstimatedHit() + RandomFunction.random(5, 14)); + state.setEstimatedHit(state.getEstimatedHit() + RandomFunction.random(5, 14)); // unauthentic, needs fixing super.impact(state); } }, @@ -233,11 +232,16 @@ public enum BoltEffect { * Handles the impact. * @param state the battle state. */ - @SuppressWarnings("unused") public void impact(BattleState state) { Entity victim = state.getVictim(); - if (sound != null && victim instanceof Player) { - sound.send(victim.asPlayer(), true); + if (sound != null) { + Entity attacker = state.getAttacker(); + if (attacker instanceof Player) { + sound.send(attacker.asPlayer(), true); + } + if (victim instanceof Player) { + sound.send(victim.asPlayer(), true); + } } if (graphics != null) { victim.graphics(graphics);