1package com.runehive.game.world.entity.combat.strategy.npc;
3import com.runehive.game.Animation;
4import com.runehive.game.Graphic;
5import com.runehive.game.UpdatePriority;
6import com.runehive.game.engine.GameEngine;
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.effect.impl.CombatVenomEffect;
12import com.runehive.game.world.entity.combat.hit.CombatHit;
13import com.runehive.game.world.entity.combat.hit.Hit;
14import com.runehive.game.world.entity.combat.projectile.CombatProjectile;
15import com.runehive.game.world.entity.combat.strategy.basic.MagicStrategy;
16import com.runehive.game.world.entity.mob.Mob;
17import com.runehive.game.world.entity.mob.npc.Npc;
18import com.runehive.util.RandomUtils;
19import org.jire.runehiveps.WorldTask;
21import javax.annotation.Nullable;
22import java.util.Optional;
23import java.util.function.Consumer;
24import java.util.function.Predicate;
49 if (projAnim.isPresent()) animation = projAnim.get();
52 attacker.
animate(animation,
true);
58 @Nullable Runnable onProjectileLand) {
62 if (endGraphic !=
null) to.
graphic(endGraphic);
65 Predicate<CombatImpact> filter =
effect ->
effect.canAffect(attacker, to,
hit);
66 Consumer<CombatImpact> execute =
effect ->
effect.impact(attacker, to,
hit,
null);
78 if (onProjectileLand !=
null) {
80 WorldTask.schedule(delay, onProjectileLand);
Class that models a single animation used by an entity.
Represents a single graphic that can be used by entities.
static int clientTicksToServerTicks(final int clientTicks)
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.
The combat effect applied when a character needs to be venomed.
static boolean isVenomous(Npc npc)
A wrapper for a Hit object, adding additional variables for hit and hitsplat delays.
A Hit object holds the damage amount and hitsplat data.
static boolean missed(final Hit... hits)
final CombatHit nextMagicHit(T attacker, Mob defender)
void hit(T attacker, Mob defender, Hit hit)
Called when the attacking mob performs an attack on the defender.
static Graphic getEndGraphic(final CombatProjectile combatProjectile, final boolean splash, final Graphic splashGraphic)
static final Graphic SPLASH
The spell splash graphic.
CombatProjectile getCombatProjectile()
final CombatProjectile combatProjectile
int getAttackDelay(Npc attacker, Mob defender, FightType fightType)
Animation getAttackAnimation(Npc attacker, Mob defender)
int sendProjectile(Npc attacker, Hit[] hits, Mob from, Mob to, @Nullable Runnable onProjectileLand)
boolean canAttack(Npc attacker, Mob defender)
int getAttackDistance(Npc attacker, FightType fightType)
CombatHit[] getHits(Npc attacker, Mob defender)
NpcMagicStrategy(CombatProjectile combatProjectile)
void start(Npc attacker, Mob defender, Hit[] hits)
CombatType getCombatType()
void sendAnimation(Npc attacker, Mob defender)
void animate(int animation)
Optional< Graphic > graphic
void venom()
Applies venom to the entity.
Represents a non-player character in the in-game world.
double getDistance(Position other)
Gets the distance between this location and another location.
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...
Represents different priorities for updating.
The enumerated type whose elements represent the fighting types.