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
}
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() {
result.Card[v] = 1
}
// 默认技能
for _, v := range this.module.configure.GetInitGameConsumeSkill() {
result.Skill[v] = 1
}
if dbModel == nil {
err = this.Add(uid, result)
} else {

View File

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

View File

@ -146,7 +146,7 @@ func (this *MapData) InitMap(module *Entertainment, iType int32) {
}
this.SetIndelibilityPlat()
this.Plat = this.GetPalatData()
// this.Plat = this.GetPalatData()
}
// 交换之前先判断是不是特殊元素的交换
@ -1073,6 +1073,7 @@ func (this *MapData) SetIndelibilityPlat() {
fmt.Printf("plat init\n")
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
}
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,
"hero": hero,
}
self.Received = 1
update["received"] = self.Received //设置可领取状态
if self.Received != 2 {
self.Received = 1
update["received"] = self.Received //设置可领取状态
}
if err := this.module.modelFriend.Change(self.Uid, update); err != nil {
errdata = &pb.ErrorData{