feature/d01-branch-e-resistance #10
@@ -149,6 +149,10 @@ public class PacketV2LockToggle {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear partial knife-cut progress and stale struggle resistance on unlock
|
||||
com.tiedup.remake.util.ItemNBTHelper.remove(stack, "knifeCutProgress");
|
||||
com.tiedup.remake.util.ItemNBTHelper.remove(stack, "accessoryStruggleResistance");
|
||||
|
||||
TiedUpMod.LOGGER.debug(
|
||||
"[V2LockToggle] Unlocked region {} on entity {}",
|
||||
region.name(),
|
||||
|
||||
@@ -84,7 +84,21 @@ public class PacketV2StruggleStart {
|
||||
if (stack.getItem() instanceof ILockable lockable) {
|
||||
isLocked = lockable.isLocked(stack);
|
||||
if (isLocked) {
|
||||
resistance += com.tiedup.remake.core.SettingsAccessor.getPadlockResistance(null);
|
||||
// Only add padlock bonus on FIRST session (fresh resistance = base).
|
||||
// If resistance was already decremented and persisted from a prior
|
||||
// interrupted session, the padlock bonus is already baked in.
|
||||
int baseResistance = resistance; // getCurrentResistance returns base if no NBT
|
||||
com.tiedup.remake.v2.bondage.component.ResistanceComponent comp =
|
||||
com.tiedup.remake.v2.bondage.datadriven.DataDrivenBondageItem.getComponent(
|
||||
stack, com.tiedup.remake.v2.bondage.component.ComponentType.RESISTANCE,
|
||||
com.tiedup.remake.v2.bondage.component.ResistanceComponent.class);
|
||||
if (comp != null) {
|
||||
baseResistance = comp.getBaseResistance();
|
||||
}
|
||||
if (resistance >= baseResistance) {
|
||||
// Fresh or fully restored — add padlock bonus
|
||||
resistance += com.tiedup.remake.core.SettingsAccessor.getPadlockResistance(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user