feature/d01-branch-e-resistance #10

Merged
NotEvil merged 3 commits from feature/d01-branch-e-resistance into develop 2026-04-15 01:45:59 +00:00
2 changed files with 19 additions and 1 deletions
Showing only changes of commit 36a1d63510 - Show all commits

View File

@@ -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(),

View File

@@ -84,9 +84,23 @@ public class PacketV2StruggleStart {
if (stack.getItem() instanceof ILockable lockable) {
isLocked = lockable.isLocked(stack);
if (isLocked) {
// 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);
}
}
}
// RISK-003 fix: no point starting a session with 0 resistance
if (resistance <= 0) return;