RuneHive-Game
Loading...
Searching...
No Matches
KrilTsutsaroth.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.combat.attack.listener.npc;
2
3import com.runehive.game.world.entity.combat.CombatType;
4import com.runehive.game.world.entity.combat.attack.listener.NpcCombatListenerSignature;
5import com.runehive.game.world.entity.combat.attack.listener.SimplifiedListener;
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.CombatStrategy;
9import com.runehive.game.world.entity.combat.strategy.npc.NpcMagicStrategy;
10import com.runehive.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
11import com.runehive.game.world.entity.mob.Mob;
12import com.runehive.game.world.entity.mob.npc.Npc;
13import com.runehive.util.Utility;
14
15import static com.runehive.game.world.entity.combat.CombatUtil.createStrategyArray;
16import static com.runehive.game.world.entity.combat.CombatUtil.randomStrategy;
17import static com.runehive.game.world.entity.combat.projectile.CombatProjectile.getDefinition;
18
19/** @author Daniel */
20@NpcCombatListenerSignature(npcs = {3129})
23 private static final String[] SHOUTS = { "Attack them, you dogs!", "Attack!", "YARRRRRRRR!", "Rend them limb from limb!", "Forward!", "No retreat!", };
24
25
26 static {
27 try {
28 STRATEGIES = createStrategyArray(NpcMeleeStrategy.get(), new MagicAttack());
29 } catch (Exception e) {
30 e.printStackTrace();
31 }
32 }
33
34 @Override
35 public void start(Npc attacker, Mob defender, Hit[] hits) {
36 attacker.setStrategy(randomStrategy(STRATEGIES));
37 if (Utility.random(3) == 0) {
39 }
40 }
41
42 @Override
43 public void block(Mob attacker, Npc defender, Hit hit, CombatType combatType) {
44 attacker.getStrategy().block(attacker, defender, hit, combatType);
45 defender.getCombat().attack(attacker);
46 }
47
48 private static class MagicAttack extends NpcMagicStrategy {
49 public MagicAttack() {
50 super(getDefinition("Kril Tsutsaroth"));
51 }
52
53 @Override
54 public CombatHit[] getHits(Npc attacker, Mob defender) {
55 CombatHit hit = nextMagicHit(attacker, defender, 30);
56 hit.setAccurate(true);
57 return new CombatHit[]{hit};
58 }
59 }
60}
void block(Mob attacker, Npc defender, Hit hit, CombatType combatType)
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
abstract< T extends Mob > CombatStrategy<? super T > getStrategy()
The combat strategy of the mob.
void speak(String forceChat)
Sets the mob's forced chat.
Definition Mob.java:127
Represents a non-player character in the in-game world.
Definition Npc.java:29
void setStrategy(CombatStrategy< Npc > strategy)
Definition Npc.java:212
Combat< Npc > getCombat()
The combat of the mob.
Definition Npc.java:156
Handles miscellaneous methods.
Definition Utility.java:27
static int random(int bound)
Definition Utility.java:239
static< T > T randomElement(Collection< T > collection)
Picks a random element out of any array type.
Definition Utility.java:248