mirror of
https://github.com/prosolis/gogobee.git
synced 2026-07-15 00:32:40 +00:00
Coop: lock combat actions for the full duration of an active run
Players in a co-op were getting their combat action back every midnight reset and offered the dungeon option in the morning DM. Per spec they should be "off in the Co-op" and unable to also solo-grind dungeons. Fix at the DB layer (so all CanDoCombat() paths agree): - New helper lockCoopCombatActions() sets combat_actions_used=99 for any user in an active coop run. Called immediately after every resetAllAdvDailyActions() — at startup and at midnight. - Render layer: morning DM now shows "combat locked (in Co-op #N, day X/Y)" and replaces the dungeon section with an explanatory line pointing them at !coop status. Combat returns to normal automatically once the run completes/wipes — the next midnight reset finds status != 'active' and skips the lock. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -283,11 +283,26 @@ func renderAdvMorningDM(char *AdventureCharacter, equip map[EquipmentSlot]*AdvEq
|
||||
harvestMax++
|
||||
}
|
||||
combatLeft := combatMax - char.CombatActionsUsed
|
||||
if combatLeft < 0 {
|
||||
combatLeft = 0
|
||||
}
|
||||
harvestLeft := harvestMax - char.HarvestActionsUsed
|
||||
sb.WriteString(fmt.Sprintf("📋 **Actions:** %d/%d combat · %d/%d harvest\n\n", combatLeft, combatMax, harvestLeft, harvestMax))
|
||||
|
||||
// Co-op participants have combat locked for the duration of the run.
|
||||
coopRun, _ := loadCoopRunForUser(char.UserID)
|
||||
inCoop := coopRun != nil && coopRun.Status == "active"
|
||||
|
||||
if inCoop {
|
||||
sb.WriteString(fmt.Sprintf("📋 **Actions:** combat locked (in Co-op #%d, day %d/%d) · %d/%d harvest\n\n",
|
||||
coopRun.ID, coopRun.CurrentDay, coopRun.TotalDays, harvestLeft, harvestMax))
|
||||
} else {
|
||||
sb.WriteString(fmt.Sprintf("📋 **Actions:** %d/%d combat · %d/%d harvest\n\n", combatLeft, combatMax, harvestLeft, harvestMax))
|
||||
}
|
||||
|
||||
// Location choices
|
||||
if char.CanDoCombat(isHol) {
|
||||
if inCoop {
|
||||
sb.WriteString(fmt.Sprintf("**1️⃣ Dungeon:** _(off in the Co-op, no solo combat — `!coop status` for run state)_\n"))
|
||||
} else if char.CanDoCombat(isHol) {
|
||||
sb.WriteString("**1️⃣ Dungeon:**\n")
|
||||
for _, el := range advEligibleLocations(char, equip, AdvActivityDungeon, bonuses) {
|
||||
warn := ""
|
||||
|
||||
Reference in New Issue
Block a user