RuneHive-Game
Loading...
Searching...
No Matches
DagannothRex.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.combat.strategy.npc.boss.dagannoths;
2
3import com.runehive.game.Animation;
4import com.runehive.game.UpdatePriority;
5import com.runehive.game.world.entity.combat.attack.FightType;
6import com.runehive.game.world.entity.combat.hit.CombatHit;
7import com.runehive.game.world.entity.combat.strategy.CombatStrategy;
8import com.runehive.game.world.entity.combat.strategy.npc.MultiStrategy;
9import com.runehive.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
10import com.runehive.game.world.entity.mob.Mob;
11import com.runehive.game.world.entity.mob.npc.Npc;
12
13import static com.runehive.game.world.entity.combat.CombatUtil.createStrategyArray;
14import static com.runehive.game.world.entity.combat.CombatUtil.randomStrategy;
15
16/** @author Michael | Chex */
17public class DagannothRex extends MultiStrategy {
18 private static final CrushMelee CRUSH = new CrushMelee();
19 private static final SlashMelee SLASH = new SlashMelee();
20
21 private static final CombatStrategy<Npc>[] STRATEGIES = createStrategyArray(CRUSH, SLASH);
22
23 public DagannothRex() {
24 currentStrategy = randomStrategy(STRATEGIES);
25 }
26
27 @Override
28 public int getAttackDelay(Npc attacker, Mob defender, FightType fightType) {
29 return attacker.definition.getAttackDelay();
30 }
31
32 private static final class CrushMelee extends NpcMeleeStrategy {
33 private static final Animation ANIMATION = new Animation(2853, UpdatePriority.HIGH);
34
35 @Override
36 public void finishOutgoing(Npc attacker, Mob defender) {
37 attacker.getCombat().setFightType(FightType.SCYTHE_JAB);
38 }
39
40 @Override
41 public int getAttackDistance(Npc attacker, FightType fightType) {
42 return 1;
43 }
44
45 @Override
46 public Animation getAttackAnimation(Npc attacker, Mob defender) {
47 return ANIMATION;
48 }
49
50 @Override
51 public CombatHit[] getHits(Npc attacker, Mob defender) {
52 return new CombatHit[]{nextMeleeHit(attacker, defender)};
53 }
54 }
55
56 private static final class SlashMelee extends NpcMeleeStrategy {
57 private static final Animation ANIMATION = new Animation(2851, UpdatePriority.HIGH);
58
59 @Override
60 public void finishOutgoing(Npc attacker, Mob defender) {
61 attacker.getCombat().setFightType(FightType.SCYTHE_REAP);
62 }
63
64 @Override
65 public int getAttackDistance(Npc attacker, FightType fightType) {
66 return 1;
67 }
68
69 @Override
70 public Animation getAttackAnimation(Npc attacker, Mob defender) {
71 return ANIMATION;
72 }
73
74 @Override
75 public CombatHit[] getHits(Npc attacker, Mob defender) {
76 return new CombatHit[]{nextMeleeHit(attacker, defender)};
77 }
78 }
79
80}
Class that models a single animation used by an entity.
A wrapper for a Hit object, adding additional variables for hit and hitsplat delays.
int getAttackDelay(Npc attacker, Mob defender, FightType fightType)
Handles the mob class.
Definition Mob.java:66
Represents a non-player character in the in-game world.
Definition Npc.java:29
Combat< Npc > getCombat()
The combat of the mob.
Definition Npc.java:156
Represents different priorities for updating.
The enumerated type whose elements represent the fighting types.