53public class KingBlackDragonStrategy
extends MultiStrategy {
54 private static final StabMelee STAB =
new StabMelee();
55 private static final CrushMelee CRUSH =
new CrushMelee();
56 private static final Dragonfire DRAGONFIRE =
new Dragonfire();
57 private static final Poison POISON =
new Poison();
58 private static final Freeze FREEZE =
new Freeze();
59 private static final Shock SHOCK =
new Shock();
61 private static final CombatStrategy<Npc>[] FULL_STRATEGIES = createStrategyArray(CRUSH, STAB, DRAGONFIRE, POISON, FREEZE, SHOCK);
62 private static final CombatStrategy<Npc>[] NON_MELEE = createStrategyArray(DRAGONFIRE, POISON, FREEZE, SHOCK);
64 public KingBlackDragonStrategy() {
65 currentStrategy = randomStrategy(NON_MELEE);
69 public boolean withinDistance(
Npc attacker,
Mob defender) {
70 if (!currentStrategy.withinDistance(attacker, defender)) {
71 currentStrategy = randomStrategy(NON_MELEE);
73 return currentStrategy.withinDistance(attacker, defender);
77 public boolean canAttack(
Npc attacker,
Mob defender) {
78 if (!currentStrategy.canAttack(attacker, defender)) {
79 currentStrategy = randomStrategy(NON_MELEE);
81 return currentStrategy.canAttack(attacker, defender);
86 currentStrategy.block(attacker, defender, hit, combatType);
91 public void finishOutgoing(
Npc attacker,
Mob defender) {
92 currentStrategy.finishOutgoing(attacker, defender);
93 if (STAB.withinDistance(attacker, defender)) {
94 currentStrategy = randomStrategy(FULL_STRATEGIES);
96 currentStrategy = randomStrategy(NON_MELEE);
101 public int getAttackDelay(
Npc attacker,
Mob defender,
FightType fightType) {
105 private static final class CrushMelee
extends NpcMeleeStrategy {
109 public int getAttackDistance(
Npc attacker,
FightType fightType) {
120 return new CombatHit[]{nextMeleeHit(attacker, defender)};
124 private static final class StabMelee
extends NpcMeleeStrategy {
128 public int getAttackDistance(
Npc attacker,
FightType fightType) {
139 return new CombatHit[]{nextMeleeHit(attacker, defender)};
146 super(getDefinition(
"KBD fire"));
150 public int getAttackDistance(
Npc attacker,
FightType fightType) {
163 super(getDefinition(
"KBD freeze"));
167 public int getAttackDistance(
Npc attacker,
FightType fightType) {
180 super(getDefinition(
"KBD shock"));
184 public int getAttackDistance(
Npc attacker,
FightType fightType) {
197 super(getDefinition(
"KBD poison"));
201 public int getAttackDistance(
Npc attacker,
FightType fightType) {