Null check for modelengine bmo

This commit is contained in:
Indyuce 2022-07-13 22:29:22 +02:00
parent fdbda8f7db
commit 3a9491f654

View File

@ -72,17 +72,18 @@ public class ElementalAttack {
public double getDamageModifier() { public double getDamageModifier() {
// Elemental defense // Elemental defense
for (ItemStack equip : target.getEquipment().getArmorContents()) { if (target.getEquipment() != null) // Null check for ModelEngine mobs
NBTItem nbtEquip = MythicLib.plugin.getVersion().getWrapper().getNBTItem(equip); for (ItemStack equip : target.getEquipment().getArmorContents()) {
if (nbtEquip.getType() != null) NBTItem nbtEquip = MythicLib.plugin.getVersion().getWrapper().getNBTItem(equip);
for (Element element : absolute.keySet()) { if (nbtEquip.getType() != null)
double defense = nbtEquip.getStat(element.name() + "_DEFENSE") / 100; for (Element element : absolute.keySet()) {
if (defense > 0) { double defense = nbtEquip.getStat(element.name() + "_DEFENSE") / 100;
relative.put(element, relative.get(element) * (1 - defense)); if (defense > 0) {
absolute.put(element, absolute.get(element) * (1 - defense)); relative.put(element, relative.get(element) * (1 - defense));
absolute.put(element, absolute.get(element) * (1 - defense));
}
} }
} }
}
// Elemental attacks // Elemental attacks
double correctionCoeff = 1; double correctionCoeff = 1;