fix(D-01/A): V2 bind/collar resistance completely broken (CRITICAL)

PlayerEquipment.getCurrentBindResistance/setCurrentBindResistance and
getCurrentCollarResistance/setCurrentCollarResistance all checked
instanceof ItemBind/ItemCollar — V2 DataDrivenBondageItem silently
returned 0, making V2 items escapable in 1 struggle roll.

Fix: use instanceof IHasResistance which both V1 and V2 implement.

Also fix StruggleCollar.tighten() to read ResistanceComponent directly
for V2 collars instead of IHasResistance.getBaseResistance(entity)
which triggers the singleton MAX-scan across all equipped items.

Note: isItemLocked() dead code in StruggleState is a PRE-EXISTING bug
(x10 locked penalty never applied) — tracked for separate fix.
This commit is contained in:
NotEvil
2026-04-14 16:44:59 +02:00
parent eb7f06bfc8
commit b97bdf367e
2 changed files with 36 additions and 18 deletions

View File

@@ -320,10 +320,12 @@ public class PlayerEquipment {
player,
BodyRegionV2.ARMS
);
if (
stack.isEmpty() || !(stack.getItem() instanceof ItemBind bind)
) return 0;
return bind.getCurrentResistance(stack, player);
if (stack.isEmpty()) return 0;
// V1 and V2 both implement IHasResistance
if (stack.getItem() instanceof com.tiedup.remake.items.base.IHasResistance resistance) {
return resistance.getCurrentResistance(stack, player);
}
return 0;
}
/**
@@ -334,10 +336,11 @@ public class PlayerEquipment {
player,
BodyRegionV2.ARMS
);
if (
stack.isEmpty() || !(stack.getItem() instanceof ItemBind bind)
) return;
bind.setCurrentResistance(stack, resistance);
if (stack.isEmpty()) return;
// V1 and V2 both implement IHasResistance
if (stack.getItem() instanceof com.tiedup.remake.items.base.IHasResistance resistanceItem) {
resistanceItem.setCurrentResistance(stack, resistance);
}
}
/**
@@ -348,10 +351,12 @@ public class PlayerEquipment {
player,
BodyRegionV2.NECK
);
if (
stack.isEmpty() || !(stack.getItem() instanceof ItemCollar collar)
) return 0;
return collar.getCurrentResistance(stack, player);
if (stack.isEmpty()) return 0;
// V1 and V2 both implement IHasResistance
if (stack.getItem() instanceof com.tiedup.remake.items.base.IHasResistance resistance) {
return resistance.getCurrentResistance(stack, player);
}
return 0;
}
/**
@@ -362,10 +367,11 @@ public class PlayerEquipment {
player,
BodyRegionV2.NECK
);
if (
stack.isEmpty() || !(stack.getItem() instanceof ItemCollar collar)
) return;
collar.setCurrentResistance(stack, resistance);
if (stack.isEmpty()) return;
// V1 and V2 both implement IHasResistance
if (stack.getItem() instanceof com.tiedup.remake.items.base.IHasResistance resistanceItem) {
resistanceItem.setCurrentResistance(stack, resistance);
}
}
// ========== Helper Methods ==========