From de98cf8fb38fdc08a378146e4078df8aba469274 Mon Sep 17 00:00:00 2001 From: Rakeela Date: Wed, 5 Apr 2023 12:29:23 -0700 Subject: [PATCH] Obesity Stat Implementation First sigmoid function! --- koboldsim/stats.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/koboldsim/stats.go b/koboldsim/stats.go index 2ed99b3..e07da05 100644 --- a/koboldsim/stats.go +++ b/koboldsim/stats.go @@ -1,6 +1,8 @@ package koboldsim import ( + "math" + "git.chromaticdragon.app/kistaro/CardSimEngine/cardsim" ) @@ -65,13 +67,17 @@ func (k *KoboldMine) StatTaxRate() float64 { } 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 { 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 { stats := cardsim.ExtractStats(k) funcs := []cardsim.Stat{