1package com.runehive.game.world.entity.combat;
3import com.runehive.game.world.entity.combat.hit.Hit;
4import com.runehive.game.world.entity.mob.Mob;
5import com.runehive.game.world.entity.mob.npc.Npc;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.game.world.entity.mob.player.PlayerRight;
8import com.runehive.util.Stopwatch;
10import java.util.HashMap;
12import java.util.Optional;
13import java.util.concurrent.TimeUnit;
26 private final Map<Mob, DamageCounter>
attackers =
new HashMap<>();
39 if (
hit.getDamage() > 0) {
68 return Optional.ofNullable(killer);
89 killer =
entity.getPlayer();
92 return Optional.ofNullable(killer);
120 return Optional.ofNullable(killer);
176 this.stopwatch.
reset();
static final long DAMAGE_CACHE_TIMEOUT
The amount of time it takes in seconds for cached damage to timeout.
A counter that will track the amount of damage dealt and whether that damaged has timed out or not.
void incrementAmount(int amount)
Increments the amount of damage within this counter.
DamageCounter(int amount)
Creates a new DamageCounter.
boolean isTimeout()
Determines if this counter has timed out or not.
final Stopwatch stopwatch
The stopwatch that will determine when a timeout occurs.
int amount
The amount of damage within this counter.
int getAmount()
Gets the amount of damage within this counter.
A fs of players who have inflicted damage on another player in a combat session.
Optional< Mob > calculateProperKiller()
Determines which entity in the backing collection has inflicted the most damage.
Optional< Player > getPlayerKiller()
Determines which player in the backing collection has inflicted the most damage.
Optional< Npc > getNpcKiller()
Determines which player in the backing collection has inflicted the most damage.
void add(Mob character, Hit hit)
Registers damage in the backing collection for character.
final Map< Mob, DamageCounter > attackers
The damages of players who have inflicted damage.
void clear()
Clears all data from the backing collection.
A Hit object holds the damage amount and hitsplat data.
Represents a non-player character in the in-game world.
This class represents a character controlled by a player.
Holds all the player right data.
static boolean isIronman(Player player)
Checks if the player is an ironman.