体重结算
()
| 299 | |
| 300 | // 体重结算 |
| 301 | func (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 | // 整体数据结算 |
| 322 | func (inf *catInfo) settleOfData() catInfo { |