MCPcopy Create free account
hub / github.com/FloatTech/ZeroBot-Plugin-Playground / settleOfWeight

Method settleOfWeight

plugin/cybercat/keepcat.go:301–319  ·  view source on GitHub ↗

体重结算

()

Source from the content-addressed store, hash-verified

299
300// 体重结算
301func (inf *catInfo) settleOfWeight() catInfo {
302 if inf.Weight < 0 {
303 satiety := math.Min((-inf.Weight)*7, inf.Satiety)
304 inf.Weight += satiety
305 inf.Satiety -= satiety
306 }
307 switch {
308 case inf.Satiety > 100:
309 inf.Weight += (inf.Satiety - 50) / 100
310 case inf.Satiety < 0:
311 inf.Weight += inf.Satiety / 10
312 if inf.Weight < 0 {
313 needFood := math.Min(-inf.Weight*5, inf.Food)
314 inf.Food -= needFood
315 inf.Weight += needFood / 5
316 }
317 }
318 return *inf
319}
320
321// 整体数据结算
322func (inf *catInfo) settleOfData() catInfo {

Callers 1

initFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected