RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Dragon2h.java
1package com.osroyale.game.world.entity.combat.strategy.player.special.melee;
2
3import com.osroyale.game.Animation;
4import com.osroyale.game.Graphic;
5import com.osroyale.game.UpdatePriority;
6import com.osroyale.game.world.entity.combat.CombatUtil;
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.player.PlayerMeleeStrategy;
10import com.osroyale.game.world.entity.mob.Mob;
11import com.osroyale.game.world.entity.mob.player.Player;
12import com.osroyale.game.world.entity.mob.player.PlayerRight;
13
14import java.util.Arrays;
15import java.util.LinkedList;
16import java.util.List;
17
43
44public class Dragon2h extends PlayerMeleeStrategy {
45 private static final Animation ANIMATION = new Animation(3157, UpdatePriority.HIGH);
46 private static final Graphic GRAPHIC = new Graphic(559, UpdatePriority.HIGH);
47 private static final Dragon2h INSTANCE = new Dragon2h();
48
49 private Dragon2h() { }
50
51 @Override
52 public void start(Player attacker, Mob defender, Hit[] hits) {
53 attacker.getCombatSpecial().drain(attacker);
54 attacker.animate(getAttackAnimation(attacker, defender), true);
55
56 List<Hit> extra = new LinkedList<>();
57 CombatUtil.areaAction(attacker, 11, 1, other -> hitEvent(attacker, defender, other, extra));
58
59 if (!defender.isPlayer() || !PlayerRight.isIronman(attacker)) {
60 extra.addAll(Arrays.asList(hits));
61 addCombatExperience(attacker, extra.toArray(new Hit[extra.size()]));
62 }
63
64 attacker.graphic(GRAPHIC);
65 }
66
67 @Override
68 public Animation getAttackAnimation(Player attacker, Mob defender) {
69 return ANIMATION;
70 }
71
72 public static Dragon2h get() {
73 return INSTANCE;
74 }
75
76 private void hitEvent(Player attacker, Mob defender, Mob other, List<Hit> extra) {
77 if (!CombatUtil.canBasicAttack(attacker, other)) {
78 return;
79 }
80
81 if (attacker.equals(other) || defender.equals(other)) {
82 return;
83 }
84
85 CombatHit hit = nextMeleeHit(attacker, defender);
86 attacker.getCombat().submitHits(other, hit);
87 if (extra != null) extra.add(hit);
88 }
89
90}
static void areaAction(Mob mob, Consumer< Mob > action)