fix(fight): 修正空变更导致的潜在逻辑问题
This commit is contained in:
@@ -46,14 +46,23 @@ func (s *PetFusionService) Data(p1, p2 uint32) uint32 {
|
||||
return uint32(v.ResultPetID)
|
||||
}
|
||||
}
|
||||
//说明是失败,直接返回失败
|
||||
if len(pet) > 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
var pets []model.PetFusion
|
||||
|
||||
m = cool.DBM(s.Model)
|
||||
m.Where("is_enable", 1).Where("is_default", 1).Scan(&pets)
|
||||
if len(pets) == 0 {
|
||||
return 0
|
||||
}
|
||||
res := pets[grand.Intn(len(pets)-1)]
|
||||
rr := grand.Intn(100)
|
||||
if rr < int(res.Probability) {
|
||||
return uint32(res.ResultPetID)
|
||||
}
|
||||
|
||||
return uint32(pets[grand.Intn(len(pets)-1)].ID)
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user