1package com.runehive.game.world.entity.combat;
3import com.runehive.game.world.entity.mob.Mob;
4import com.runehive.game.world.entity.mob.npc.Npc;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.pathfinding.path.SimplePathChecker;
7import com.runehive.game.world.position.Area;
8import com.runehive.game.world.position.Position;
9import com.runehive.game.world.region.Region;
10import com.runehive.util.Utility;
12import java.util.concurrent.TimeUnit;
24 this.distance = Integer.MAX_VALUE;
39 if (
mob.getCombat().isUnderAttack()) {
42 mob.getCombat().reset();
43 if (
mob.isNpc() &&
mob.getNpc().boundaries.length > 0) {
46 mob.walkExactlyTo(pos, () -> {
52 mob.getCombat().reset();
60 int aggressionRadius =
mob.width() + 3;
67 if (dist > aggressionRadius)
75 mob.getCombat().reset();
121 if (npc ==
null || !npc.isValid())
124 if (!npc.definition.isAttackable() || !npc.definition.isAggressive())
127 if (npc.isDead() || !npc.isVisible() || npc.forceWalking)
130 if (npc.locking.locked())
136 if (npc.getCombat().isAttacking(player) && !player.
getCombat().isAttacking(npc))
137 npc.getCombat().reset();
144 if (npc.npcAssistant.isArmadyl()) {
145 boolean found =
false;
147 if (
Utility.
getDistance(npc, npc1.getPosition()) < 5 && !npc1.npcAssistant.isArmadyl()) {
149 npc.getCombat().attack(npc1);
161 }
else if (npc.npcAssistant.isBandos()) {
162 boolean found =
false;
164 if (
Utility.
getDistance(npc, npc1.getPosition()) < 5 && !npc1.npcAssistant.isBandos()) {
166 npc.getCombat().attack(npc1);
178 }
else if (npc.npcAssistant.isSaradomin()) {
179 boolean found =
false;
181 if (
Utility.
getDistance(npc, npc1.getPosition()) < 5 && !npc1.npcAssistant.isSaradomin()) {
183 npc.getCombat().attack(npc1);
195 }
else if (npc.npcAssistant.isZamorak()) {
196 boolean found =
false;
198 if (
Utility.
getDistance(npc, npc1.getPosition()) < 5 && !npc1.npcAssistant.isZamorak()) {
200 npc.getCombat().attack(npc1);
215 npc.getCombat().compare(player, npc.definition.getCombatLevel(), npc.spawnPosition);
void checkAggression(Position spawn)
Checks the aggression for this mob if a target is set.
boolean isTarget(Mob mob)
void setTarget(Mob target)
void compare(Mob other, int level, Position spawn)
Compares the given mob with the current target.
static final int AGGRESSION_TIMEOUT
The aggression timeout in minutes.
static void checkAggression(Player player)
final SkillManager skills
List< Npc > getNpcsInViewport()
The collection of npcs in this viewport.
Represents a non-player character in the in-game world.
This class represents a character controlled by a player.
final Equipment equipment
Stopwatch aggressionTimer
Combat< Player > getCombat()
The combat of the mob.
int getCombatLevel()
Gets the mob's combat level.
Represents a PathFinder which is meant to be used to check projectiles passage in a straight line.
static boolean checkProjectile(Interactable source, Interactable target)
Handles checking if mobs are in a certain area.
static boolean inMulti(Entity entity)
static boolean inGodwarsChambers(Mob mob)
static boolean inFightCaves(Interactable entity)
static boolean inWilderness(Position position)
static boolean inGodwars(Interactable entity)
Represents a single tile on the game world.
Represents a single region.
static final int VIEW_DISTANCE
Collection< Npc > getNpcs(int height)
boolean elapsed(long time, TimeUnit unit)
Handles miscellaneous methods.
static int getDistance(Interactable source, Position target)
static< T > T randomElement(Collection< T > collection)
Picks a random element out of any array type.