RuneHive-Game
Loading...
Searching...
No Matches
SaradominSword.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.combat.strategy.player.special.melee;
2
3import com.runehive.game.Animation;
4import com.runehive.game.Graphic;
5import com.runehive.game.UpdatePriority;
6import com.runehive.game.world.entity.combat.hit.CombatHit;
7import com.runehive.game.world.entity.combat.hit.Hit;
8import com.runehive.game.world.entity.combat.strategy.player.PlayerMeleeStrategy;
9import com.runehive.game.world.entity.mob.Mob;
10import com.runehive.game.world.entity.mob.player.Player;
11
12/**
13 * Handles the saradomin sword weapon special attack.
14 *
15 * @author Daniel
16 */
17public class SaradominSword extends PlayerMeleeStrategy {
18
19
20 private static final Animation ANIMATION = new Animation(1132, UpdatePriority.HIGH);
21
22 private static final Graphic OTHER_GRAPHIC = new Graphic(1196);
23 private static final Graphic GRAPHIC = new Graphic(1213);
24
25 private static final SaradominSword INSTANCE = new SaradominSword();
26
27 @Override
28 public void attack(Player attacker, Mob defender, Hit hit) {
29 super.attack(attacker, defender, hit);
30 attacker.graphic(GRAPHIC);
31 }
32
33 @Override
34 public void finishOutgoing(Player attacker, Mob defender) {
35 defender.graphic(OTHER_GRAPHIC);
36 }
37
38 @Override
39 public CombatHit[] getHits(Player attacker, Mob defender) {
40 CombatHit melee = nextMeleeHit(attacker, defender);
41 return new CombatHit[]{melee, nextMagicHit(attacker, defender, 16, 1, 0)};
42 }
43
44 @Override
45 public Animation getAttackAnimation(Player attacker, Mob defender) {
46 return ANIMATION;
47 }
48
49 @Override
50 public int modifyAccuracy(Player attacker, Mob defender, int roll) {
51 return roll * 5 / 4;
52 }
53
54 public static SaradominSword get() {
55 return INSTANCE;
56 }
57
58}
Class that models a single animation used by an entity.
Represents a single graphic that can be used by entities.
Definition Graphic.java:10
A wrapper for a Hit object, adding additional variables for hit and hitsplat delays.
A Hit object holds the damage amount and hitsplat data.
Definition Hit.java:10
final CombatHit nextMagicHit(T attacker, Mob defender)
Handles the mob class.
Definition Mob.java:66
Optional< Graphic > graphic
Definition Mob.java:91
This class represents a character controlled by a player.
Definition Player.java:125
Represents different priorities for updating.