1package com.osroyale.game.world.entity.combat.strategy.player.custom;
3import com.osroyale.Config;
4import com.osroyale.game.Animation;
5import com.osroyale.game.UpdatePriority;
6import com.osroyale.game.world.entity.combat.CombatType;
7import com.osroyale.game.world.entity.combat.CombatUtil;
8import com.osroyale.game.world.entity.combat.attack.FightType;
9import com.osroyale.game.world.entity.combat.hit.CombatHit;
10import com.osroyale.game.world.entity.combat.hit.Hit;
11import com.osroyale.game.world.entity.combat.projectile.CombatProjectile;
12import com.osroyale.game.world.entity.combat.strategy.basic.MagicStrategy;
13import com.osroyale.game.world.entity.mob.Mob;
14import com.osroyale.game.world.entity.mob.player.Player;
15import com.osroyale.game.world.entity.skill.Skill;
17import static com.osroyale.game.world.entity.combat.CombatUtil.getHitDelay;
19public class DragonfireShieldStrategy
extends MagicStrategy<Player> {
20 private static final DragonfireShieldStrategy INSTANCE =
new DragonfireShieldStrategy();
21 private static CombatProjectile PROJECTILE;
25 PROJECTILE = CombatProjectile.getDefinition(
"Dragonfire Shield");
26 }
catch (Exception e) {
32 public CombatHit[] getHits(Player attacker, Mob defender) {
33 int hitDelay = getHitDelay(attacker, defender, CombatType.MAGIC) + 2;
34 int hitsplatDelay = 1;
35 return new CombatHit[] { CombatUtil.generateDragonfire(attacker, defender, 25, hitDelay, hitsplatDelay,
false) };
39 public boolean canAttack(Player attacker, Mob defender) {
40 if (attacker.dragonfireCharges == 0) {
41 attacker.message(
"You have no charges to do this!");
48 public void start(Player attacker, Mob defender, Hit[] hits) {
49 PROJECTILE.getAnimation().ifPresent(animation -> attacker.animate(animation,
true));
50 PROJECTILE.getStart().ifPresent(attacker::graphic);
53 for (Hit hit : hits) {
54 damage += hit.getDamage();
58 damage *= Config.COMBAT_MODIFICATION;
59 attacker.skills.addExperience(Skill.DEFENCE, damage / 2);
60 if (defender.isNpc()) {
61 attacker.skills.addExperience(Skill.HITPOINTS, damage / 3);
62 attacker.skills.addExperience(Skill.MAGIC, damage / 2);
65 attacker.interact(defender);
69 public void attack(Player attacker, Mob defender, Hit hit) {
70 PROJECTILE.sendProjectile(attacker, defender);
71 attacker.dragonfireCharges--;
75 public void hit(Player attacker, Mob defender, Hit hit) {
76 PROJECTILE.getEnd().ifPresent(defender::graphic);
81 public void hitsplat(Player attacker, Mob defender, Hit hit) {
85 public Animation getAttackAnimation(Player attacker, Mob defender) {
86 return new Animation(6696, UpdatePriority.HIGH);
90 public int getAttackDelay(Player attacker, Mob defender, FightType fightType) {
95 public int getAttackDistance(Player attacker, FightType fightType) {
100 public CombatType getCombatType() {
101 return CombatType.MAGIC;
104 public static DragonfireShieldStrategy
get() {