assignmentRotation impl

main
bel 2024-12-14 23:45:47 -07:00
parent 15118df95c
commit 6b3d4f0bc6
1 changed files with 20 additions and 8 deletions

View File

@ -78,9 +78,11 @@ type (
} }
KillWords struct { KillWords struct {
Global string Global string
Assigned time.Time
Assignee string Assigned time.Time
Assignee string
Assignment Assignment Assignment Assignment
} }
@ -99,10 +101,10 @@ type (
} }
EventGameComplete struct{} EventGameComplete struct{}
EventAssignmentRotation struct { EventAssignmentRotation struct {
Killer string Killer string
Killed string Killed string
KillWord string KillWord string
Assignments map[string]Assignment KillWords map[string]KillWords
} }
) )
@ -169,11 +171,21 @@ func (games Games) GameState(ctx context.Context, id string) (GameState, error)
result.Players[assignmentRotation.Killer] = killer result.Players[assignmentRotation.Killer] = killer
} }
for k, v := range result.Players {
v.KillWords = KillWords{}
result.Players[k] = v
}
for k, v := range assignmentRotation.KillWords {
player := result.Players[k]
player.KillWords = v
result.Players[k] = player
}
// TODO gather current assignees // TODO gather current assignees
// TODO get victim's target // TODO get victim's target
// TODO assign victim's target to killer // TODO assign victim's target to killer
// TODO randomize everyone else so not the same as before AND not self // TODO randomize everyone else so not the same as before AND not self
return fmt.Errorf("not impl: assignment rotation: %+v", assignmentRotation) return nil
default: default:
return fmt.Errorf("unknown event type %d: %s", peek.Type, payload) return fmt.Errorf("unknown event type %d: %s", peek.Type, payload)
} }