Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
52fbce426e
@ -14,6 +14,7 @@ import (
|
||||
const (
|
||||
game_block = "game_block.json"
|
||||
game_consumehero = "game_consumehero.json"
|
||||
game_integral = "game_integral.json"
|
||||
)
|
||||
|
||||
// /配置管理组件
|
||||
@ -31,6 +32,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
||||
this.module = module.(*Entertainment)
|
||||
err = this.LoadMultiConfigure(map[string]interface{}{
|
||||
game_consumehero: cfg.NewGameConsumeHero,
|
||||
// game_integral: cfg.NewGameInitial,
|
||||
})
|
||||
|
||||
configure.RegisterConfigure(game_block, cfg.NewGameBlock, this.LoadGameBlock)
|
||||
@ -90,3 +92,18 @@ func (this *configureComp) GetGameConsumeHero(heroid string) (conf *cfg.GameCons
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_consumehero, heroid)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetGameConsumeintegral(key int32) (conf *cfg.GameIntegralData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
)
|
||||
if v, err = this.GetConfigure(game_integral); err == nil {
|
||||
if configure, ok := v.(*cfg.GameIntegral); ok {
|
||||
if conf = configure.Get(key); conf != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
err = comm.NewNotFoundConfErr(moduleName, game_consumehero, key)
|
||||
return
|
||||
}
|
||||
|
@ -128,6 +128,11 @@ func (this *Room) AiOperator() {
|
||||
if this.NexPower != this.curPower {
|
||||
this.round++
|
||||
}
|
||||
for _, v := range szMap { //
|
||||
if v.Xgrid > 0 {
|
||||
this.player2.Energy += v.Xgrid
|
||||
}
|
||||
}
|
||||
|
||||
this.player2.Score += curScore
|
||||
// 广播消息
|
||||
@ -192,8 +197,18 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
||||
return
|
||||
}
|
||||
if this.player1.Energy >= conf.Skillload {
|
||||
this.player1.Energy = conf.Skillload // 清零
|
||||
curScore, szMap = this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue)
|
||||
this.player1.Energy = 0 // 清零
|
||||
|
||||
if score, m := this.chessboard.SkillUp(conf.Skilleffect, conf.Skillvalue); score > 0 {
|
||||
curScore += score
|
||||
szMap = append(szMap, m...)
|
||||
} else {
|
||||
szMap = append(szMap, &pb.MapData{
|
||||
Data: this.chessboard.GetPalatData(),
|
||||
})
|
||||
}
|
||||
this.player1.Score += curScore
|
||||
|
||||
} else {
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_EntertainNoEnergy,
|
||||
@ -264,7 +279,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr
|
||||
this.player1.Ps = MaxPs
|
||||
}
|
||||
for _, v := range szMap { //
|
||||
if v.Xgrid >= 4 {
|
||||
if v.Xgrid > 0 {
|
||||
if color == 1 {
|
||||
this.player1.Energy += v.Xgrid
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user