1package com.osroyale.game.world.entity.combat.strategy.player.custom;
3import com.osroyale.game.Animation;
4import com.osroyale.game.Graphic;
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.strategy.basic.MeleeStrategy;
12import com.osroyale.game.world.entity.mob.Mob;
13import com.osroyale.game.world.entity.mob.player.Player;
14import com.osroyale.game.world.items.Item;
15import com.osroyale.game.world.items.containers.equipment.Equipment;
16import com.osroyale.game.world.position.Position;
18public class ScytheOfViturStrategy
extends MeleeStrategy<Player> {
20 private static final ScytheOfViturStrategy INSTANCE =
new ScytheOfViturStrategy();
22 private static final Animation ANIMATION =
new Animation(8056, UpdatePriority.HIGH);
23 private static final Graphic GRAPHIC =
new Graphic(506);
26 public boolean canAttack(Player attacker, Mob defender) {
27 Item weapon = attacker.equipment.get(Equipment.WEAPON_SLOT);
30 attacker.getCombat().reset();
38 public void start(Player attacker, Mob defender, Hit[] hits) {
39 super.start(attacker, defender, hits);
40 attacker.animate(ANIMATION,
true);
42 CombatUtil.areaAction(attacker, 3, 1, other -> hitEvent(attacker, defender, other));
47 public void attack(Player attacker, Mob defender, Hit
hit) { }
50 public Animation getAttackAnimation(Player attacker, Mob defender) {
55 public CombatType getCombatType() {
56 return CombatType.MELEE;
60 public int getAttackDistance(Player attacker, FightType fightType) {
65 public CombatHit[] getHits(Player attacker, Mob defender) {
66 return new CombatHit[]{ nextMeleeHit(attacker, defender) };
70 public int getAttackDelay(Player attacker, Mob defender, FightType fightType) {
71 return attacker.getCombat().getFightType().getDelay();
74 public static ScytheOfViturStrategy
get() {
78 private void hitEvent(Player attacker, Mob defender, Mob other) {
79 if (!CombatUtil.canBasicAttack(attacker, other)) {
83 if (attacker.equals(other) || defender.equals(other)) {
87 if(!Position.isWithinDiagonalDistance(attacker, other, 1) || defender.getPosition().equals(other.getPosition())) {
91 CombatHit
hit = nextMeleeHit(attacker, other);
93 other.getCombat().attack(attacker);
void hit(T attacker, Mob defender, Hit hit)