Browse Source

Update to skill_used logic

combat-2
MagicBot 8 months ago
parent
commit
eb621f184d
  1. 10
      src/engine/objects/AbstractCharacter.java

10
src/engine/objects/AbstractCharacter.java

@ -956,25 +956,23 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -956,25 +956,23 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
if (armor.template.item_skill_used.isEmpty())
return ib.item_defense_rating;
if(armor.template.item_skill_used.length() < 1){
return ib.item_defense_rating;
}
CharacterSkill armorSkill = playerCharacter.skills.get(armor.template.item_skill_used);
if (armorSkill == null) {
if (playerCharacter.getObjectType().equals(GameObjectType.PlayerCharacter) && armorSkill == null) {
Logger.error("Player " + playerCharacter.getObjectUUID()
+ " has armor equipped without the nescessary skill to equip it");
return ib.item_defense_rating;
}
float def = ib.item_defense_rating;
//apply item defense bonuses
if (armor != null) {
def += armor.getBonus(ModType.DR, SourceType.NONE);
def *= (1 + armor.getBonusPercent(ModType.DR, SourceType.NONE));
}
return (def * (1 + ((int) armorSkill.getModifiedAmount() / 50f)));
}

Loading…
Cancel
Save