RuneHive-Game
Loading...
Searching...
No Matches
Skulling.java
Go to the documentation of this file.
1package com.runehive.content.combat;
2
3import com.runehive.Config;
4import com.runehive.content.lms.LMSGame;
5import com.runehive.game.task.impl.SkullRemoveTask;
6import com.runehive.game.world.World;
7import com.runehive.game.world.entity.mob.UpdateFlag;
8import com.runehive.game.world.entity.mob.player.Player;
9
10import java.util.LinkedList;
11import java.util.List;
12
13/**
14 * Handles the skulling class.
15 *
16 * @author Daniel
17 */
18public class Skulling {
19
20 /** All the other player's this entity has attacked. */
21 private final List<String> attacked = new LinkedList<>();
22
23 /** The player of this class. */
24 private Player player;
25
26 /** Their skull icon identification */
28
30
31 /**
32 * Constructs a new <code>Skulling<code> class.
33 *
34 * @param player The player instance.
35 */
37 this.player = player;
38 this.skullRemoveTask = new SkullRemoveTask(player);
39 }
40
41 /**
42 * Checks if player requires a skull upon attacking another player.
43 *
44 * @param opponent The opponent.
45 */
46 public void checkForSkulling(Player opponent) {
47 /* if (Area.inEventArena(opponent)) {
48 return;
49 }*/
50 if (!attacked.contains(opponent.getName()) && !opponent.skulling.attacked.contains(player.getName())) {
52 }
53 }
54
55 public void skull() {
57 }
58
61 }
62
63 /**
64 * Skulls the player and deposit's the attacked player into the list.
65 *
66 * @param attacking
67 */
68 public void skull(Player attacking, SkullHeadIconType icon) {
69 if (attacking.inActivity()) {
70 return;
71 }
72
73 if(LMSGame.inGameArea(attacking)) return;
74
75 if (attacking != player) {
76 attacked.add(attacking.getName());
77 }
78
79 this.icon = icon;
80 player.updateFlags.add(UpdateFlag.APPEARANCE);
81
82 if (!skullRemoveTask.isRunning()) {
83 skullRemoveTask.setSkullTime(skullRemoveTask.getSkullTime() <= 0 ? Config.SKULL_TIME : skullRemoveTask.getSkullTime());
85 }
86 }
87
88 public boolean isSkulled() {
89 return skullRemoveTask.isRunning();
90 }
91
92 /**
93 * Unskulls the player.
94 */
95 public void unskull() {
96 if (!isSkulled()) {
97 return;
98 }
99
100 skullRemoveTask.setSkullTime(0);
101 attacked.clear();
103 player.updateFlags.add(UpdateFlag.APPEARANCE);
104 }
105
109
110 /**
111 * Gets the skull icon.
112 *
113 * @return The skull icon.
114 */
116 return icon;
117 }
118
119}
The class that contains setting-related constants for the server.
Definition Config.java:24
static final int SKULL_TIME
The time in ticks a player remains skulled for.
Definition Config.java:191
Skulling(Player player)
Constructs a new Skulling class.
Definition Skulling.java:36
void skull(Player attacking, SkullHeadIconType icon)
Skulls the player and deposit's the attacked player into the list.
Definition Skulling.java:68
SkullHeadIconType icon
Their skull icon identification.
Definition Skulling.java:27
SkullHeadIconType getHeadIconType()
Gets the skull icon.
void skull(SkullHeadIconType icon)
Definition Skulling.java:59
final List< String > attacked
All the other player's this entity has attacked.
Definition Skulling.java:21
void unskull()
Unskulls the player.
Definition Skulling.java:95
void checkForSkulling(Player opponent)
Checks if player requires a skull upon attacking another player.
Definition Skulling.java:46
Player player
The player of this class.
Definition Skulling.java:24
static boolean inGameArea(Player player)
Handles checking if the player is in the LMS game area.
Definition LMSGame.java:142
Represents the game world.
Definition World.java:46
static void schedule(Task task)
Submits a new event.
Definition World.java:247
This class represents a character controlled by a player.
Definition Player.java:125
String getName()
Gets the name of this entity.
Definition Player.java:774