Browse Source

Refactor skill_used

combat-2
MagicBot 8 months ago
parent
commit
f616937236
  1. 3
      src/engine/gameManager/CombatManager.java
  2. 8
      src/engine/objects/ItemBase.java
  3. 4
      src/engine/objects/ItemFactory.java
  4. 8
      src/engine/objects/Mob.java
  5. 12
      src/engine/objects/PlayerCharacter.java

3
src/engine/gameManager/CombatManager.java

@ -1037,8 +1037,9 @@ public enum CombatManager { @@ -1037,8 +1037,9 @@ public enum CombatManager {
}
}
ItemTemplate template = ItemTemplate.itemTemplates.get(wb.getUUID());
String required = wb.getSkillRequired();
String required = template.item_skill_used;
String mastery = wb.getMastery();
if (required.equals("Unarmed Combat"))

8
src/engine/objects/ItemBase.java

@ -35,8 +35,6 @@ public class ItemBase { @@ -35,8 +35,6 @@ public class ItemBase {
private int hashID;
private final byte useAmount;
// Armor and weapon related values
private final String skillRequired;
private final short percentRequired;
private final short defense;
private final float dexPenalty;
@ -65,7 +63,6 @@ public class ItemBase { @@ -65,7 +63,6 @@ public class ItemBase {
this.hashID = rs.getInt("itemHashID");
this.isConsumable = false;
this.skillRequired = rs.getString("skillRequired");
this.percentRequired = rs.getShort("percentRequired");
this.defense = rs.getShort("defense");
this.dexPenalty = rs.getFloat("dexPenalty");
@ -248,11 +245,6 @@ public class ItemBase { @@ -248,11 +245,6 @@ public class ItemBase {
public boolean isTwoHanded() {
return this.twoHanded;
}
public String getSkillRequired() {
return skillRequired;
}
public String getMastery() {
return mastery;
}

4
src/engine/objects/ItemFactory.java

@ -221,7 +221,7 @@ public class ItemFactory { @@ -221,7 +221,7 @@ public class ItemFactory {
if (template.item_type.equals(ItemType.WEAPON) && ib.getPercentRequired() == 110) {
switch (ib.getSkillRequired()) {
switch (template.item_skill_used) {
case "Bow":
case "Crossbow":
case "Spear":
@ -815,7 +815,7 @@ public class ItemFactory { @@ -815,7 +815,7 @@ public class ItemFactory {
int wormwoodAmount = 0;
if (template.item_type.equals(ItemType.WEAPON) && ib.getPercentRequired() == 110) {
switch (ib.getSkillRequired()) {
switch (template.item_skill_used) {
case "Bow":
case "Crossbow":
case "Spear":

8
src/engine/objects/Mob.java

@ -1243,7 +1243,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { @@ -1243,7 +1243,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
skill = null;
mastery = null;
} else {
skill = this.skills.get(wb.getSkillRequired());
skill = this.skills.get(weapon.template.item_skill_used);
mastery = this.skills.get(wb.getMastery());
}
@ -1298,10 +1298,10 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { @@ -1298,10 +1298,10 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
if (!armor.template.item_type.equals(ItemType.ARMOR))
return 0;
if (ib.getSkillRequired().isEmpty())
if (armor.template.item_skill_used.isEmpty())
return ib.getDefense();
CharacterSkill armorSkill = this.skills.get(ib.getSkillRequired());
CharacterSkill armorSkill = this.skills.get(armor.template.item_skill_used);
if (armorSkill == null)
return ib.getDefense();
@ -1372,7 +1372,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed { @@ -1372,7 +1372,7 @@ public class Mob extends AbstractIntelligenceAgent implements Delayed {
else
this.rangeHandTwo = weapon.getItemBase().getRange() * (1 + (baseStrength / 600.0f));
skillPercentage = getModifiedAmount(this.skills.get(wb.getSkillRequired()));
skillPercentage = getModifiedAmount(this.skills.get(weapon.template.item_skill_used));
masteryPercentage = getModifiedAmount(this.skills.get(wb.getMastery()));
if (masteryPercentage == 0f)

12
src/engine/objects/PlayerCharacter.java

@ -2841,11 +2841,11 @@ public class PlayerCharacter extends AbstractCharacter { @@ -2841,11 +2841,11 @@ public class PlayerCharacter extends AbstractCharacter {
if (ib != null) {
if ((item.template.item_type.equals(ItemType.WEAPON))
&& (ib.getSkillRequired().equals(type) || ib.getMastery().equals(type)))
&& (item.template.item_skill_used.equals(type) || ib.getMastery().equals(type)))
return true;
return (item.template.item_type.equals(ItemType.ARMOR))
&& (ib.getSkillRequired().equals(type));
&& (item.template.item_skill_used.equals(type));
}
return false;
@ -3919,7 +3919,7 @@ public class PlayerCharacter extends AbstractCharacter { @@ -3919,7 +3919,7 @@ public class PlayerCharacter extends AbstractCharacter {
this.rangeHandTwo *= range_bonus;
}
skillPercentage = getModifiedAmount(this.skills.get(wb.getSkillRequired()));
skillPercentage = getModifiedAmount(this.skills.get(weapon.template.item_skill_used));
masteryPercentage = getModifiedAmount(this.skills.get(wb.getMastery()));
if (masteryPercentage == 0f)
mastDam = 0f;
@ -4174,10 +4174,10 @@ public class PlayerCharacter extends AbstractCharacter { @@ -4174,10 +4174,10 @@ public class PlayerCharacter extends AbstractCharacter {
if (!armor.template.item_type.equals(ItemType.ARMOR))
return 0;
if (ib.getSkillRequired().isEmpty())
if (armor.template.item_skill_used.isEmpty())
return ib.getDefense();
CharacterSkill armorSkill = this.skills.get(ib.getSkillRequired());
CharacterSkill armorSkill = this.skills.get(armor.template.item_skill_used);
if (armorSkill == null) {
Logger.error("Player " + this.getObjectUUID()
+ " has armor equipped without the nescessary skill to equip it");
@ -4218,7 +4218,7 @@ public class PlayerCharacter extends AbstractCharacter { @@ -4218,7 +4218,7 @@ public class PlayerCharacter extends AbstractCharacter {
skill = this.skills.get("Unarmed Combat");
mastery = this.skills.get("Unarmed Combat Mastery");
} else {
skill = this.skills.get(wb.getSkillRequired());
skill = this.skills.get(weapon.template.item_skill_used);
mastery = this.skills.get(wb.getMastery());
}
if (skill != null)

Loading…
Cancel
Save