26 lines
441 B
Go
26 lines
441 B
Go
package level
|
|
|
|
import (
|
|
"git.tuxpa.in/a/card_id/common/game/table"
|
|
"lukechampine.com/frand"
|
|
)
|
|
|
|
type Level struct {
|
|
Name string
|
|
|
|
SelectionWeight float64
|
|
RewardTable *table.Table
|
|
SpecialTable *table.Table
|
|
SpecialChance float64
|
|
}
|
|
|
|
func (l *Level) RandomTable() *table.Table {
|
|
if l.SpecialChance == 0 {
|
|
return l.RewardTable
|
|
}
|
|
if l.SpecialChance > (frand.Float64() * 100) {
|
|
return l.SpecialTable
|
|
}
|
|
return l.RewardTable
|
|
}
|