From 8cc9bfc2dbda55847bf1155258408396bfe54c35 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 7 Dec 2023 16:41:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E6=89=8B=E5=8F=AC=E5=94=A4=20?= =?UTF-8?q?=E9=9D=9E=E9=A6=96=E6=AC=A1=E5=8F=AC=E5=94=A4=E4=B8=8D=E6=89=A3?= =?UTF-8?q?=E9=81=93=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/api_drawCard.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 45973c08a..4e56edd32 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -117,6 +117,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq drawCount = heroRecord.Count[req.DrawType] // 获取当前阵容抽卡次数 if true { // 普通卡池抽卡 ////// 获取消耗 + if costRes, errdata = this.module.modelHero.CheckDrawCardRes(session, drawConf, req.Consume, req.DrawCount); errdata != nil { return } @@ -225,6 +226,9 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq } // 消耗道具 + if req.DrawType == 1 && heroRecord.Selectcount > 0 { // 新手抽 非第一次不消耗 + costRes = nil + } if errdata = this.module.ConsumeRes(session, costRes, true); errdata != nil { return } @@ -241,7 +245,6 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq update["baodi5"] = heroRecord.Baodi5 for _, heroId := range szCards { - //var var ( hero *pb.DBHero HeroConf *cfg.GameHeroData @@ -282,10 +285,6 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq var atno []*pb.UserAtno if req.DrawType == 1 { - heroRecord.Selectcount += 1 // 抽卡次数+1 - heroRecord.Cur = szCards - update["selectcount"] = heroRecord.Selectcount - update["cur"] = heroRecord.Cur if hero, atno, err = this.module.modelHero.imitateHero(session, heroId); err == nil { for _, v := range atno { @@ -319,6 +318,12 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq } } + if req.DrawType == 1 { + heroRecord.Selectcount += 1 // 抽卡次数+1 + heroRecord.Cur = szCards + update["selectcount"] = heroRecord.Selectcount + update["cur"] = heroRecord.Cur + } this.module.modelRecord.ChangeHeroRecord(session.GetUserId(), update) if req.DrawType != 1 {