1package com.runehive.game.world.entity.combat.strategy.npc.boss;
3import com.runehive.game.Animation;
4import com.runehive.game.Graphic;
5import com.runehive.game.Projectile;
6import com.runehive.game.UpdatePriority;
7import com.runehive.game.task.TickableTask;
8import com.runehive.game.world.World;
9import com.runehive.game.world.entity.combat.Combat;
10import com.runehive.game.world.entity.combat.CombatType;
11import com.runehive.game.world.entity.combat.CombatUtil;
12import com.runehive.game.world.entity.combat.attack.FightType;
13import com.runehive.game.world.entity.combat.hit.CombatHit;
14import com.runehive.game.world.entity.combat.hit.Hit;
15import com.runehive.game.world.entity.combat.hit.Hitsplat;
16import com.runehive.game.world.entity.combat.projectile.CombatProjectile;
17import com.runehive.game.world.entity.combat.strategy.CombatStrategy;
18import com.runehive.game.world.entity.combat.strategy.npc.MultiStrategy;
19import com.runehive.game.world.entity.combat.strategy.npc.NpcMagicStrategy;
20import com.runehive.game.world.entity.combat.strategy.npc.NpcMeleeStrategy;
21import com.runehive.game.world.entity.combat.strategy.npc.NpcRangedStrategy;
22import com.runehive.game.world.entity.combat.strategy.npc.impl.DragonfireStrategy;
23import com.runehive.game.world.entity.mob.Mob;
24import com.runehive.game.world.entity.mob.data.LockType;
25import com.runehive.game.world.entity.mob.npc.Npc;
26import com.runehive.game.world.object.CustomGameObject;
27import com.runehive.game.world.pathfinding.TraversalMap;
28import com.runehive.game.world.position.Area;
29import com.runehive.game.world.position.Position;
30import com.runehive.net.packet.out.SendWidget;
31import com.runehive.util.RandomUtils;
32import com.runehive.util.Utility;
34import java.util.Collections;
35import java.util.Deque;
36import java.util.LinkedList;
39import static com.runehive.game.world.entity.combat.CombatUtil.createStrategyArray;
63 private final Deque<CombatStrategy<Npc>>
strategyQueue =
new LinkedList<>();
73 for (
int index = 0; index < 6; index++) {
112 Collections.shuffle(boundaries);
121 for (
int index = 0; index < 40; index++) {
137 private boolean possible() {
138 return attacker !=
null
141 && !defender.inTeleport
147 protected void onCancel(
boolean logout) {
148 super.onCancel(logout);
150 if (!logout && attacker !=
null) {
153 combat.clearDamageQueue();
159 protected void tick() {
181 combat.clearDamageQueue();
201 protected void tick() {
205 }
else if (tick == 13) {
278 attacker.blockInteract =
true;
285 attacker.blockInteract =
false;
288 public void appendDeath() {
294 zombie.instance = defender.
instance;
296 zombie.
walkTo(defender, () -> {
357 super.hit(attacker, defender,
hit);
358 if (
hit.isAccurate()) {
383 super.hitsplat(attacker, defender,
hit);
417 super.start(attacker, defender, hits);
428 super.hitsplat(attacker, defender,
hit);
430 hit.setAccurate(
false);
433 hit.setAccurate(
true);
436 hit.modifyDamage(damage -> damage / 2);
437 hit.setAccurate(
true);
Class that models a single animation used by an entity.
Represents a single graphic that can be used by entities.
Represents the game world.
static void schedule(Task task)
Submits a new event.
static void sendGraphic(Graphic graphic, Position position, int instance)
Sends a graphic to the world.
A collection of util methods and constants related to combat.
static int getHitDelay(final Mob attacker, final Mob defender, final CombatType type)
Gets the hit delay for the specified type.
static CombatHit generateDragonfire(Mob attacker, Mob defender, int max, boolean prayer)
A wrapper for a Hit object, adding additional variables for hit and hitsplat delays.
A Hit object holds the damage amount and hitsplat data.
void setAccurate(boolean accurate)
void setDamage(int damage)
Sets the hit damage.
void setHitsplat(Hitsplat hitsplat)
static CombatProjectile getDefinition(String name)
final CombatHit nextRangedHit(T attacker, Mob defender)
final CombatHit nextMagicHit(T attacker, Mob defender)
void hit(Npc attacker, Mob defender, Hit hit)
CombatStrategy< Npc > currentStrategy
NpcMagicStrategy(CombatProjectile combatProjectile)
static NpcMeleeStrategy get()
NpcRangedStrategy(CombatProjectile combatProjectile)
Animation getAttackAnimation(Npc attacker, Mob defender)
CombatHit[] getHits(Npc attacker, Mob defender)
int getAttackDistance(Npc attacker, FightType fightType)
int getAttackDistance(Npc attacker, FightType fightType)
void hit(Npc attacker, Mob defender, Hit hit)
final Projectile PROJECTILE
void start(Npc attacker, Mob defender, Hit[] hits)
void attack(Npc attacker, Mob defender, Hit hit)
CombatHit[] getHits(Npc attacker, Mob defender)
Animation getAttackAnimation(Npc attacker, Mob defender)
final Projectile PROJECTILE
Animation getAttackAnimation(Npc attacker, Mob defender)
int getAttackDelay(Npc attacker, Mob defender, FightType fightType)
void hit(Npc attacker, Mob defender, Hit hit)
CombatHit[] getHits(Npc attacker, Mob defender)
Animation getAttackAnimation(Npc attacker, Mob defender)
CombatHit[] getHits(Npc attacker, Mob defender)
void hitsplat(Npc attacker, Mob defender, Hit hit)
Animation getAttackAnimation(Npc attacker, Mob defender)
CombatHit[] getHits(Npc attacker, Mob defender)
int getAttackDistance(Npc attacker, FightType fightType)
Animation getAttackAnimation(Npc attacker, Mob defender)
CombatHit[] getHits(Npc attacker, Mob defender)
int getAttackDistance(Npc attacker, FightType fightType)
void hit(Npc attacker, Mob defender, Hit hit)
CombatHit[] getHits(Npc attacker, Mob defender)
Animation getAttackAnimation(Npc attacker, Mob defender)
TickableTask AcidTask(Mob defender, Position position)
int getAttackDelay(Npc attacker, Mob defender, FightType fightType)
CombatHit[] getHits(Npc attacker, Mob defender)
void start(Npc attacker, Mob defender, Hit[] hits)
TickableTask dragonFireTickableTask(Mob attacker, Mob defender, Projectile projectile)
static final DragonfireStrategy VENOM_DRAGONFIRE
boolean withinDistance(Npc attacker, Mob defender)
void init(Npc attacker, Mob defender)
static final VenomSpecial VENOM_SPECIAL
static final RangedAttack RANGED
static final FireballAttack FIREBALL
static final DragonfireStrategy PINK_DRAGONFIRE
final Deque< CombatStrategy< Npc > > strategyQueue
static final DragonfireStrategy DRAGONFIRE
static final CombatStrategy< Npc >[] FULL_STRATEGIES
static final FrozenSpecial FROZEN_SPECIAL
static final NpcMeleeStrategy MELEE
final CombatStrategy< Npc >[] SPECIALS
static final MagicAttack MAGIC
boolean canAttack(Npc attacker, Mob defender)
static final CombatStrategy< Npc >[] NON_MELEE
DragonfireStrategy(CombatProjectile projectileDefinition)
void unlock()
Unlocks the mob.
boolean locked()
Checks if the mob is locked.
void writeDamage(Hit hit)
abstract Combat<? extends Mob > getCombat()
The combat of the mob.
void animate(int animation)
void face(GameObject object)
Sets the client update flag to face a certain direction.
final boolean isPlayer()
Check if an entity is a player.
void walkTo(Position position)
void resetFace()
Resets the mob's face location.
Optional< Graphic > graphic
void venom()
Applies venom to the entity.
Represents a non-player character in the in-game world.
void appendDeath()
Handles the mob death.
void register()
Registers an entity to the World.
void unregister()
Unregisters an entity from the World.
void send(OutgoingPacket encoder)
void reset()
Iterates through the active prayers and disables them all.
Represents a static game object loaded from the map fs.
Contains traversal data for a set of regions.
static List< Position > getTraversableTiles(Position southWest, int width, int length)
Returns a List of positions that are traversable from the specified position.
Handles checking if mobs are in a certain area.
static boolean inVorkath(Interactable entity)
Represents a single tile on the game world.
Position transform(int diffX, int diffY, int diffZ)
Creates a new location based on this location.
boolean equals(Object obj)
Position copy()
Creates a deep copy of this location.
A static-util class that provides additional functionality for generating pseudo-random numbers.
static< T > T random(T[] array)
Pseudo-randomly retrieves a element from array.
Handles miscellaneous methods.
static int random(int bound)
static boolean withinOctal(Interactable source, Interactable target, int distance)
Represents different priorities for updating.
The enumerated type whose elements represent the fighting types.
VENOM
Represents a venom hit type.
Holds all the lock types.