summaryrefslogtreecommitdiff
path: root/stats/cards.go
blob: d4049f4db6c3116f03603f80535af2d7d0824a15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package stats

import (
	"sts2stats/model"
)

type CardChoice struct {
	RunStat
	model.PlayerStat
	RoomStat
	Card    string
	Upgrade int
	Picked  bool
}

func EnrichCardChoice(run model.Run, st RunStat) (result []any, err error) {
	for ia, act := range run.MapPointHistory {
		for i, floor := range act {
			for _, stat := range floor.PlayerStats {
				for _, choice := range stat.CardChoices {
					result = append(result, &CardChoice{
						RunStat:    st,
						Card:       choice.Card.Id,
						Upgrade:    choice.Card.CurrentUpgradeLevel,
						PlayerStat: stat.PlayerStat,
						RoomStat: RoomStat{
							Floor: i,
							Act:   ia + 1,
						},
						Picked: false,
					})
				}
			}
		}
	}
	return
}