Refactor item_type

This commit is contained in:
2024-03-10 13:34:24 -04:00
parent 87290baa52
commit df5c607375
24 changed files with 137 additions and 203 deletions
+8 -6
View File
@@ -2840,11 +2840,11 @@ public class PlayerCharacter extends AbstractCharacter {
ItemBase ib = item.getItemBase();
if (ib != null) {
if ((ib.getType().equals(ItemType.WEAPON))
if ((item.template.item_type.equals(ItemType.WEAPON))
&& (ib.getSkillRequired().equals(type) || ib.getMastery().equals(type)))
return true;
return (ib.getType().equals(ItemType.ARMOR))
return (item.template.item_type.equals(ItemType.ARMOR))
&& (ib.getSkillRequired().equals(type));
}
@@ -3865,7 +3865,7 @@ public class PlayerCharacter extends AbstractCharacter {
ItemBase ib = weapon.getItemBase();
if (ib == null)
noWeapon = true;
else if (!ib.getType().equals(ItemType.WEAPON)) {
else if (!weapon.template.item_type.equals(ItemType.WEAPON)) {
defaultAtrAndDamage(mainHand);
return;
} else
@@ -3884,7 +3884,7 @@ public class PlayerCharacter extends AbstractCharacter {
if (noWeapon) {
if (mainHand) {
Item off = this.charItemManager.getEquipped().get(EquipSlotType.LHELD);
if (off != null && off.getItemBase() != null && off.getItemBase().getType().equals(ItemType.WEAPON))
if (off != null && off.getItemBase() != null && off.template.item_type.equals(ItemType.WEAPON))
this.rangeHandOne = 10 * (1 + (this.statStrBase / 600)); // Set
// to
// no
@@ -4026,7 +4026,7 @@ public class PlayerCharacter extends AbstractCharacter {
//if duel wielding, cut damage by 30%
if (otherHand != null) {
ItemBase ibo = otherHand.getItemBase();
if (ibo != null && ibo.getType().equals(ItemType.WEAPON)) {
if (ibo != null && otherHand.template.equals(ItemType.WEAPON)) {
min *= 0.7f;
max *= 0.7f;
}
@@ -4171,10 +4171,12 @@ public class PlayerCharacter extends AbstractCharacter {
if (ib == null)
return 0;
if (!ib.getType().equals(ItemType.ARMOR))
if (!armor.template.item_type.equals(ItemType.ARMOR))
return 0;
if (ib.getSkillRequired().isEmpty())
return ib.getDefense();
CharacterSkill armorSkill = this.skills.get(ib.getSkillRequired());
if (armorSkill == null) {
Logger.error("Player " + this.getObjectUUID()