This commit is contained in:
liwei1dao 2023-12-20 14:11:17 +08:00
commit 02c5a0224b
5 changed files with 68 additions and 27 deletions

View File

@ -338,3 +338,18 @@ func (this *configureComp) getPassCheckCfg() (data *cfg.GamePassCheck, err error
} }
return return
} }
func (this *configureComp) GetInitGameConsumeSkill() (skill []int32) {
if v, err := this.GetConfigure(game_playerskill); err == nil {
if configure, ok := v.(*cfg.GamePlayerSkill); ok {
for _, v := range configure.GetDataList() {
if v.Number == 1 {
skill = append(skill, v.Key)
}
}
}
}
return
}

View File

@ -68,6 +68,10 @@ func (this *modelComp) getEntertainmList(uid string) (result *pb.DBXXLData, err
for _, v := range this.module.configure.GetInitGameConsumeHero() { for _, v := range this.module.configure.GetInitGameConsumeHero() {
result.Card[v] = 1 result.Card[v] = 1
} }
// 默认技能
for _, v := range this.module.configure.GetInitGameConsumeSkill() {
result.Skill[v] = 1
}
if dbModel == nil { if dbModel == nil {
err = this.Add(uid, result) err = this.Add(uid, result)
} else { } else {

View File

@ -250,7 +250,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
return return
} }
curPlayer.Skill[req.Itype] -= 1 curPlayer.Skill[req.Itype] -= 1
if errdata = this.UserCardSkill(curPlayer, req.Curid); errdata != nil { if errdata = this.UserCardSkill(curPlayer, color, req.Itype, req.Curid); errdata != nil {
return return
} }
this.module.model.modifyEntertainmList(session.GetUserId(), map[string]interface{}{ this.module.model.modifyEntertainmList(session.GetUserId(), map[string]interface{}{
@ -929,15 +929,19 @@ func (this *Room) ChangePower() {
} }
// 玩家释放技能 // 玩家释放技能
func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, curid int32) (errdata *pb.ErrorData) { func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, color int32, skillid int32, curid int32) (errdata *pb.ErrorData) {
var ( var (
curScore int32 // 该次操作的得分 curScore int32 // 该次操作的得分
oid1 int32 // 唯一id oid1 int32 // 唯一id
oid2 int32 oid2 int32
conf *cfg.GamePlayerSkillData
err error
szMap []*pb.MapData
) )
var szMap []*pb.MapData if curid >= int32(len(this.chessboard.Plat)) {
return
conf, err := this.module.configure.GetGameConsumeHero(curPlayer.Cardid) }
conf, err = this.module.configure.GetGamePlaySkill(skillid)
if err != nil { if err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_EntertainNoHeroSkill, Code: pb.ErrorCode_EntertainNoHeroSkill,
@ -945,27 +949,28 @@ func (this *Room) UserCardSkill(curPlayer *pb.PlayerData, curid int32) (errdata
} }
return return
} }
if curPlayer.Energy >= conf.Skillload {
curPlayer.Energy = 0 // 清零 if conf.Skilltype == 1 { // 技能类型为1
if _, m := this.chessboard.SkillUp(curid, 1, conf.Skilleffect, conf.Skillvalue, true); len(m) > 0 { szMap = this.chessboard.HitElem(color, curid)
szMap = append(szMap, m...) } else if conf.Skilltype == 2 {
} else { this.chessboard.SetIndelibilityPlat()
szMap = append(szMap, &pb.MapData{ szMap = append(szMap, &pb.MapData{
Data: this.chessboard.GetPalatData(), Data: this.chessboard.Plat,
}) })
} }
for _, v := range szMap { for _, v := range szMap { //
curScore += v.CurSocre curScore += v.CurSocre
curPlayer.Score += v.CurSocre if color == 1 {
v.CurSocre = curPlayer.Score this.player1.Score += v.CurSocre
} v.CurSocre = this.player1.Score
this.player1.Energy += v.CurEnergy
v.CurEnergy = this.player1.Energy
} else { } else {
errdata = &pb.ErrorData{ this.player2.Score += v.CurSocre
Code: pb.ErrorCode_EntertainNoEnergy, v.CurSocre = this.player2.Score
Title: pb.ErrorCode_EntertainNoEnergy.ToString(), this.player2.Energy += v.CurEnergy
v.CurEnergy = this.player2.Energy
} }
return
} }
this.NexPower = this.curPower this.NexPower = this.curPower

View File

@ -146,7 +146,7 @@ func (this *MapData) InitMap(module *Entertainment, iType int32) {
} }
this.SetIndelibilityPlat() this.SetIndelibilityPlat()
this.Plat = this.GetPalatData() // this.Plat = this.GetPalatData()
} }
// 交换之前先判断是不是特殊元素的交换 // 交换之前先判断是不是特殊元素的交换
@ -1073,6 +1073,7 @@ func (this *MapData) SetIndelibilityPlat() {
fmt.Printf("plat init\n") fmt.Printf("plat init\n")
this.CheckMap(0, false) this.CheckMap(0, false)
} }
this.Plat = this.GetPalatData()
} }
// 重新洗牌 // 重新洗牌
@ -1281,3 +1282,17 @@ func (this *MapData) SpecialElem(id int, s int32) (x map[int]struct{}) {
return return
} }
func (this *MapData) HitElem(color int32, curid int32) (szMap []*pb.MapData) {
this.Plat[curid] = &pb.GirdeData{}
if this.DropGirde() {
szMap = append(szMap, &pb.MapData{
Data: this.GetPalatData(),
CurSocre: 0,
CurEnergy: 0,
})
}
sz, _ := this.CheckMap(color, false)
szMap = append(szMap, sz...)
return
}

View File

@ -63,8 +63,10 @@ func (this *apiComp) Assisthero(session comm.IUserSession, req *pb.FriendAssisth
"assistHeroId": req.HeroObjId, "assistHeroId": req.HeroObjId,
"hero": hero, "hero": hero,
} }
if self.Received != 2 {
self.Received = 1 self.Received = 1
update["received"] = self.Received //设置可领取状态 update["received"] = self.Received //设置可领取状态
}
if err := this.module.modelFriend.Change(self.Uid, update); err != nil { if err := this.module.modelFriend.Change(self.Uid, update); err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{