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 {
Global string
Assigned time.Time
Assignee string
Global string
Assigned time.Time
Assignee string
Assignment Assignment
}
@ -99,10 +101,10 @@ type (
}
EventGameComplete struct{}
EventAssignmentRotation struct {
Killer string
Killed string
KillWord string
Assignments map[string]Assignment
Killer string
Killed string
KillWord string
KillWords map[string]KillWords
}
)
@ -169,11 +171,21 @@ func (games Games) GameState(ctx context.Context, id string) (GameState, error)
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 get victim's target
// TODO assign victim's target to killer
// 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:
return fmt.Errorf("unknown event type %d: %s", peek.Type, payload)
}