feat: 增加宠物蛋结果计算和金币检查逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -35,7 +35,7 @@ func (s *EggService) GetData(p1 uint32) []int32 {
|
||||
return petIDs
|
||||
|
||||
}
|
||||
func (s *EggService) GetResult(m, f uint32) (uint32, bool) {
|
||||
func (s *EggService) GetResult(m, f, level uint32) (uint32, bool) {
|
||||
//cacheKey := strings.Join([]string{fmt.Sprintf("%d", p1), fmt.Sprintf("%d", p2)}, ":")
|
||||
md := dbm_enable(s.Model)
|
||||
|
||||
@@ -43,7 +43,7 @@ func (s *EggService) GetResult(m, f uint32) (uint32, bool) {
|
||||
md.Wheref(`male_pet_ids @> ARRAY[?]::integer[]`, m).
|
||||
Wheref(`female_pet_ids @> ARRAY[?]::integer[]`, f).Scan(&pet)
|
||||
if pet != nil {
|
||||
|
||||
pet.OutputMons[len(pet.OutputMons)-1] += int32(level)
|
||||
t, _ := utils.RandomByWeight(pet.OutputMons, pet.Probs)
|
||||
if pet.OutputMons[len(pet.OutputMons)-1] == int32(t) {
|
||||
return uint32(t), true
|
||||
|
||||
Reference in New Issue
Block a user