RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
DinhsBulwark.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.Collections;
15import java.util.LinkedList;
16import java.util.List;
17
43
44public class DinhsBulwark extends PlayerMeleeStrategy {
45 private static final Graphic GRAPHIC = new Graphic(1336, UpdatePriority.HIGH);
46 private static final Animation ANIMATION = new Animation(7511, UpdatePriority.HIGH);
47 private static final DinhsBulwark INSTANCE = new DinhsBulwark();
48
49 private DinhsBulwark() { }
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, 10, 11, other -> hitEvent(attacker, defender, other, extra));
58
59 if (!defender.isPlayer() || !PlayerRight.isIronman(attacker)) {
60 Collections.addAll(extra, hits);
61 addCombatExperience(attacker, extra.toArray(new Hit[extra.size()]));
62 }
63
64 attacker.graphic(GRAPHIC);
65 attacker.animate(ANIMATION, true);
66 }
67
68 @Override
69 public int modifyAccuracy(Player attacker, Mob defender, int roll) {
70 return roll * 6 / 5;
71 }
72
73 private void hitEvent(Player attacker, Mob defender, Mob other, List<Hit> extra) {
74 if (!CombatUtil.canBasicAttack(attacker, other)) {
75 return;
76 }
77
78 if (attacker.equals(other) || defender.equals(other)) {
79 return;
80 }
81
82 CombatHit hit = nextMeleeHit(attacker, defender);
83 attacker.getCombat().submitHits(other, hit);
84 if (extra != null) extra.add(hit);
85 }
86
87 public static DinhsBulwark get() {
88 return INSTANCE;
89 }
90
91}
static void areaAction(Mob mob, Consumer< Mob > action)