RuneHive-Game
Loading...
Searching...
No Matches
RangedWeaponDefinition.java
Go to the documentation of this file.
1package com.runehive.game.world.entity.combat.ranged;
2
3import java.util.Arrays;
4
6
7 private final RangedWeaponType type;
8 private final RangedAmmunition[] allowed;
9
11 this.type = type;
12 this.allowed = allowed;
13 }
14
15 public int getSlot() {
16 return type.slot;
17 }
18
20 return type;
21 }
22
23 public boolean isValid(RangedAmmunition ammunition) {
24 if (ammunition == null) return false;
25 for (RangedAmmunition ammo : allowed) {
26 if (ammo == ammunition) {
27 return true;
28 }
29 }
30 return false;
31 }
32
34 return allowed;
35 }
36
37 @Override
38 public String toString() {
39 return "RangedWeaponDefinition{" +
40 "type=" + type +
41 ", allowed=" + Arrays.toString(allowed) +
42 '}';
43 }
44}
RangedWeaponDefinition(RangedWeaponType type, RangedAmmunition... allowed)