RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
RangedWeaponDefinition.java
1package com.osroyale.game.world.entity.combat.ranged;
2
3import java.util.Arrays;
4
26
27public class RangedWeaponDefinition {
28
29 private final RangedWeaponType type;
30 private final RangedAmmunition[] allowed;
31
32 public RangedWeaponDefinition(RangedWeaponType type, RangedAmmunition... allowed) {
33 this.type = type;
34 this.allowed = allowed;
35 }
36
37 public int getSlot() {
38 return type.slot;
39 }
40
41 public RangedWeaponType getType() {
42 return type;
43 }
44
45 public boolean isValid(RangedAmmunition ammunition) {
46 if (ammunition == null) return false;
47 for (RangedAmmunition ammo : allowed) {
48 if (ammo == ammunition) {
49 return true;
50 }
51 }
52 return false;
53 }
54
55 public RangedAmmunition[] getAllowed() {
56 return allowed;
57 }
58
59 @Override
60 public String toString() {
61 return "RangedWeaponDefinition{" +
62 "type=" + type +
63 ", allowed=" + Arrays.toString(allowed) +
64 '}';
65 }
66}