This commit is contained in:
liwei1dao 2024-01-22 16:48:11 +08:00
commit 3f27c55ce1
14 changed files with 386 additions and 157 deletions

View File

@ -123801,7 +123801,7 @@
"skill1": 1,
"skill2": 1,
"skill3": 1,
"speed": 155,
"speed": 165,
"modelsize": 1
},
{

View File

@ -13431,7 +13431,7 @@
"icon": "",
"When": 16,
"FromCheck": "Target=3",
"TargetCheck": "Target=2,HasBuff=391000116,OverlayNum=25",
"TargetCheck": "Target=2,BuffTotalOverlayNumLess=391000116,OverlayNum=25",
"MainSkillCheck": "SkillPos=5",
"AfterSkillCheck": "",
"BuffCheck": "",
@ -13457,7 +13457,7 @@
"icon": "",
"When": 16,
"FromCheck": "Target=3",
"TargetCheck": "Target=2,HasBuff=391000123,OverlayNum=25",
"TargetCheck": "Target=2,BuffTotalOverlayNumLess=391000123,OverlayNum=25",
"MainSkillCheck": "SkillPos=5",
"AfterSkillCheck": "",
"BuffCheck": "",
@ -13483,7 +13483,7 @@
"icon": "",
"When": 16,
"FromCheck": "Target=3",
"TargetCheck": "Target=2,HasBuff=391000127,OverlayNum=25",
"TargetCheck": "Target=2,BuffTotalOverlayNumLess=391000127,OverlayNum=25",
"MainSkillCheck": "SkillPos=5",
"AfterSkillCheck": "",
"BuffCheck": "",

View File

@ -471,7 +471,7 @@ func (this *MapData) CheckMap(color int32, bSkill bool) (szMap []*pb.MapData, xc
energy int32
new map[int]int
x map[int]struct{}
s map[int]int
//s map[int]int
)
for {
@ -480,83 +480,62 @@ func (this *MapData) CheckMap(color int32, bSkill bool) (szMap []*pb.MapData, xc
tXiaochu = make(map[int]struct{})
curScore = 0
energy = 0
s = make(map[int]int)
//s = make(map[int]int)
for i := 1; i <= 6; i++ {
tXiaochu, s = this.CheckElem(int32(i))
xc, s := this.CheckElem(int32(i))
for k, v := range s {
new[k] = v
}
// if bEliminate, xiaochu, s := this.Check5X(); bEliminate {
// for _, v := range xiaochu {
// tXiaochu[v] = struct{}{}
// }
// for k, v := range s {
// new[k] = v
// }
// xc = true // 只要有 4x 5x 就标记ture
// }
// if bEliminate, xiaochu, s := this.Check4X(); bEliminate {
// for _, v := range xiaochu {
// tXiaochu[v] = struct{}{}
// }
// for k, v := range s {
// new[k] = v
// }
// xc = true // 只要有 4x 5x 就标记ture
// }
// if bEliminate, xiaochu := this.Check3X(); bEliminate {
// for _, v := range xiaochu {
// tXiaochu[v] = struct{}{}
// }
// }
for id := range tXiaochu {
if _, ok := new[id]; ok {
if this.Plat[id].Color == color {
energy++
for _, v := range xc {
for _, v1 := range v {
tXiaochu[v1] = struct{}{}
}
}
}
for id := range tXiaochu {
if _, ok := new[id]; ok {
if this.Plat[id].Color == color {
energy++
}
curScore += this.Plat[id].Score
this.oid++ // 生成一个新的类型元素
if this.module == nil { // 稍后删掉 方便测试
this.Plat[id] = &pb.GirdeData{
Oid: this.oid,
Color: this.Plat[id].Color,
Cid: 2*(this.Plat[id].Color-1) + 6 + int32(new[id]),
Score: 1,
Special: int32(new[id]),
}
curScore += this.Plat[id].Score
this.oid++ // 生成一个新的类型元素
if this.module == nil { // 稍后删掉 方便测试
} else {
if s := this.Plat[id].Special; s != 0 {
for key := range this.SpecialElem(id, s) {
x[key] = struct{}{}
}
x[id] = struct{}{}
}
if conf, err := this.module.configure.GetGameBlock(this.Plat[id].Color, int32(new[id])); err == nil {
this.Plat[id] = &pb.GirdeData{
Oid: this.oid,
Color: this.Plat[id].Color,
Cid: 2*(this.Plat[id].Color-1) + 6 + int32(new[id]),
Score: 1,
Special: int32(new[id]),
}
} else {
if s := this.Plat[id].Special; s != 0 {
for key := range this.SpecialElem(id, s) {
x[key] = struct{}{}
}
x[id] = struct{}{}
}
if conf, err := this.module.configure.GetGameBlock(this.Plat[id].Color, int32(new[id])); err == nil {
this.Plat[id] = &pb.GirdeData{
Oid: this.oid,
Color: this.Plat[id].Color,
Cid: conf.Key,
Score: conf.Score,
Special: conf.Type,
}
Cid: conf.Key,
Score: conf.Score,
Special: conf.Type,
}
}
continue
}
if s := this.Plat[id].Special; s != 0 {
for key := range this.SpecialElem(id, s) {
x[key] = struct{}{}
}
}
x[id] = struct{}{}
continue
}
if s := this.Plat[id].Special; s != 0 {
for key := range this.SpecialElem(id, s) {
x[key] = struct{}{}
}
}
x[id] = struct{}{}
}
for id := range x {
if this.Plat[id].Color == color {
energy++
@ -1436,13 +1415,12 @@ func (this *MapData) checkSp(e []int) (oid int32) {
}
// 检测一个元素
func (this *MapData) CheckElem(color int32) (mtmp map[int]struct{}, sp map[int]int) {
func (this *MapData) CheckElem(color int32) (xc [][]int, sp map[int]int) {
var (
w [14][]int32
s1 [][]int // heng
s2 [][]int // shu
)
mtmp = make(map[int]struct{}, 0)
sp = make(map[int]int)
for pos, v := range this.Plat {
x := pos / Width
@ -1478,7 +1456,6 @@ func (this *MapData) CheckElem(color int32) (mtmp map[int]struct{}, sp map[int]i
s = append(s, (i-7)*7+j+3)
s = append(s, (i-7)*7+j+4)
s1 = append(s1, s)
sp[(i-7)*7+j+2] = FiveType
} else {
s = append(s, (j)*7+i)
s = append(s, (j+1)*7+i)
@ -1486,7 +1463,6 @@ func (this *MapData) CheckElem(color int32) (mtmp map[int]struct{}, sp map[int]i
s = append(s, (j+3)*7+i)
s = append(s, (j+4)*7+i)
s2 = append(s2, s)
sp[(j+2)*7+i] = FiveType
}
break
@ -1502,24 +1478,18 @@ func (this *MapData) CheckElem(color int32) (mtmp map[int]struct{}, sp map[int]i
s = append(s, (i-7)*7+j+2)
s = append(s, (i-7)*7+j+3)
s1 = append(s1, s)
oid := this.checkSp(s)
if 0 < oid {
sp[int(oid)] = FourUType
} else {
sp[(i-7)*7+j+1] = FourUType
}
} else {
s = append(s, (j)*7+i)
s = append(s, (j+1)*7+i)
s = append(s, (j+2)*7+i)
s = append(s, (j+3)*7+i)
s2 = append(s2, s)
oid := this.checkSp(s)
if 0 < oid {
sp[int(oid)] = FourLType
} else {
sp[(j+1)*7+i] = FourLType
}
//oid := this.checkSp(s)
// if 0 < oid {
// sp[int(oid)] = FourLType
// } else {
// sp[(j+1)*7+i] = FourLType
// }
}
break
}
@ -1547,56 +1517,67 @@ func (this *MapData) CheckElem(color int32) (mtmp map[int]struct{}, sp map[int]i
}
for _, v := range s1 {
for _, vs1 := range v {
t := CheckInSlice(vs1, s2) // 横竖相交
if len(t) > 0 {
for _, vs1 := range v {
t[vs1] = struct{}{}
}
for k := range t {
mtmp[k] = struct{}{}
}
if len(t) >= 5 {
sp[vs1] = FiveType
t, xj, new := CheckInSlice(v, s2) // 横竖相交
if len(t) > 0 {
xc = append(xc, t)
sp[xj] = FiveType
s2 = new[0:][0:]
} else {
if len(v) >= 5 {
sp[v[len(v)/2]] = FiveType
} else if len(v) >= 4 {
oid := this.checkSp(v)
if 0 < oid {
sp[int(oid)] = FourUType
} else {
sp[v[len(v)/2]] = FourUType
}
}
xc = append(xc, v)
}
}
for _, v := range s2 {
if len(v) >= 5 {
sp[v[len(v)/2]] = FiveType
} else if len(v) >= 4 {
oid := this.checkSp(v)
if 0 < oid {
sp[int(oid)] = FourLType
} else {
sp[v[len(v)/2]] = FourLType
}
}
xc = append(xc, v)
}
return
}
for k := range t {
mtmp[k] = struct{}{}
}
func CheckInSlice(s []int, sz [][]int) (si []int, xj int, newMatrix [][]int) {
newMatrix = make([][]int, len(sz))
for i := 0; i < len(sz); i++ {
newMatrix[i] = make([]int, len(sz[0]))
}
copy(newMatrix, sz)
for _, index := range s {
for pos, v := range sz {
bfound := false
for _, vs2 := range v {
if index == vs2 {
bfound = true
xj = index // 相交的点
si = append(si, v...)
si = append(si, s...)
break
}
}
if bfound {
newMatrix = append(newMatrix[:pos], newMatrix[pos+1:]...)
break
}
}
}
for _, v := range s1 {
for _, v1 := range v {
mtmp[v1] = struct{}{}
}
}
for _, v := range s2 {
for _, v1 := range v {
mtmp[v1] = struct{}{}
}
}
return
}
func CheckInSlice(index int, sz [][]int) (m map[int]struct{}) {
m = make(map[int]struct{})
for _, v := range sz {
b := false
for _, vs2 := range v {
if index == vs2 {
b = true
for _, t := range v {
m[t] = struct{}{}
}
}
}
if b {
break
}
}
return
}

View File

@ -48,13 +48,13 @@ func (this *apiComp) GetAssistHero(session comm.IUserSession, req *pb.FriendGetA
}
}
leftCount = int32(comm.AssistHeroCount - len(list.Data))
// localNum, _ := this.module.modelFriend.DB.CountDocuments(core.SqlTable(this.module.modelFriend.TableName), bson.M{})
// randomIndex := comm.GetRandNum(0, int32(localNum))
//localNum, _ := this.module.modelFriend.DB.CountDocuments(core.SqlTable(this.module.modelFriend.TableName), bson.M{})
//randomIndex := comm.GetRandNum(0, int32(localNum))
cur, err := this.module.modelFriend.DB.Find(core.SqlTable(this.module.modelFriend.TableName), bson.M{"assistHeroId": bson.M{"$ne": ""}}, options.Find().SetSkip(int64(0)).SetLimit(int64(leftCount))) //.skip(1).limit(1)
for cur.Next(context.TODO()) {
tmp := &pb.DBFriend{}
if err = cur.Decode(tmp); err == nil {
if session.GetUserId() != tmp.Uid {
if session.GetUserId() != tmp.Uid && tmp.Info != nil {
list.Data[tmp.Uid] = tmp.Info.Name
heros = append(heros, tmp.Hero)
}
@ -85,9 +85,12 @@ func (this *apiComp) GetAssistHero(session comm.IUserSession, req *pb.FriendGetA
for cur.Next(context.TODO()) {
tmp := &pb.DBFriend{}
if err = cur.Decode(tmp); err == nil {
if session.GetUserId() != tmp.Uid {
list.Data[tmp.Uid] = tmp.Info.Name
heros = append(heros, tmp.Hero)
if session.GetUserId() != tmp.Uid && tmp.Info != nil {
if tmp.Info != nil {
list.Data[tmp.Uid] = tmp.Info.Name
heros = append(heros, tmp.Hero)
}
}
}
}

View File

@ -86,7 +86,7 @@ func (this *apiComp) RefreshAssistHero(session comm.IUserSession, req *pb.Friend
for cur.Next(context.TODO()) {
tmp := &pb.DBFriend{}
if err = cur.Decode(tmp); err == nil {
if session.GetUserId() != tmp.Uid {
if session.GetUserId() != tmp.Uid && tmp.Info != nil {
if int32(len(list.Data)) >= strangerCount {
break
}

View File

@ -72,6 +72,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
if len(awakenData.Phasebonus) > 0 {
this.module.modelHero.resetJuexingProperty(_hero)
this.module.modelHero.calFigthValue(_hero)
}
// 校验 有没有技能
if awakenData.Skill != 0 {
@ -84,6 +85,7 @@ func (this *apiComp) Awaken(session comm.IUserSession, req *pb.HeroAwakenReq) (e
}
_heroMap["juexingLv"] = _hero.JuexingLv
_heroMap["juexProperty"] = _hero.JuexProperty
_heroMap["fightvalue"] = _hero.Fightvalue
// 保存数据
err = this.module.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap)
if err != nil {

View File

@ -27,6 +27,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
_hero *pb.DBHero // 操作的英雄
cost []*cfg.Gameatn // 技能升级消耗
lvUpCount int32 // 技能升级的次数
//skillValue int32 // 战斗力
)
if errdata = this.StrengthenUpSkillCheck(session, req); errdata != nil {
return
@ -105,9 +106,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
if errdata = this.module.ConsumeRes(session, cost, true); errdata != nil {
return
}
this.module.modelHero.calFigthValue(_hero)
_heroMap := map[string]interface{}{
"normalSkill": _hero.NormalSkill,
"fightvalue": _hero.Fightvalue,
}
err = this.module.modelHero.ChangeList(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息
if err != nil {

View File

@ -78,6 +78,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr
"property": _hero.Property,
"juexProperty": _hero.JuexProperty,
"horoscopeProperty": _hero.HoroscopeProperty,
"fightvalue": _hero.Fightvalue,
}
// 保存数据

View File

@ -179,6 +179,7 @@ func (this *apiComp) TalentLearn(session comm.IUserSession, req *pb.HeroTalentLe
// 同步修改属性
this.module.modelHero.setTalentProperty(hero, talentConf)
chanegCard = append(chanegCard, hero) // 添加推送属性变化信息
session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard})

View File

@ -43,6 +43,12 @@ const (
draw_reward = "game_drawreward.json" //新手招募奖励
game_herolevelupreward = "game_herolevelupreward.json" //英雄升级奖励
// 战力相关配置读取
game_fightingcapacity = "game_fightingcapacity.json"
game_fightingskill = "game_fightingskill.json"
game_fightingskilllv = "game_fightingskilllv.json"
game_fightingskillstar = "game_fightingskillstar.json"
)
type CondData struct {
@ -94,7 +100,12 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
draw_reward: cfg.NewGamedrawReward,
game_herolevelupreward: cfg.NewGameHeroLevelupreward,
//hero_cardweight: cfg.NewGameDrawWeight,
game_fightingcapacity: cfg.NewGameFightingCapacity,
game_fightingskill: cfg.NewGameFightingSkill,
game_fightingskilllv: cfg.NewGameFightingSkilllv,
game_fightingskillstar: cfg.NewGameFightingSkillStar,
})
//this.drawCardCfg = make(map[string]map[int32][]*cfg.GameDrawCardData, 0)
//configure.RegisterConfigure(hero_drawcard, cfg.NewGameDrawCard, this.SetHeroDrawConfig)
this.awakenMap = make(map[int64]*cfg.GameHeroAwakenData, 0)
@ -604,3 +615,79 @@ func (this *configureComp) GetHeroLvUpWardData(star int32, lv int32) (conf *cfg.
err = fmt.Errorf("no found")
return
}
// 转map 类型 方便计算
func (this *configureComp) GetGameFightingCapacityData() (m map[int32]int32) {
var (
v interface{}
err error
)
m = make(map[int32]int32)
if v, err = this.GetConfigure(game_fightingcapacity); err == nil {
if confg, ok := v.(*cfg.GameFightingCapacity); ok {
for _, v1 := range confg.GetDataList() {
m[v1.Id] = v1.Value
}
}
}
return
}
func (this *configureComp) GetGameFightingCapacity(id int32) (conf *cfg.GameFightingCapacityData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_fightingcapacity); err == nil {
if confg, ok := v.(*cfg.GameFightingCapacity); ok {
if conf = confg.Get(id); conf != nil {
return
}
}
}
err = comm.NewNotFoundConfErr(moduleName, game_fightingcapacity, id)
return
}
func (this *configureComp) GetGameFightingSkill(lv int32) (conf *cfg.GameFightingSkillData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_fightingskill); err == nil {
if confg, ok := v.(*cfg.GameFightingSkill); ok {
if conf = confg.Get(lv); conf != nil {
return
}
}
}
err = comm.NewNotFoundConfErr(moduleName, game_fightingskill, lv)
return
}
func (this *configureComp) GetGameFightingSkilllv(skillId int32) (conf *cfg.GameFightingSkilllvData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_fightingskilllv); err == nil {
if confg, ok := v.(*cfg.GameFightingSkilllv); ok {
if conf = confg.Get(skillId); conf != nil {
return
}
}
}
err = comm.NewNotFoundConfErr(moduleName, game_fightingskill, skillId)
return
}
func (this *configureComp) GetGameFightingSkillStar(star int32) (conf *cfg.GameFightingSkillStarData, err error) {
var (
v interface{}
)
if v, err = this.GetConfigure(game_fightingskillstar); err == nil {
if confg, ok := v.(*cfg.GameFightingSkillStar); ok {
if conf = confg.Get(star); conf != nil {
return
}
}
}
err = comm.NewNotFoundConfErr(moduleName, game_fightingskill, star)
return
}

View File

@ -37,6 +37,153 @@ func (this *ModelHero) Init(service core.IService, module core.IModule, comp cor
return
}
// 计算英雄战力
func (this *ModelHero) calFigthValue(hero *pb.DBHero) (addValue int32, err error) {
var (
skillValue int32 // 技能战力
baseValue int32 // 基础战力
heroCfg *cfg.GameHeroData //英雄配置
tmpHero *pb.DBHero
preValue int32
skillpos *cfg.GameFightingSkilllvData
skilllv *cfg.GameFightingSkilllvData
skillStar *cfg.GameFightingSkillStarData
)
tmpHero = new(pb.DBHero)
*tmpHero = *hero // 克隆一个对象
preValue = hero.Fightvalue
if heroCfg, err = this.module.configure.GetHeroConfig(tmpHero.HeroID); err != nil {
return
}
for k, v := range tmpHero.Property {
switch k {
case cfg.GamePropertyType_Base_MaxHp_Per:
tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Per] = 0
tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
case cfg.GamePropertyType_Base_Atk_Per:
tmpHero.Property[cfg.GamePropertyType_Base_Atk_Per] = 0
tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base])))
case cfg.GamePropertyType_Base_Def_Per:
tmpHero.Property[cfg.GamePropertyType_Base_Def_Per] = 0
tmpHero.Property[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base])))
case cfg.GamePropertyType_Base_Speed_Per:
tmpHero.Property[cfg.GamePropertyType_Base_Speed_Per] = 0
tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base])))
}
}
for k, v := range tmpHero.AddProperty {
switch k {
case cfg.GamePropertyType_Base_MaxHp_Per:
tmpHero.AddProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
tmpHero.AddProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
case cfg.GamePropertyType_Base_Atk_Per:
tmpHero.AddProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
tmpHero.AddProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base])))
case cfg.GamePropertyType_Base_Def_Per:
tmpHero.AddProperty[cfg.GamePropertyType_Base_Def_Per] = 0
tmpHero.AddProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base])))
case cfg.GamePropertyType_Base_Speed_Per:
tmpHero.AddProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
tmpHero.AddProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base])))
}
}
for k, v := range tmpHero.JuexProperty {
switch k {
case cfg.GamePropertyType_Base_MaxHp_Per:
tmpHero.JuexProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
tmpHero.JuexProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
case cfg.GamePropertyType_Base_Atk_Per:
tmpHero.JuexProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
tmpHero.JuexProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base])))
case cfg.GamePropertyType_Base_Def_Per:
tmpHero.JuexProperty[cfg.GamePropertyType_Base_Def_Per] = 0
tmpHero.JuexProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base])))
case cfg.GamePropertyType_Base_Speed_Per:
tmpHero.JuexProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
tmpHero.JuexProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base])))
}
}
for k, v := range tmpHero.HoroscopeProperty {
switch k {
case cfg.GamePropertyType_Base_MaxHp_Per:
tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
case cfg.GamePropertyType_Base_Atk_Per:
tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base])))
case cfg.GamePropertyType_Base_Def_Per:
tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Def_Per] = 0
tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base])))
case cfg.GamePropertyType_Base_Speed_Per:
tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
tmpHero.HoroscopeProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base])))
}
}
for k, v := range tmpHero.TalentProperty {
switch k {
case cfg.GamePropertyType_Base_MaxHp_Per:
tmpHero.TalentProperty[cfg.GamePropertyType_Base_MaxHp_Per] = 0
tmpHero.TalentProperty[cfg.GamePropertyType_Base_MaxHp_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_MaxHp_Base])))
case cfg.GamePropertyType_Base_Atk_Per:
tmpHero.TalentProperty[cfg.GamePropertyType_Base_Atk_Per] = 0
tmpHero.TalentProperty[cfg.GamePropertyType_Base_Atk_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Atk_Base])))
case cfg.GamePropertyType_Base_Def_Per:
tmpHero.TalentProperty[cfg.GamePropertyType_Base_Def_Per] = 0
tmpHero.TalentProperty[cfg.GamePropertyType_Base_Def_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Def_Base])))
case cfg.GamePropertyType_Base_Speed_Per:
tmpHero.TalentProperty[cfg.GamePropertyType_Base_Speed_Per] = 0
tmpHero.TalentProperty[cfg.GamePropertyType_Base_Speed_Base] += int32(math.Floor((float64(v) / 1000) * float64(tmpHero.Property[cfg.GamePropertyType_Base_Speed_Base])))
}
}
// 属性汇总
for k, v := range tmpHero.TalentProperty {
tmpHero.Property[k] += v
}
for k, v := range tmpHero.HoroscopeProperty {
tmpHero.Property[k] += v
}
for k, v := range tmpHero.JuexProperty {
tmpHero.Property[k] += v
}
for k, v := range tmpHero.AddProperty {
tmpHero.Property[k] += v
}
// 算基础属性
for k, v := range this.module.configure.GetGameFightingCapacityData() {
if _, ok := tmpHero.Property[k]; ok {
baseValue += tmpHero.Property[k] * v / 1000
}
}
for pos, v := range tmpHero.NormalSkill {
if skillpos, err = this.module.configure.GetGameFightingSkilllv(int32(pos + 1)); err == nil {
if skilllv, err = this.module.configure.GetGameFightingSkilllv(v.SkillLv); err == nil {
skillValue += skillpos.Value * skilllv.Value / 1000
} else {
return
}
} else {
return
}
}
// 乘以星级系数
if skillStar, err = this.module.configure.GetGameFightingSkillStar(heroCfg.Star); err == nil {
skillValue = skillValue * skillStar.Value / 1000
}
hero.Fightvalue = skillValue + baseValue
addValue = hero.Fightvalue - preValue
return
}
//17
// 初始化英雄
func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero {
@ -64,8 +211,9 @@ func (this *ModelHero) InitHero(uid string, heroCfgId string) *pb.DBHero {
HoroscopeProperty: make(map[int32]int32),
Fetters: make(map[int32]int32),
}
this.PropertyCompute(newHero)
this.initHeroSkill(newHero)
this.PropertyCompute(newHero)
return newHero
}
@ -216,6 +364,7 @@ func (this *ModelHero) resetJuexingProperty(hero *pb.DBHero) {
}
}
}
}
// 设置装备属性
@ -340,7 +489,7 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
starLvfg := this.module.configure.GetHeroLv(starCfg.Level)
if growCfg == nil || heroCfg == nil || lvCfg == nil || starCfg == nil || starLvfg == nil {
this.module.Debugf("hero PropertyCompute Configure Info err:heroid :%s, herolv:=%d,heroStar:%d,", hero.HeroID, hero.Lv, hero.Star)
this.module.Debugf("hero propertyCompute Configure Info err:heroid :%s, herolv:=%d,heroStar:%d,", hero.HeroID, hero.Lv, hero.Star)
return
}
@ -371,24 +520,7 @@ func (this *ModelHero) PropertyCompute(hero *pb.DBHero) {
this.module.moduleHoroscope.ComputeHeroNumeric(hero.Uid, hero)
}
this.resetJuexingProperty(hero)
}
// 重新计算英雄属性
func (this *ModelHero) ChangeHeroProperty(session comm.IUserSession, hero *pb.DBHero) (err error) {
this.PropertyCompute(hero) //重新计算 property 的值
update := map[string]interface{}{
"property": hero.Property,
"talentProperty": hero.TalentProperty,
"juexProperty": hero.JuexProperty,
"horoscopeProperty": hero.HoroscopeProperty,
}
if err = this.ChangeList(session.GetUserId(), hero.Id, update); err != nil {
this.module.Errorf("ChangeHeroProperty err:%v", err)
return
}
return
this.calFigthValue(hero)
}
func (this *ModelHero) cleanData(uid string) {
@ -534,6 +666,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, heros []*pb.DBHero,
update["horoscopeProperty"] = hero.HoroscopeProperty
update["talentProperty"] = hero.TalentProperty
update["juexProperty"] = hero.JuexProperty
update["fightvalue"] = hero.Fightvalue
}
changeupdate[hero.Id] = update
@ -675,8 +808,8 @@ func (this *ModelHero) InitMonsterHero(heroCfgId string, star, lv int32) *pb.DBH
TalentProperty: make(map[int32]int32),
HoroscopeProperty: make(map[int32]int32),
}
this.PropertyCompute(newHero)
this.initHeroSkill(newHero)
this.PropertyCompute(newHero)
return newHero
}
@ -695,6 +828,8 @@ func (this *ModelHero) setTalentProperty(hero *pb.DBHero, conf *cfg.GameHeroTale
_heroMap := make(map[string]interface{}, 0)
_heroMap["talentProperty"] = hero.TalentProperty
this.module.modelHero.calFigthValue(hero)
_heroMap["fightvalue"] = hero.Fightvalue
if err := this.ChangeList(hero.Uid, hero.Id, _heroMap); err != nil {
this.module.Errorf("mergeenegryProperty err %v", err)
}

View File

@ -523,6 +523,7 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (errdata *pb.ErrorDat
"juexProperty": hero.JuexProperty,
"awakenskill": hero.Awakenskill,
"talentskill": hero.Talentskill,
"fightvalue": hero.Fightvalue,
}
// 保存数据

View File

@ -100,6 +100,7 @@ type DBHero struct {
Ispasson bool `protobuf:"varint,27,opt,name=ispasson,proto3" json:"ispasson"` //是否是传功学员
Awakenskill []*SkillData `protobuf:"bytes,28,rep,name=awakenskill,proto3" json:"awakenskill"` // 觉醒技能
Talentskill []*SkillData `protobuf:"bytes,29,rep,name=talentskill,proto3" json:"talentskill"` // 回响技能
Fightvalue int32 `protobuf:"varint,30,opt,name=fightvalue,proto3" json:"fightvalue"` // 战力
}
func (x *DBHero) Reset() {
@ -337,6 +338,13 @@ func (x *DBHero) GetTalentskill() []*SkillData {
return nil
}
func (x *DBHero) GetFightvalue() int32 {
if x != nil {
return x.Fightvalue
}
return 0
}
//英雄扩展数据
type DBHeroRecord struct {
state protoimpl.MessageState
@ -735,7 +743,7 @@ var file_hero_hero_db_proto_rawDesc = []byte{
0x0a, 0x12, 0x68, 0x65, 0x72, 0x6f, 0x2f, 0x68, 0x65, 0x72, 0x6f, 0x5f, 0x64, 0x62, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x1c, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa2,
0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc2,
0x0b, 0x0a, 0x06, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68,
@ -802,6 +810,8 @@ var file_hero_hero_db_proto_rawDesc = []byte{
0x6c, 0x6c, 0x12, 0x2c, 0x0a, 0x0b, 0x74, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x73, 0x6b, 0x69, 0x6c,
0x6c, 0x18, 0x1d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x44,
0x61, 0x74, 0x61, 0x52, 0x0b, 0x74, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x73, 0x6b, 0x69, 0x6c, 0x6c,
0x12, 0x1e, 0x0a, 0x0a, 0x66, 0x69, 0x67, 0x68, 0x74, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x1e,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x66, 0x69, 0x67, 0x68, 0x74, 0x76, 0x61, 0x6c, 0x75, 0x65,
0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03,
0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01,

View File

@ -344,7 +344,10 @@ type Tables struct {
FightingSkilllv *GameFightingSkilllv
FightingSkill *GameFightingSkill
FightingSkillStar *GameFightingSkillStar
<<<<<<< HEAD
ExpeditionBoos *GameExpeditionBoos
=======
>>>>>>> aa8ed334061993a5bd1bbe28c4fa53dc67763781
}
func NewTables(loader JsonLoader) (*Tables, error) {
@ -2350,11 +2353,14 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.FightingSkillStar, err = NewGameFightingSkillStar(buf) ; err != nil {
return nil, err
}
<<<<<<< HEAD
if buf, err = loader("game_expeditionboos") ; err != nil {
return nil, err
}
if tables.ExpeditionBoos, err = NewGameExpeditionBoos(buf) ; err != nil {
return nil, err
}
=======
>>>>>>> aa8ed334061993a5bd1bbe28c4fa53dc67763781
return tables, nil
}