mdbd/src/main/java/dev/loki/hook/Hook.java
loki5512344 89dc9eb00d feat(gameplay): implement hook sabotage, generator kick, jump listener, and boss bar UI
- Add HookSabotage system for survivors to disable hooks temporarily
- Add GeneratorKick killer ability to regress generator progress
- Add PlayerJumpListener to track survivor jump actions
- Add BossBarManager for displaying game state and objectives
- Update generator regression logic to support killer kick mechanic
- Update KillerController to integrate generator kick ability
- Update PlayerInteractListener to handle new interaction types
- Refactor game phases to use BossBarManager for UI updates
- Update .gitignore to exclude compiled bin/ directory
- Simplify PLAN.md documentation for easier maintenance
2026-06-04 12:11:04 +02:00

73 lines
2.3 KiB
Java

package dev.loki.hook;
import dev.loki.player.Survivor;
import org.bukkit.Location;
import java.util.UUID;
public class Hook {
private final UUID id;
private final Location location;
private Survivor hookedSurvivor;
private HookStage currentStage;
private int stageProgress;
private boolean occupied;
private boolean basement;
private boolean disabled; // саботирован выжившим
public Hook(UUID id, Location location, boolean basement) {
this.id = id;
this.location = location;
this.basement = basement;
this.currentStage = HookStage.STAGE_1;
this.stageProgress = 0;
this.occupied = false;
}
public void hookSurvivor(Survivor survivor) {
this.hookedSurvivor = survivor;
this.occupied = true;
this.currentStage = HookStage.STAGE_1;
this.stageProgress = 0;
}
public void unhookSurvivor() {
this.hookedSurvivor = null;
this.occupied = false;
this.currentStage = HookStage.STAGE_1;
this.stageProgress = 0;
}
public void tick() {
if (!occupied || hookedSurvivor == null) return;
stageProgress++;
int stageDuration = currentStage.getDurationSeconds() * 20;
if (stageProgress >= stageDuration && currentStage != HookStage.SACRIFICE) {
advanceStage();
}
}
private void advanceStage() {
currentStage = currentStage.next();
stageProgress = 0;
}
public double getStageProgressPercent() {
if (currentStage == HookStage.SACRIFICE) return 100;
int stageDuration = currentStage.getDurationSeconds() * 20;
return (double) stageProgress / stageDuration * 100;
}
public boolean isInStruggle() {
return currentStage == HookStage.STAGE_2;
}
public UUID getId() { return id; }
public Location getLocation() { return location; }
public Survivor getHookedSurvivor() { return hookedSurvivor; }
public HookStage getCurrentStage() { return currentStage; }
public boolean isOccupied() { return occupied; }
public boolean isBasement() { return basement; }
public boolean isDisabled() { return disabled; }
public void setDisabled(boolean disabled) { this.disabled = disabled; }
}