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.attack.FormulaFactory;
11import com.runehive.game.world.entity.combat.effect.impl.CombatPoisonEffect;
12import com.runehive.game.world.entity.combat.effect.impl.CombatVenomEffect;
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.projectile.CombatProjectile;
16import com.runehive.game.world.entity.combat.strategy.basic.RangedStrategy;
17import com.runehive.game.world.entity.mob.Mob;
18import com.runehive.game.world.entity.mob.npc.Npc;
19import com.runehive.util.RandomUtils;
20import org.jire.runehiveps.WorldTask;
22import javax.annotation.Nullable;
23import java.util.Optional;
24import java.util.function.Consumer;
25import java.util.function.Predicate;
50 if (projAnim.isPresent()) animation = projAnim.get();
53 attacker.
animate(animation,
true);
61 if (endGraphic !=
null) to.
graphic(endGraphic);
63 if (onProjectileLand !=
null) {
65 WorldTask.schedule(delay, onProjectileLand);
73 Predicate<CombatImpact> filter =
effect ->
effect.canAffect(attacker, defender,
hit);
74 Consumer<CombatImpact> execute =
effect ->
effect.impact(attacker, defender,
hit,
null);
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.
final CombatHit nextRangedHit(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)
CombatProjectile getCombatProjectile()
void attack(Npc attacker, Mob defender, Hit hit)
int getAttackDistance(Npc attacker, FightType fightType)
final CombatProjectile combatProjectile
CombatType getCombatType()
boolean canAttack(Npc attacker, Mob defender)
int sendProjectile(Mob from, Mob to, @Nullable Runnable onProjectileLand)
Animation getAttackAnimation(Npc attacker, Mob defender)
CombatHit[] getHits(Npc attacker, Mob defender)
int getAttackDelay(Npc attacker, Mob defender, FightType fightType)
NpcRangedStrategy(CombatProjectile combatProjectile)
void start(Npc attacker, Mob defender, Hit[] hits)
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.
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.