59public class DarkBow
extends PlayerRangedStrategy {
60 private static final DarkBow INSTANCE =
new DarkBow();
62 private static Projectile DARKNESS_PROJECTILE_1;
63 private static Projectile DARKNESS_PROJECTILE_2;
65 private static Projectile DRAGONS_PROJECTILE_1;
66 private static Projectile DRAGONS_PROJECTILE_2;
72 setProjectiles(darkness, dragons);
73 }
catch (Exception e) {
82 protected void sendStuff(
Player attacker,
Mob defender) {
83 super.sendStuff(attacker, defender);
85 if (isDragonArrow(attacker.equipment.
get(ARROWS_SLOT))) {
86 DRAGONS_PROJECTILE_1.send(attacker, defender);
87 DRAGONS_PROJECTILE_2.send(attacker, defender);
89 DARKNESS_PROJECTILE_1.send(attacker, defender);
90 DARKNESS_PROJECTILE_2.send(attacker, defender);
95 public void hit(
Player attacker,
Mob defender,
Hit hit) {
96 if (isDragonArrow(attacker.equipment.
get(ARROWS_SLOT))) {
101 super.hit(attacker, defender, hit);
106 CombatHit first = nextRangedHit(attacker, defender);
107 CombatHit second = nextRangedHit(attacker, defender);
108 int minimum = isDragonArrow(attacker.equipment.
get(ARROWS_SLOT)) ? 8 : 5;
112 first.setAccurate(
true);
117 second.setAccurate(
true);
120 return new CombatHit[] { first, second };
124 public int modifyDamage(
Player attacker,
Mob defender,
int roll) {
125 if (isDragonArrow(attacker.equipment.
get(ARROWS_SLOT)))
127 return roll * 13 / 10;
131 public void onKill(
Player attacker,
Mob defender,
Hit hit) {
138 if (!darkness.getProjectile().isPresent())
139 throw new NullPointerException(
"No Decent of Darkness projectile found.");
141 DARKNESS_PROJECTILE_1 = darkness.getProjectile().get();
143 DARKNESS_PROJECTILE_2 = DARKNESS_PROJECTILE_1.copy();
144 DARKNESS_PROJECTILE_2.setDuration(15 + DARKNESS_PROJECTILE_2.getDuration());
145 DARKNESS_PROJECTILE_2.setCurve(32);
147 if (!dragons.getProjectile().isPresent())
148 throw new NullPointerException(
"No Decent of Dragons projectile found.");
150 DRAGONS_PROJECTILE_1 = dragons.getProjectile().get().copy();
152 DRAGONS_PROJECTILE_2 = DRAGONS_PROJECTILE_1.copy();
153 DRAGONS_PROJECTILE_2.setDuration(15 + DRAGONS_PROJECTILE_1.getDuration());
154 DRAGONS_PROJECTILE_2.setCurve(32);
157 private static boolean isDragonArrow(Item item) {
159 int id = item.getId();
160 return id == 11212 ||
id == 11227 ||
id == 11228 ||
id == 11229;
165 public static DarkBow
get() {
static void activate(Player player, AchievementKey achievement)