RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
GodwarsListener.java
1package com.osroyale.content.activity.impl.godwars;
2
3import com.osroyale.content.activity.ActivityListener;
4import com.osroyale.game.world.entity.combat.CombatType;
5import com.osroyale.game.world.entity.combat.hit.Hit;
6import com.osroyale.game.world.entity.mob.Mob;
7import com.osroyale.game.world.entity.mob.npc.Npc;
8
9import static com.osroyale.content.activity.impl.godwars.GodwarsActivity.*;
10
16public class GodwarsListener extends ActivityListener<GodwarsActivity> {
17
18 GodwarsListener(GodwarsActivity activity) {
19 super(activity);
20 }
21
22 @Override
23 public boolean canAttack(Mob attacker, Mob defender) {
24 System.out.println(defender);
25 if (!attacker.isPlayer() && !defender.isNpc()) {
26 return super.canAttack(attacker, defender);
27 }
28
29 Npc npc = defender.getNpc();
30
31 if (npc.id == 3166 || npc.id == 3167 || npc.id == 3168 || npc.id == 3172 || npc.id == 3176 || npc.id == 3183) {
32 if (attacker.getStrategy().getCombatType().equals(CombatType.MELEE)) {
33 attacker.getPlayer().message("You can't attack Armadyl with melee!");
34 return false;
35 }
36 }
37
38 return super.canAttack(attacker, defender);
39 }
40
41 @Override
42 public void onKill(Mob attacker, Mob defender, Hit hit) {
43 if (defender.isNpc()) {
44 Npc npc = defender.getNpc();
45 if (npc.npcAssistant.isArmadyl()) {
46 activity.increment(ARMADYL);
47 } else if (npc.npcAssistant.isBandos()) {
48 activity.increment(BANDOS);
49 } else if (npc.npcAssistant.isSaradomin()) {
50 activity.increment(SARADOMIN);
51 } else if (npc.npcAssistant.isZamorak()) {
52 activity.increment(ZAMORAK);
53 }
54 }
55 }
56}
abstract< T extends Mob > CombatStrategy<? super T > getStrategy()