RuneHive-Game
Loading...
Searching...
No Matches
ActivityListener.java
Go to the documentation of this file.
1package com.runehive.content.activity;
2
3import com.runehive.game.world.entity.combat.CombatType;
4import com.runehive.game.world.entity.combat.attack.listener.CombatListener;
5import com.runehive.game.world.entity.combat.hit.Hit;
6import com.runehive.game.world.entity.mob.Mob;
7
8/**
9 * A combat listener that is applied to all mobs added to (or removed from) the
10 * activity.
11 *
12 * @param <T> the activity type
13 */
14public abstract class ActivityListener<T extends Activity> implements CombatListener<Mob> {
15
16 /** The parent activity. */
17 protected final T activity;
18
19 /**
20 * Constructs a new {@code ActivityListener} for a activity.
21 *
22 * @param activity the parent activity
23 */
25 this.activity = activity;
26 }
27
28 @Override
29 public boolean withinDistance(Mob attacker, Mob defender) {
30 return true;
31 }
32
33 @Override
34 public boolean canAttack(Mob attacker, Mob defender) {
35 return true;
36 }
37
38 @Override
39 public boolean canOtherAttack(Mob attacker, Mob defender) {
40 return true;
41 }
42
43 @Override
44 public void onDamage(Mob defender, Hit hit) {
45 }
46
47 @Override
48 public void start(Mob attacker, Mob defender, Hit[] hits) {
49 }
50
51 @Override
52 public void attack(Mob attacker, Mob defender, Hit hit) {
53 }
54
55 @Override
56 public void hit(Mob attacker, Mob defender, Hit hit) {
57 }
58
59 @Override
60 public void block(Mob attacker, Mob defender, Hit hit, CombatType combatType) {
61 }
62
63 @Override
64 public void preDeath(Mob attacker, Mob defender, Hit hit) {
65 }
66
67 @Override
68 public void onDeath(Mob attacker, Mob defender, Hit hit) {
69 }
70
71 @Override
72 public void hitsplat(Mob attacker, Mob defender, Hit hit) {
73 }
74
75 @Override
76 public void finishOutgoing(Mob attacker, Mob defender) {
77 }
78
79 @Override
80 public void finishIncoming(Mob attacker, Mob defender) {
81 }
82
83 @Override
84 public void preKill(Mob attacker, Mob defender, Hit hit) {
85 }
86
87 @Override
88 public void onKill(Mob attacker, Mob defender, Hit hit) {
89 }
90}
A Activity object constructs an in-game activity and sequences it through the start() and finish() me...
Definition Activity.java:31
void onDeath(Mob attacker, Mob defender, Hit hit)
void onKill(Mob attacker, Mob defender, Hit hit)
void hitsplat(Mob attacker, Mob defender, Hit hit)
void block(Mob attacker, Mob defender, Hit hit, CombatType combatType)
boolean withinDistance(Mob attacker, Mob defender)
boolean canAttack(Mob attacker, Mob defender)
void hit(Mob attacker, Mob defender, Hit hit)
ActivityListener(T activity)
Constructs a new ActivityListener for a activity.
void finishIncoming(Mob attacker, Mob defender)
void attack(Mob attacker, Mob defender, Hit hit)
void preKill(Mob attacker, Mob defender, Hit hit)
Called before attacker killed defender.
void start(Mob attacker, Mob defender, Hit[] hits)
void preDeath(Mob attacker, Mob defender, Hit hit)
boolean canOtherAttack(Mob attacker, Mob defender)
void finishOutgoing(Mob attacker, Mob defender)
A Hit object holds the damage amount and hitsplat data.
Definition Hit.java:10
Handles the mob class.
Definition Mob.java:66
A combat attack is used to describe what the attacking and defending mobs should do in each stage of ...