Major stats upgrade.
StatLiteral: just emit a stat in the obvious way. Plus helper functions. Can also identify stats via struct tags, no more Stored type! Can also identify stat methods via name (with compatible types).
This commit is contained in:
		| @@ -11,6 +11,10 @@ type SmokeTestCollection struct { | ||||
| 	Turns  cardsim.Invisible[int] | ||||
|  | ||||
| 	Flavor cardsim.Stored[string] | ||||
|  | ||||
| 	Things       int     `cardsim:"stat"` | ||||
| 	MoreThings   int     `cardsim:"hidden"` | ||||
| 	FloatyThings float64 `cardsim:"round1"` | ||||
| } | ||||
|  | ||||
| func (c *SmokeTestCollection) Average() float64 { | ||||
| @@ -23,3 +27,7 @@ func (c *SmokeTestCollection) Stats() []cardsim.Stat { | ||||
| 	cardsim.SortStats(stats) | ||||
| 	return stats | ||||
| } | ||||
|  | ||||
| func (c *SmokeTestCollection) StatTotalThings() float64 { | ||||
| 	return float64(c.Things+c.MoreThings) + c.FloatyThings | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user