1package com.osroyale.game.world.entity.combat.attack.listener.npc;
3import com.osroyale.game.Animation;
4import com.osroyale.game.UpdatePriority;
5import com.osroyale.game.world.entity.combat.attack.listener.NpcCombatListenerSignature;
6import com.osroyale.game.world.entity.combat.attack.listener.SimplifiedListener;
7import com.osroyale.game.world.entity.combat.hit.CombatHit;
8import com.osroyale.game.world.entity.combat.hit.Hit;
9import com.osroyale.game.world.entity.combat.strategy.CombatStrategy;
10import com.osroyale.game.world.entity.combat.strategy.npc.NpcMagicStrategy;
11import com.osroyale.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
12import com.osroyale.game.world.entity.mob.Mob;
13import com.osroyale.game.world.entity.mob.npc.Npc;
15import static com.osroyale.game.world.entity.combat.CombatUtil.createStrategyArray;
16import static com.osroyale.game.world.entity.combat.CombatUtil.randomStrategy;
17import static com.osroyale.game.world.entity.combat.projectile.CombatProjectile.getDefinition;
53public class KetZek extends SimplifiedListener<Npc> {
55 private static MagicAttack MAGIC;
56 private static CombatStrategy<Npc>[] STRATEGIES;
60 MAGIC =
new MagicAttack();
61 STRATEGIES = createStrategyArray(NpcMeleeStrategy.get(), MAGIC);
62 }
catch (Exception e) {
68 public boolean canAttack(
Npc attacker,
Mob defender) {
69 if (!NpcMeleeStrategy.get().withinDistance(attacker, defender)) {
70 attacker.setStrategy(MAGIC);
72 return attacker.
getStrategy().canAttack(attacker, defender);
76 public void start(
Npc attacker,
Mob defender,
Hit[] hits) {
77 if (!NpcMeleeStrategy.get().withinDistance(attacker, defender)) {
78 attacker.setStrategy(MAGIC);
80 attacker.setStrategy(randomStrategy(STRATEGIES));
84 private static class MagicAttack
extends NpcMagicStrategy {
85 private MagicAttack() {
86 super(getDefinition(
"Fire Blast"));
96 CombatHit combatHit = nextMagicHit(attacker, defender, combatProjectile.getMaxHit());
97 combatHit.setAccurate(
true);
CombatStrategy< Npc > getStrategy()