Obesity Stat Implementation

First sigmoid function!
This commit is contained in:
Rakeela Windrider 2023-04-05 12:29:23 -07:00
parent d66e17a279
commit de98cf8fb3

View File

@ -1,6 +1,8 @@
package koboldsim package koboldsim
import ( import (
"math"
"git.chromaticdragon.app/kistaro/CardSimEngine/cardsim" "git.chromaticdragon.app/kistaro/CardSimEngine/cardsim"
) )
@ -65,13 +67,17 @@ func (k *KoboldMine) StatTaxRate() float64 {
} }
func (k *KoboldMine) Kobolds() int64 { func (k *KoboldMine) Kobolds() int64 {
return int64(k.BasePopulation * k.FoodSupply) return int64(k.BasePopulation * k.FoodSupply * (1 - 0.5*(k.StatObesity()/100)))
} }
func (k *KoboldMine) DisplayedFoodSupply() float64 { func (k *KoboldMine) DisplayedFoodSupply() float64 {
return (k.FoodSupply - 1) * 100 return (k.FoodSupply - 1) * 100
} }
func (k *KoboldMine) StatObesity() float64 {
return 100 / (1 + math.Exp(-0.05*(k.DisplayedFoodSupply()-37)))
}
func (k *KoboldMine) Stats() []cardsim.Stat { func (k *KoboldMine) Stats() []cardsim.Stat {
stats := cardsim.ExtractStats(k) stats := cardsim.ExtractStats(k)
funcs := []cardsim.Stat{ funcs := []cardsim.Stat{