星级判断

This commit is contained in:
meixiongfeng 2023-01-13 18:55:04 +08:00
parent b242723fa5
commit 624a53324d
6 changed files with 16 additions and 19 deletions

View File

@ -705,8 +705,8 @@ const (
)
const (
MainStarType1 = 1 //成功通关
MainStarType2 = 1 //死亡人数不超过{0}人
MainStarType3 = 1 //不超过{0}回合通关
MainStarType2 = 2 //死亡人数不超过{0}人
MainStarType3 = 3 //不超过{0}回合通关
)
const (

View File

@ -73,14 +73,15 @@ func Test_Main(t *testing.T) {
var star1, star2, star3 int32
var rst int32
star1 = 1 << 2
star1 = 1 << 0
star2 = 1 << 1
star3 = 1 << 0
star3 = 1 << 2
//rst = star1 ^ star2 ^ star3 // 三星
//rst = star1 ^ star2 // 2星
rst ^= star1
rst ^= star2
rst ^= star2
// 校验星
b1 := (rst&star1 == star1)
b2 := (rst&star2 == star2)

View File

@ -78,23 +78,21 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall
code = pb.ErrorCode_ConfigNoFound
return
}
var star1, star2, star3 int32
star1 = 1 << 2
star2 = 1 << 1
star3 = 1 << 0
var szStar []int32
szStar = append(szStar, 1<<0)
szStar = append(szStar, 1<<1)
szStar = append(szStar, 1<<2)
for i, v := range stageConf.StarType {
if v == comm.MainStarType1 {
//star += stageConf.Star[i]
star ^= star1
star ^= szStar[i]
} else if v == comm.MainStarType2 {
if req.Report.Death <= stageConf.StarValue[i] {
//star += stageConf.Star[i]
star ^= star2
star ^= szStar[i]
}
} else if v == comm.MainStarType3 {
if req.Report.Round <= stageConf.StarValue[i] {
//star += stageConf.Star[i]
star ^= star3
star ^= szStar[i]
}
}
}

View File

@ -67,7 +67,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq)
code = pb.ErrorCode_ConfigNoFound
return
}
if int32(configure.Now().Unix()-trolltrain.RefreshTime) < szTrain[trolltrain.TarinPos-1] {
if configure.Now().Unix()-trolltrain.RefreshTime < int64(szTrain[trolltrain.TarinPos-1]) {
//session.SendMsg(string(this.module.GetType()), TrollGetListResp, &pb.TrollGetListResp{Data: trolltrain})
return
}

View File

@ -84,9 +84,9 @@ func (this *configureComp) GetTrollRule(id int32) int32 {
if configure, ok := v.(*cfg.GameTrollRule); ok {
return configure.Get(id).Quantity
}
} else {
log.Errorf("get GameTrollRuleData conf err:%v", err)
}
log.Errorf("get GetTrollRule conf err:%d", id)
return 1
}

View File

@ -146,9 +146,7 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain) (c
this.Errorf("玩家 uid:%s 金币不足,获得金币%d", session.GetUserId(), buyGold)
}
}
totalGold += buyGold
}
} else { // 超过当前时间
refreshTime -= int64(sz[index])