RuneHive-Game
Loading...
Searching...
No Matches
CombatSkullEffect.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.combat.effect.impl;
2
3import com.runehive.game.world.entity.combat.effect.CombatEffect;
4import com.runehive.game.world.entity.mob.Mob;
5import com.runehive.game.world.entity.mob.player.Player;
6import com.runehive.game.world.position.Area;
7
8/**
9 * The combat effect applied when a player needs to be skulled.
10 *
11 * @author lare96 <http://github.com/lare96>
12 */
13public final class CombatSkullEffect extends CombatEffect {
14
15 /**
16 * Creates a new {@link CombatSkullEffect}.
17 */
19 super(50);
20 }
21
22 @Override
23 public boolean apply(Mob mob) {
24 if (mob.isPlayer()) {
25 Player player = (Player) mob;
26
27 /* if (Area.inEventArena(mob)) {
28 return false;
29 }*/
30
31 if (!Area.inWilderness(mob)) {
32 return false;
33 }
34
35 if (player.skulling.isSkulled()) {
36 return false;
37 }
38
39 player.skulling.skull();
40 return true;
41 }
42 return false;
43 }
44
45 @Override
46 public boolean removeOn(Mob mob) {
47 if (mob.isPlayer()) {
48 Player player = (Player) mob;
49
50 if (!player.skulling.isSkulled()) {
51 player.skulling.unskull();
52 return true;
53 }
54
55 return false;
56 }
57
58 return true;
59 }
60
61 @Override
62 public void process(Mob mob) {
63 // nothing to process
64 }
65
66 @Override
67 public boolean onLogin(Mob mob) {
68 if (mob.isPlayer()) {
69 Player player = (Player) mob;
70
71 if (player.skulling.isSkulled()) {
72 return true;
73 }
74 }
75 return false;
76 }
77}
void unskull()
Unskulls the player.
Definition Skulling.java:95
CombatEffect(int delay)
Creates a new CombatEffect.
void process(Mob mob)
Provides processing for this effect on mob.
boolean removeOn(Mob mob)
Removes this effect from mob if needed.
boolean onLogin(Mob mob)
Executed on login, primarily used to re-apply the effect to mob.
Handles the mob class.
Definition Mob.java:66
This class represents a character controlled by a player.
Definition Player.java:125
Handles checking if mobs are in a certain area.
Definition Area.java:13
static boolean inWilderness(Position position)
Definition Area.java:272