1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-02-13 01:39:53 +08:00
committed by cnb
parent 008aa97675
commit dca4d4ffca
2 changed files with 28 additions and 6 deletions

View File

@@ -45,7 +45,18 @@ func (s *EggService) Get() (out *model.Egg) {
}
func (s *EggService) StartBreed(m, f *model.PetInfo) bool {
if m.Gender != 1 {
return false
}
if f.Gender != 2 {
return false
}
if m.Generation > 9 {
return false
}
if f.Generation > 9 {
return false
}
var tt *model.Egg
s.TestModel(s.Model).Scan(&tt)
if tt == nil {
@@ -61,10 +72,8 @@ func (s *EggService) StartBreed(m, f *model.PetInfo) bool {
cureff.EggCatchTime = uint32(time.Now().Unix())
cureff.EggID = (uint32(m.Generation) + uint32(f.Generation)) / 2
if cureff.EggID == 0 {
cureff.EggID = 1
}
cureff.EggID = (uint32(m.Generation)+uint32(f.Generation))/2 + 1
cureff.OwnerID = uint32(s.userid)
cureff.FeMalePetID = f.ID