RuneHive-Game
Loading...
Searching...
No Matches
Vengeance.java
Go to the documentation of this file.
1package com.runehive.content.skill.impl.magic.spell.impl;
2
3import com.runehive.content.skill.impl.magic.Spellbook;
4import com.runehive.content.skill.impl.magic.spell.Spell;
5import com.runehive.game.Animation;
6import com.runehive.game.Graphic;
7import com.runehive.game.UpdatePriority;
8import com.runehive.game.world.entity.combat.attack.listener.other.VengeanceListener;
9import com.runehive.game.world.entity.mob.player.Player;
10import com.runehive.game.world.entity.skill.Skill;
11import com.runehive.game.world.items.Item;
12import com.runehive.net.packet.out.SendMessage;
13import com.runehive.net.packet.out.SendWidget;
14
15import java.util.concurrent.TimeUnit;
16
17/**
18 * Handles the vengeance spell.
19 */
20public class Vengeance implements Spell {
21 @Override
22 public String getName() {
23 return "Vengeance";
24 }
25
26 @Override
27 public Item[] getRunes() {
28 return new Item[]{new Item(9075, 4), new Item(557, 10), new Item(560, 2)};
29 }
30
31 @Override
32 public int getLevel() {
33 return 94;
34 }
35
36 @Override
37 public void execute(Player player, Item item) {
38 if (player.spellbook != Spellbook.LUNAR)
39 return;
40 if (player.skills.getMaxLevel(Skill.DEFENCE) < 45) {
41 player.send(new SendMessage("You need a defence level of 45 to cast this spell!"));
42 return;
43 }
44 if (player.venged) {
45 player.send(new SendMessage("You already have vengeance casted!"));
46 return;
47 }
48 if (player.spellCasting.vengeanceDelay.elapsedTime(TimeUnit.SECONDS) < 30) {
49 player.send(new SendMessage("You can only cast vengeance once every 30 seconds."));
50 return;
51 }
52 player.animate(new Animation(8317, UpdatePriority.HIGH), true);
53 player.graphic(new Graphic(726, true));
56 player.venged = true;
57 player.getCombat().addListener(VengeanceListener.get());
58 }
59}
int getLevel()
Gets the level required to cast spell.
void execute(Player player, Item item)
Executes the magic spell.
Item[] getRunes()
Gets the runes required to cast the spell.
Class that models a single animation used by an entity.
Represents a single graphic that can be used by entities.
Definition Graphic.java:10
Optional< Graphic > graphic
Definition Mob.java:91
This class represents a character controlled by a player.
Definition Player.java:125
Combat< Player > getCombat()
The combat of the mob.
Definition Player.java:759
Represents a trainable and usable skill.
Definition Skill.java:18
static final int DEFENCE
The defence skill id.
Definition Skill.java:24
int getMaxLevel(int id)
Gets the highest possible level of a skill.
The container class that represents an item that can be interacted with.
Definition Item.java:21
The OutgoingPacket that sends a message to a Players chatbox in the client.
long elapsedTime(TimeUnit unit)
The in-game spellbooks for players.
Definition Spellbook.java:8
Represents different priorities for updating.
The itemcontainer for casting a spell.
Definition Spell.java:11