forked from MagicBane/Server
Refactor isTwoHanded()
This commit is contained in:
@@ -43,7 +43,6 @@ public class ItemBase {
|
||||
private final short maxDamage;
|
||||
private final String mastery;
|
||||
private final engine.Enum.SourceType damageType;
|
||||
private final boolean twoHanded;
|
||||
private boolean isConsumable;
|
||||
|
||||
// Item stat modifiers
|
||||
@@ -74,8 +73,6 @@ public class ItemBase {
|
||||
this.mastery = rs.getString("mastery");
|
||||
damageType = Enum.SourceType.valueOf(rs.getString("damageType").toUpperCase());
|
||||
|
||||
this.twoHanded = (rs.getInt("twoHanded") == 1);
|
||||
|
||||
ItemTemplate template = ItemTemplate.itemTemplates.get(this.getUUID());
|
||||
|
||||
if (template == null)
|
||||
@@ -211,10 +208,6 @@ public class ItemBase {
|
||||
public final int getUUID() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public boolean isTwoHanded() {
|
||||
return this.twoHanded;
|
||||
}
|
||||
public String getMastery() {
|
||||
return mastery;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class ItemFactory {
|
||||
case "Hammer":
|
||||
case "Unarmed Combat":
|
||||
|
||||
if (ib.isTwoHanded())
|
||||
if (ItemTemplate.isTwoHanded(template))
|
||||
galvorAmount = 20;
|
||||
else
|
||||
galvorAmount = 10;
|
||||
@@ -829,7 +829,7 @@ public class ItemFactory {
|
||||
case "Hammer":
|
||||
case "Unarmed Combat":
|
||||
|
||||
if (ib.isTwoHanded())
|
||||
if (ItemTemplate.isTwoHanded(template))
|
||||
galvorAmount = 22;
|
||||
else
|
||||
galvorAmount = 11;
|
||||
|
||||
@@ -471,6 +471,14 @@ public class ItemTemplate {
|
||||
return item.template.item_eq_slots_and.contains(EnumSet.of(Enum.EquipSlotType.LHELD, Enum.EquipSlotType.RHELD));
|
||||
}
|
||||
|
||||
public static boolean isTwoHanded(ItemTemplate template) {
|
||||
|
||||
if (!template.item_type.equals(Enum.ItemType.WEAPON))
|
||||
return false;
|
||||
|
||||
return template.item_eq_slots_and.contains(EnumSet.of(Enum.EquipSlotType.LHELD, Enum.EquipSlotType.RHELD));
|
||||
}
|
||||
|
||||
public static boolean isShield(Item item) {
|
||||
|
||||
if (item.template.item_skill_required.containsKey("Block"))
|
||||
|
||||
Reference in New Issue
Block a user