加新的战斗类型

This commit is contained in:
meixiongfeng 2022-12-19 18:14:34 +08:00
parent 1532308e51
commit f94b9d6117
4 changed files with 35 additions and 30 deletions

View File

@ -88,8 +88,8 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.EnchantBuyReq) (code
list.RecoveryTime = 0
}
addCount += req.Count
if amount+addCount > conf.VikingNum {
code = pb.ErrorCode_VikingBuyMaxCount
if amount+addCount > conf.EnchantbossMax {
code = pb.ErrorCode_EnchantBuyMaxCount
return
}
mapData["recoveryTime"] = list.RecoveryTime

View File

@ -56,7 +56,7 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.EnchantChallen
}
code, record := this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
Ptype: pb.PlayType_hunting,
Ptype: pb.PlayType_enchant,
Title: "",
Format: &pb.BattleFormation{
Leadpos: req.Leadpos,

View File

@ -3,6 +3,7 @@ package enchant
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"google.golang.org/protobuf/proto"
@ -21,7 +22,8 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Encha
func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantChallengeOverReq) (code pb.ErrorCode, data proto.Message) {
var (
mapData map[string]interface{}
bWin bool // 战斗是否胜利
bWin bool // 战斗是否胜利
score int32 // 通关获得分数
)
mapData = make(map[string]interface{}, 0)
// reward = make([]*cfg.Gameatn, 0)
@ -67,30 +69,29 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.EnchantCha
return
}
//amount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), costRes.T)) // 获取当前数量
amount := int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), costRes.T)) // 获取当前数量
// if amount < conf.EnchantNum {
// enchant.RecoveryTime = configure.Now().Unix()
// mapData["recoveryTime"] = enchant.RecoveryTime
// }
if amount < conf.EnchantbossMax { // 挑战卷 小于副本最大存储数的时候开始恢复
enchant.RecoveryTime = configure.Now().Unix()
mapData["recoveryTime"] = enchant.RecoveryTime
}
if bWin {
this.module.CheckRank(session.GetUserId(), req.BossType, enchant, req.Report, 0)
}
// 耗时校验 当前战斗胜利时间消耗小于之前刷新数据
enchant.Boss[req.BossType] = score // 获得的积分
// 发放通关随机奖励
// reward = this.module.configure.GetDropReward(cfgEnchant.) // 获取掉落奖励
// if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
// return
// }
// if newChallenge && bWin { // 新关卡挑战通过 发放首通奖励
// if code = this.module.DispenseRes(session, cfgEnchant.Firstprize, true); code != pb.ErrorCode_Success {
// return
// }
// enchant.Boss[req.BossType] += 1
// mapData["boss"] = enchant.Boss
for _, v := range cfgEnchant {
if score >= v.ScoreLow && score <= v.ScoreUp {
for _, v1 := range v.RewardDrop {
reward := this.module.configure.GetDropReward(v1) // 获取掉落奖励
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
return
}
}
}
}
// }
mapData["challengeTime"] = enchant.BossTime
mapData["boss"] = enchant.Boss
code = this.module.ModifyEnchantData(session.GetUserId(), mapData)

View File

@ -90,6 +90,7 @@ const (
PlayType_academy PlayType = 8 //联盟学院
PlayType_heroteaching PlayType = 9 //英雄教学
PlayType_combat PlayType = 10 //新关卡
PlayType_enchant PlayType = 11 // 附魔副本
)
// Enum value maps for PlayType.
@ -106,6 +107,7 @@ var (
8: "academy",
9: "heroteaching",
10: "combat",
11: "enchant",
}
PlayType_value = map[string]int32{
"null": 0,
@ -119,6 +121,7 @@ var (
"academy": 8,
"heroteaching": 9,
"combat": 10,
"enchant": 11,
}
)
@ -672,7 +675,7 @@ var file_battle_battle_db_proto_rawDesc = []byte{
0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x6e, 0x69, 0x6c, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x70,
0x76, 0x65, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x70, 0x76, 0x70, 0x10, 0x02, 0x12, 0x07, 0x0a,
0x03, 0x70, 0x76, 0x62, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x76, 0x65, 0x10, 0x04, 0x2a,
0x99, 0x01, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04,
0xa6, 0x01, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04,
0x6e, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69,
0x6e, 0x65, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x10, 0x02,
0x12, 0x09, 0x0a, 0x05, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x68,
@ -681,13 +684,14 @@ var file_battle_battle_db_proto_rawDesc = []byte{
0x61, 0x73, 0x79, 0x10, 0x06, 0x12, 0x09, 0x0a, 0x05, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x10, 0x07,
0x12, 0x0b, 0x0a, 0x07, 0x61, 0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x10, 0x08, 0x12, 0x10, 0x0a,
0x0c, 0x68, 0x65, 0x72, 0x6f, 0x74, 0x65, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x10, 0x09, 0x12,
0x0a, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x10, 0x0a, 0x2a, 0x1f, 0x0a, 0x0c, 0x42,
0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x69,
0x6e, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a, 0x0c,
0x44, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08, 0x0a, 0x04,
0x64, 0x72, 0x61, 0x77, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12,
0x08, 0x0a, 0x04, 0x62, 0x75, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x0a, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x10, 0x0a, 0x12, 0x0b, 0x0a, 0x07, 0x65,
0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x10, 0x0b, 0x2a, 0x1f, 0x0a, 0x0c, 0x42, 0x42, 0x61, 0x74,
0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x69, 0x6e, 0x10, 0x00,
0x12, 0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a, 0x0c, 0x44, 0x42, 0x42,
0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08, 0x0a, 0x04, 0x64, 0x72, 0x61,
0x77, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04,
0x62, 0x75, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (