32 lines
623 B
Go
32 lines
623 B
Go
package main
|
|
|
|
import (
|
|
"cardSimEngine/cardsim"
|
|
"math"
|
|
)
|
|
|
|
var (
|
|
updateTotal = cardsim.RuleFunc[*SmokeTestCollection]{
|
|
Name: "updateTotal",
|
|
Seq: 1,
|
|
F: func(p *cardsim.Player[*SmokeTestCollection]) error {
|
|
p.Stats.Total.Value += int64(p.Stats.Number.Value)
|
|
return nil
|
|
},
|
|
}
|
|
|
|
countTurn = cardsim.RuleFunc[*SmokeTestCollection]{
|
|
Name: "countTurn",
|
|
Seq: math.MinInt,
|
|
F: func(p *cardsim.Player[*SmokeTestCollection]) error {
|
|
p.Stats.Turns.Value++
|
|
return nil
|
|
},
|
|
}
|
|
)
|
|
|
|
func installRules(rules *cardsim.RuleCollection[*SmokeTestCollection]) {
|
|
rules.Insert(&updateTotal)
|
|
rules.Insert(&countTurn)
|
|
}
|