fix ruby bolt (e) damage calculation and general bolt audio

This commit is contained in:
Ryan
2022-01-23 11:09:47 +00:00
parent 8e66fad298
commit 482cf71a94
@@ -111,17 +111,16 @@ public enum BoltEffect {
super.impact(state); 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 @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 victimPoints = (int) (state.getVictim().getSkills().getLifepoints() * 0.20);
int playerPoints = (int) (state.getAttacker().getSkills().getLifepoints() * 0.10); int playerPoints = (int) (state.getAttacker().getSkills().getLifepoints() * 0.10);
int total = state.getEstimatedHit() + victimPoints; if (victimPoints >= 100 && state.getVictim().getId() == NPCs.CORPOREAL_BEAST_8133) {
if (total >= 100 && state.getVictim().getId() == NPCs.CORPOREAL_BEAST_8133) { victimPoints = 100;
total = 100;
} }
state.setEstimatedHit(total); state.setEstimatedHit(victimPoints);
state.getAttacker().getImpactHandler().manualHit(state.getVictim(), playerPoints, HitsplatType.NORMAL); state.getAttacker().getImpactHandler().manualHit(state.getVictim(), playerPoints, HitsplatType.NORMAL);
super.impact(state); super.impact(state);
} }
@@ -138,7 +137,7 @@ public enum BoltEffect {
DIAMOND(9243, new Graphics(758), new Audio(2913)) { DIAMOND(9243, new Graphics(758), new Audio(2913)) {
@Override @Override
public void impact(BattleState state) { 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); super.impact(state);
} }
}, },
@@ -233,12 +232,17 @@ public enum BoltEffect {
* Handles the impact. * Handles the impact.
* @param state the battle state. * @param state the battle state.
*/ */
@SuppressWarnings("unused")
public void impact(BattleState state) { public void impact(BattleState state) {
Entity victim = state.getVictim(); Entity victim = state.getVictim();
if (sound != null && victim instanceof Player) { 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); sound.send(victim.asPlayer(), true);
} }
}
if (graphics != null) { if (graphics != null) {
victim.graphics(graphics); victim.graphics(graphics);
} }