1package com.runehive.game.world.entity.combat.strategy.player;
3import com.runehive.content.itemaction.impl.CrawsBow;
4import com.runehive.content.prestige.PrestigePerk;
5import com.runehive.game.Animation;
6import com.runehive.game.UpdatePriority;
7import com.runehive.game.world.entity.combat.CombatImpact;
8import com.runehive.game.world.entity.combat.CombatType;
9import com.runehive.game.world.entity.combat.attack.FightType;
10import com.runehive.game.world.entity.combat.effect.impl.CombatPoisonEffect;
11import com.runehive.game.world.entity.combat.hit.CombatHit;
12import com.runehive.game.world.entity.combat.hit.Hit;
13import com.runehive.game.world.entity.combat.ranged.RangedAmmunition;
14import com.runehive.game.world.entity.combat.ranged.RangedWeaponType;
15import com.runehive.game.world.entity.combat.strategy.basic.RangedStrategy;
16import com.runehive.game.world.entity.mob.Mob;
17import com.runehive.game.world.entity.mob.UpdateFlag;
18import com.runehive.game.world.entity.mob.player.Player;
19import com.runehive.game.world.entity.mob.player.PlayerRight;
20import com.runehive.game.world.items.Item;
21import com.runehive.game.world.items.containers.equipment.Equipment;
22import com.runehive.game.world.items.ground.GroundItem;
23import com.runehive.game.world.position.Area;
24import com.runehive.game.world.position.Position;
25import com.runehive.net.packet.out.SendMessage;
26import com.runehive.util.RandomUtils;
28import java.util.Collections;
29import java.util.LinkedList;
31import java.util.function.Consumer;
32import java.util.function.Predicate;
60 int bowsWithNoArrowsRequired [] = {22550, 25865, 25867, 25884, 25886, 25890, 25892, 25894, 25896, 25888};
66 attacker.
send(
new SendMessage(
"You can't use this ammunition with this weapon."));
71 attacker.
send(
new SendMessage(
"You need some ammunition to use this weapon!"));
80 attacker.
animate(animation,
true);
91 if (attacker.
getCombat().getDefender() == defender) {
96 List<Hit> extra =
new LinkedList<>();
98 Predicate<CombatImpact> filter =
effect ->
effect.canAffect(attacker, defender,
hit);
99 Consumer<CombatImpact> execute =
effect ->
effect.impact(attacker, defender,
hit, extra);
103 if (extra.isEmpty()) {
104 Collections.addAll(extra, hits);
144 int animation = attacker.
getCombat().getFightType().getAnimation();
149 animation =
weapon.getAttackAnimation(fightType).orElse(animation);
155 animation =
weapon.getAttackAnimation(fightType).orElse(animation);
168 return attacker.
getCombat().getFightType().getDelay();
180 for (
int index = 0; index < hits.length; index++) {
193 if (next ==
null)
return;
222 final int bowsWithNoArrowsRequired [] = {22550, 25865, 25867, 25884, 25886, 25890, 25892, 25894, 25896, 25888};
231 attacker.
send(
new SendMessage(
"That was the last of your ammunition!"));
static final short CRAWS_CHARGED_ID
FightType getFightType(Item item)
boolean hasOverride(int slot)
boolean hasPerk(PrestigePerk perk)
Class that models a single animation used by an entity.
The combat effect applied when a character needs to be poisoned.
static Optional< PoisonType > getPoisonType(Item item)
Gets the PoisonType for item wrapped in an optional.
A wrapper for a Hit object, adding additional variables for hit and hitsplat delays.
A Hit object holds the damage amount and hitsplat data.
boolean isValid(RangedAmmunition ammunition)
RangedWeaponType getType()
final CombatHit nextRangedHit(T attacker, Mob defender)
static void addCombatExperience(Player player, Hit... hits)
static final PlayerRangedStrategy INSTANCE
void removeAmmunition(Player attacker, Mob defender, RangedWeaponType type)
void attack(Player attacker, Mob defender, Hit hit)
void start(Player attacker, Mob defender, Hit[] hits)
CombatHit[] getHits(Player attacker, Mob defender)
int getAttackDistance(Player attacker, FightType fightType)
void hit(Player attacker, Mob defender, Hit hit)
Animation getAttackAnimation(Player attacker, Mob defender)
boolean canAttack(Player attacker, Mob defender)
int getAttackDelay(Player attacker, Mob defender, FightType fightType)
void sendStuff(Player attacker, Mob defender)
CombatType getCombatType()
final EnumSet< UpdateFlag > updateFlags
void animate(int animation)
final boolean isPlayer()
Check if an entity is a player.
This class represents a character controlled by a player.
CombatSpecial getCombatSpecial()
final Equipment equipment
boolean isSpecialActivated()
void send(OutgoingPacket encoder)
Combat< Player > getCombat()
The combat of the mob.
RangedWeaponDefinition rangedDefinition
RangedAmmunition rangedAmmo
final Overrides overrides
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
final void decrementAmount()
Decrements the amount by 1.
final int getAmount()
Gets the quantity of this item.
final Item get(int index)
Gets the Item located on index.
final Optional< Item > retrieve(int index)
Retrieves the item located on index.
final void set(Item[] toSet)
The container that manages the equipment for a player.
boolean contains(int[] bowsWithNoArrowsRequired)
static boolean hasAccumulator(Player player)
static boolean hasAttractor(Player player)
static final int WEAPON_SLOT
void refresh()
Forces a refresh of Equipment items to the EQUIPMENT_DISPLAY_ID widget.
static boolean hasAssembler(Player player)
Represents a single Ground item on the world map.
static GroundItem create(Player player, Item item)
Creates a new GroundItem object for a player and an item.
Handles checking if mobs are in a certain area.
static boolean inZulrah(Interactable entity)
static boolean inKraken(Interactable entity)
Represents a single tile on the game world.
The OutgoingPacket that sends a message to a Players chatbox in the client.
A static-util class that provides additional functionality for generating pseudo-random numbers.
static boolean success(double value)
Determines if a pseudorandomly generated double rounded to two decimal places is below or equal to va...
Handles the perk rewards from prestiging.
Represents different priorities for updating.
The enumerated type whose elements represent the fighting types.
final int getAnimation()
Gets the animation executed when this type is active.
int getDistance()
Gets the attack distance.
void sendProjectile(Mob attacker, Mob defender)
Optional< Animation > getAnimation(int id)
Optional< Graphic > getEnd(int id)
Optional< CombatImpact > getEffect(int id)
Optional< Graphic > getStart(int id)
void drain(Player player)
Drains the special bar for player.
Holds all the player right data.
static boolean isIronman(Player player)
Checks if the player is an ironman.