Read armor resists from the cache template EnumMap
Resists.getArmorResists and NPCManager.applyEquipmentResists now read cacheTemplate.getCombatAttackResist() with DamageType keys instead of the legacy String-keyed map, and default a missing key to 0 instead of an unboxing NPE. Offline parity (scripts/p15a.py, all 7586 static_item_templates rows vs the template CObjectIndex.lookup picks): 0 differences in the full combat_attack_resist map. Every ITEM/DEED/RUNE template carries all 16 keys, so no value changes. No comparator added or removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b63826a7b7
commit
441a935bd9
2 files changed
+14
-6
No files matched your search
@@ -19,6 +19,7 @@ import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -159,13 +160,16 @@ public class Resists {
|
||||
|
||||
private static float[] getArmorResists(Item armor, float[] phys) {
|
||||
|
||||
EnumMap<mbEnums.DamageType, Float> armorResists;
|
||||
|
||||
if (armor == null)
|
||||
return phys;
|
||||
|
||||
if (armor.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.ARMOR)) {
|
||||
phys[0] += armor.template.combat_attack_resist.get("SLASHING");
|
||||
phys[1] += armor.template.combat_attack_resist.get("CRUSHING");
|
||||
phys[2] += armor.template.combat_attack_resist.get("PIERCING");
|
||||
armorResists = armor.template.cacheTemplate.getCombatAttackResist();
|
||||
phys[0] += armorResists.getOrDefault(mbEnums.DamageType.SLASHING, 0f);
|
||||
phys[1] += armorResists.getOrDefault(mbEnums.DamageType.CRUSHING, 0f);
|
||||
phys[2] += armorResists.getOrDefault(mbEnums.DamageType.PIERCING, 0f);
|
||||
}
|
||||
|
||||
return phys;
|
||||
|
||||
Reference in new issue
Block a user