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

View file

@ -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);