Skip to content

Commit

Permalink
Track the time of the hit event.
Browse files Browse the repository at this point in the history
  • Loading branch information
steffen-wilke committed Jan 4, 2021
1 parent 63fb8cf commit 853eefd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/de/gurkenlabs/litiengine/entities/EntityHitEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.EventObject;

import de.gurkenlabs.litiengine.Game;
import de.gurkenlabs.litiengine.abilities.Ability;

public class EntityHitEvent extends EventObject {
Expand All @@ -12,6 +13,7 @@ public class EntityHitEvent extends EventObject {
private final transient ICombatEntity executor;
private final transient ICombatEntity hitEntity;
private final transient Ability ability;
private final long time;

EntityHitEvent(final ICombatEntity hitEntity, final Ability ability, final int damage, final boolean kill) {
super(hitEntity);
Expand All @@ -20,6 +22,7 @@ public class EntityHitEvent extends EventObject {
this.ability = ability;
this.damage = damage;
this.kill = kill;
this.time = Game.time().now();
}

public int getDamage() {
Expand All @@ -41,4 +44,6 @@ public boolean wasKilled() {
public Ability getAbility() {
return this.ability;
}

public long getTime() { return time; }
}

0 comments on commit 853eefd

Please sign in to comment.