From e694848c0d1d98ed6dc400117bc5db2bae89dba8 Mon Sep 17 00:00:00 2001 From: 1 <1@72wo.cn> Date: Tue, 2 Dec 2025 02:50:20 +0000 Subject: [PATCH] =?UTF-8?q?fix(fight):=20=E4=BF=AE=E6=AD=A3=E7=A9=BA?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E5=AF=BC=E8=87=B4=E7=9A=84=E6=BD=9C=E5=9C=A8?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/controller/PET_FUSION.go | 7 ++++++- modules/blazing/service/pet_fusion_service.go | 13 +++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/logic/controller/PET_FUSION.go b/logic/controller/PET_FUSION.go index f613b587b..2eb2422ef 100644 --- a/logic/controller/PET_FUSION.go +++ b/logic/controller/PET_FUSION.go @@ -7,6 +7,8 @@ import ( "blazing/logic/service/player" "blazing/modules/blazing/model" "blazing/modules/blazing/service" + + "github.com/shopspring/decimal" ) func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result *pet.PetFusionInfo, err errorcode.ErrorCode) { @@ -50,7 +52,10 @@ func (h Controller) PetFusion(data *pet.C2S_PetFusion, c *player.Player) (result } effect := int(service.NewPetFusionMaterialService().Data(data.Item1)) - r := model.GenPetInfo(resid, -1, int(natureId), effect, -1, 1) + dv1 := decimal.NewFromInt(2).Div(decimal.NewFromInt(3)).Mul(decimal.NewFromInt(int64(Mcatchpetinfo.Dv))) + dv2 := decimal.NewFromInt(1).Div(decimal.NewFromInt(3)).Mul(decimal.NewFromInt(int64(Auxpetinfo.Dv))) + dv := dv1.Add(dv2).Add(decimal.NewFromInt(1)).IntPart() + r := model.GenPetInfo(resid, int(dv), int(natureId), effect, -1, 1) c.Service.Pet.PetAdd(*r) c.Pet_del(Auxpetinfo.CatchTime) c.Pet_del(Mcatchpetinfo.CatchTime) diff --git a/modules/blazing/service/pet_fusion_service.go b/modules/blazing/service/pet_fusion_service.go index 3626c668a..bd3466782 100644 --- a/modules/blazing/service/pet_fusion_service.go +++ b/modules/blazing/service/pet_fusion_service.go @@ -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 }