***
This commit is contained in:
1 parent
213b9cb8e0
commit
331c935484
6 files changed
+327
-66
No files matched your search
@@ -2,6 +2,7 @@ package gdconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"hk4e/common/constant"
|
||||
"os"
|
||||
|
||||
"hk4e/pkg/endec"
|
||||
@@ -120,3 +121,42 @@ func GetAvatarDataById(avatarId int32) *AvatarData {
|
||||
func GetAvatarDataMap() map[int32]*AvatarData {
|
||||
return CONF.AvatarDataMap
|
||||
}
|
||||
|
||||
// GetAvatarBaseADH 获取角色基础攻防血
|
||||
func GetAvatarBaseADH(avatarId uint32, level uint8, promote uint8, fightProp int) float32 {
|
||||
adh := float32(0.0)
|
||||
avatarConfig := GetAvatarDataById(int32(avatarId))
|
||||
if avatarConfig == nil {
|
||||
logger.Error("avatar config is nil, avatarId: %v", avatarId)
|
||||
return adh
|
||||
}
|
||||
switch fightProp {
|
||||
case constant.FIGHT_PROP_BASE_ATTACK:
|
||||
adh += avatarConfig.AttackBase
|
||||
case constant.FIGHT_PROP_BASE_DEFENSE:
|
||||
adh += avatarConfig.DefenseBase
|
||||
case constant.FIGHT_PROP_BASE_HP:
|
||||
adh += avatarConfig.HpBase
|
||||
}
|
||||
for _, propGrow := range avatarConfig.PropGrowList {
|
||||
if propGrow.Type == int32(fightProp) {
|
||||
avatarCurveConfig := GetAvatarCurveByLevelAndType(int32(level), propGrow.Curve)
|
||||
if avatarCurveConfig == nil {
|
||||
logger.Error("avatar curve config is nil, level: %v, curveType: %v", level, propGrow.Curve)
|
||||
return adh
|
||||
}
|
||||
adh *= avatarCurveConfig.Value
|
||||
}
|
||||
}
|
||||
avatarPromoteConfig := GetAvatarPromoteDataByIdAndLevel(avatarConfig.PromoteId, int32(promote))
|
||||
if avatarPromoteConfig == nil {
|
||||
logger.Error("avatar promote config is nil, promoteId: %v, promoteLevel: %v", avatarConfig.PromoteId, promote)
|
||||
return adh
|
||||
}
|
||||
for _, addProp := range avatarPromoteConfig.AddPropList {
|
||||
if addProp.Type == int32(fightProp) {
|
||||
adh += addProp.Value
|
||||
}
|
||||
}
|
||||
return adh
|
||||
}
|
||||
@@ -81,6 +81,7 @@ type GameDataConfig struct {
|
||||
MonsterDataMap map[int32]*MonsterData // 怪物
|
||||
ProudSkillDataMap map[int32]map[int32]*ProudSkillData // 天赋
|
||||
AvatarCurveDataMap map[int32]*AvatarCurveData // 角色曲线
|
||||
WeaponCurveDataMap map[int32]*WeaponCurveData // 武器曲线
|
||||
}
|
||||
|
||||
func InitGameDataConfig() {
|
||||
@@ -193,6 +194,7 @@ func (g *GameDataConfig) load(loadSceneLua bool) {
|
||||
g.loadMonsterData() // 怪物
|
||||
g.loadProudSkillData() // 天赋
|
||||
g.loadAvatarCurveData() // 角色曲线
|
||||
g.loadWeaponCurveData() // 武器曲线
|
||||
}
|
||||
|
||||
// CSV相关
|
||||
|
||||
@@ -9,6 +9,12 @@ type ItemUse struct {
|
||||
UseParam []string
|
||||
}
|
||||
|
||||
type Prop struct {
|
||||
Type int32 // 类型
|
||||
Value float32 // 初始值
|
||||
Curve int32 // 曲线
|
||||
}
|
||||
|
||||
// ItemData 道具分类分表整合配置表
|
||||
type ItemData struct {
|
||||
// 公共表头字段
|
||||
@@ -42,8 +48,15 @@ type ItemData struct {
|
||||
EquipBaseExp int32 `csv:"武器初始经验,omitempty"`
|
||||
AwakenMaterial int32 `csv:"精炼道具,omitempty"`
|
||||
AwakenCoinCost IntArray `csv:"精炼摩拉消耗,omitempty"`
|
||||
Prop1Type int32 `csv:"[属性]1类型,omitempty"`
|
||||
Prop1Value float32 `csv:"[属性]1初始值,omitempty"`
|
||||
Prop1Curve int32 `csv:"[属性]1成长曲线,omitempty"`
|
||||
Prop2Type int32 `csv:"[属性]2类型,omitempty"`
|
||||
Prop2Value float32 `csv:"[属性]2初始值,omitempty"`
|
||||
Prop2Curve int32 `csv:"[属性]2成长曲线,omitempty"`
|
||||
|
||||
SkillAffix []int32
|
||||
PropList []*Prop
|
||||
|
||||
// 圣遗物
|
||||
ReliquaryType int32 `csv:"圣遗物类别,omitempty"`
|
||||
@@ -102,6 +115,21 @@ func (g *GameDataConfig) loadItemData() {
|
||||
if itemData.SkillAffix2 != 0 {
|
||||
itemData.SkillAffix = append(itemData.SkillAffix, itemData.SkillAffix2)
|
||||
}
|
||||
itemData.PropList = make([]*Prop, 0)
|
||||
if itemData.Prop1Type != 0 {
|
||||
itemData.PropList = append(itemData.PropList, &Prop{
|
||||
Type: itemData.Prop1Type,
|
||||
Value: itemData.Prop1Value,
|
||||
Curve: itemData.Prop1Curve,
|
||||
})
|
||||
}
|
||||
if itemData.Prop2Type != 0 {
|
||||
itemData.PropList = append(itemData.PropList, &Prop{
|
||||
Type: itemData.Prop2Type,
|
||||
Value: itemData.Prop2Value,
|
||||
Curve: itemData.Prop2Curve,
|
||||
})
|
||||
}
|
||||
g.ItemDataMap[itemData.ItemId] = itemData
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
package gdconf
|
||||
|
||||
import (
|
||||
"hk4e/pkg/logger"
|
||||
)
|
||||
|
||||
// WeaponCurveData 武器曲线配置表
|
||||
type WeaponCurveData struct {
|
||||
Level int32 `csv:"等级"`
|
||||
|
||||
Curve1Type int32 `csv:"[曲线]1类型,omitempty"`
|
||||
Curve1Arithmetic int32 `csv:"[曲线]1运算,omitempty"`
|
||||
Curve1Value float32 `csv:"[曲线]1值,omitempty"`
|
||||
Curve2Type int32 `csv:"[曲线]2类型,omitempty"`
|
||||
Curve2Arithmetic int32 `csv:"[曲线]2运算,omitempty"`
|
||||
Curve2Value float32 `csv:"[曲线]2值,omitempty"`
|
||||
Curve3Type int32 `csv:"[曲线]3类型,omitempty"`
|
||||
Curve3Arithmetic int32 `csv:"[曲线]3运算,omitempty"`
|
||||
Curve3Value float32 `csv:"[曲线]3值,omitempty"`
|
||||
Curve4Type int32 `csv:"[曲线]4类型,omitempty"`
|
||||
Curve4Arithmetic int32 `csv:"[曲线]4运算,omitempty"`
|
||||
Curve4Value float32 `csv:"[曲线]4值,omitempty"`
|
||||
Curve5Type int32 `csv:"[曲线]5类型,omitempty"`
|
||||
Curve5Arithmetic int32 `csv:"[曲线]5运算,omitempty"`
|
||||
Curve5Value float32 `csv:"[曲线]5值,omitempty"`
|
||||
Curve6Type int32 `csv:"[曲线]6类型,omitempty"`
|
||||
Curve6Arithmetic int32 `csv:"[曲线]6运算,omitempty"`
|
||||
Curve6Value float32 `csv:"[曲线]6值,omitempty"`
|
||||
Curve7Type int32 `csv:"[曲线]7类型,omitempty"`
|
||||
Curve7Arithmetic int32 `csv:"[曲线]7运算,omitempty"`
|
||||
Curve7Value float32 `csv:"[曲线]7值,omitempty"`
|
||||
Curve8Type int32 `csv:"[曲线]8类型,omitempty"`
|
||||
Curve8Arithmetic int32 `csv:"[曲线]8运算,omitempty"`
|
||||
Curve8Value float32 `csv:"[曲线]8值,omitempty"`
|
||||
Curve9Type int32 `csv:"[曲线]9类型,omitempty"`
|
||||
Curve9Arithmetic int32 `csv:"[曲线]9运算,omitempty"`
|
||||
Curve9Value float32 `csv:"[曲线]9值,omitempty"`
|
||||
Curve10Type int32 `csv:"[曲线]10类型,omitempty"`
|
||||
Curve10Arithmetic int32 `csv:"[曲线]10运算,omitempty"`
|
||||
Curve10Value float32 `csv:"[曲线]10值,omitempty"`
|
||||
Curve11Type int32 `csv:"[曲线]11类型,omitempty"`
|
||||
Curve11Arithmetic int32 `csv:"[曲线]11运算,omitempty"`
|
||||
Curve11Value float32 `csv:"[曲线]11值,omitempty"`
|
||||
Curve12Type int32 `csv:"[曲线]12类型,omitempty"`
|
||||
Curve12Arithmetic int32 `csv:"[曲线]12运算,omitempty"`
|
||||
Curve12Value float32 `csv:"[曲线]12值,omitempty"`
|
||||
Curve13Type int32 `csv:"[曲线]13类型,omitempty"`
|
||||
Curve13Arithmetic int32 `csv:"[曲线]13运算,omitempty"`
|
||||
Curve13Value float32 `csv:"[曲线]13值,omitempty"`
|
||||
Curve14Type int32 `csv:"[曲线]14类型,omitempty"`
|
||||
Curve14Arithmetic int32 `csv:"[曲线]14运算,omitempty"`
|
||||
Curve14Value float32 `csv:"[曲线]14值,omitempty"`
|
||||
Curve15Type int32 `csv:"[曲线]15类型,omitempty"`
|
||||
Curve15Arithmetic int32 `csv:"[曲线]15运算,omitempty"`
|
||||
Curve15Value float32 `csv:"[曲线]15值,omitempty"`
|
||||
Curve16Type int32 `csv:"[曲线]16类型,omitempty"`
|
||||
Curve16Arithmetic int32 `csv:"[曲线]16运算,omitempty"`
|
||||
Curve16Value float32 `csv:"[曲线]16值,omitempty"`
|
||||
Curve17Type int32 `csv:"[曲线]17类型,omitempty"`
|
||||
Curve17Arithmetic int32 `csv:"[曲线]17运算,omitempty"`
|
||||
Curve17Value float32 `csv:"[曲线]17值,omitempty"`
|
||||
Curve18Type int32 `csv:"[曲线]18类型,omitempty"`
|
||||
Curve18Arithmetic int32 `csv:"[曲线]18运算,omitempty"`
|
||||
Curve18Value float32 `csv:"[曲线]18值,omitempty"`
|
||||
|
||||
CurveList []*Curve
|
||||
}
|
||||
|
||||
func (g *GameDataConfig) loadWeaponCurveData() {
|
||||
g.WeaponCurveDataMap = make(map[int32]*WeaponCurveData)
|
||||
weaponCurveDataList := make([]*WeaponCurveData, 0)
|
||||
readTable[WeaponCurveData](g.txtPrefix+"WeaponCurveData.txt", &weaponCurveDataList)
|
||||
for _, weaponCurveData := range weaponCurveDataList {
|
||||
curveList := make([]*Curve, 0)
|
||||
if weaponCurveData.Curve1Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve1Type,
|
||||
Arithmetic: weaponCurveData.Curve1Arithmetic,
|
||||
Value: weaponCurveData.Curve1Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve2Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve2Type,
|
||||
Arithmetic: weaponCurveData.Curve2Arithmetic,
|
||||
Value: weaponCurveData.Curve2Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve3Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve3Type,
|
||||
Arithmetic: weaponCurveData.Curve3Arithmetic,
|
||||
Value: weaponCurveData.Curve3Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve4Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve4Type,
|
||||
Arithmetic: weaponCurveData.Curve4Arithmetic,
|
||||
Value: weaponCurveData.Curve4Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve5Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve5Type,
|
||||
Arithmetic: weaponCurveData.Curve5Arithmetic,
|
||||
Value: weaponCurveData.Curve5Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve6Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve6Type,
|
||||
Arithmetic: weaponCurveData.Curve6Arithmetic,
|
||||
Value: weaponCurveData.Curve6Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve7Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve7Type,
|
||||
Arithmetic: weaponCurveData.Curve7Arithmetic,
|
||||
Value: weaponCurveData.Curve7Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve8Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve8Type,
|
||||
Arithmetic: weaponCurveData.Curve8Arithmetic,
|
||||
Value: weaponCurveData.Curve8Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve9Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve9Type,
|
||||
Arithmetic: weaponCurveData.Curve9Arithmetic,
|
||||
Value: weaponCurveData.Curve9Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve10Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve10Type,
|
||||
Arithmetic: weaponCurveData.Curve10Arithmetic,
|
||||
Value: weaponCurveData.Curve10Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve11Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve11Type,
|
||||
Arithmetic: weaponCurveData.Curve11Arithmetic,
|
||||
Value: weaponCurveData.Curve11Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve12Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve12Type,
|
||||
Arithmetic: weaponCurveData.Curve12Arithmetic,
|
||||
Value: weaponCurveData.Curve12Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve13Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve13Type,
|
||||
Arithmetic: weaponCurveData.Curve13Arithmetic,
|
||||
Value: weaponCurveData.Curve13Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve14Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve14Type,
|
||||
Arithmetic: weaponCurveData.Curve14Arithmetic,
|
||||
Value: weaponCurveData.Curve14Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve15Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve15Type,
|
||||
Arithmetic: weaponCurveData.Curve15Arithmetic,
|
||||
Value: weaponCurveData.Curve15Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve16Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve16Type,
|
||||
Arithmetic: weaponCurveData.Curve16Arithmetic,
|
||||
Value: weaponCurveData.Curve16Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve17Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve17Type,
|
||||
Arithmetic: weaponCurveData.Curve17Arithmetic,
|
||||
Value: weaponCurveData.Curve17Value,
|
||||
})
|
||||
}
|
||||
if weaponCurveData.Curve18Type != 0 {
|
||||
curveList = append(curveList, &Curve{
|
||||
Type: weaponCurveData.Curve18Type,
|
||||
Arithmetic: weaponCurveData.Curve18Arithmetic,
|
||||
Value: weaponCurveData.Curve18Value,
|
||||
})
|
||||
}
|
||||
weaponCurveData.CurveList = curveList
|
||||
g.WeaponCurveDataMap[weaponCurveData.Level] = weaponCurveData
|
||||
}
|
||||
logger.Info("WeaponCurveData count: %v", len(g.WeaponCurveDataMap))
|
||||
}
|
||||
|
||||
func GetWeaponCurveByLevelAndType(level int32, curveType int32) *Curve {
|
||||
weaponCurveData, exist := CONF.WeaponCurveDataMap[level]
|
||||
if !exist {
|
||||
return nil
|
||||
}
|
||||
for _, curve := range weaponCurveData.CurveList {
|
||||
if curve.Type == curveType {
|
||||
return curve
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetWeaponCurveDataMap() map[int32]*WeaponCurveData {
|
||||
return CONF.WeaponCurveDataMap
|
||||
}
|
||||
@@ -631,7 +631,40 @@ func (g *Game) UpdatePlayerAvatarFightProp(userId uint32, avatarId uint32) {
|
||||
}
|
||||
|
||||
// 更新角色面板
|
||||
dbAvatar.UpdateAvatarFightProp(avatar)
|
||||
avatarDataConfig := gdconf.GetAvatarDataById(int32(avatar.AvatarId))
|
||||
if avatarDataConfig == nil {
|
||||
logger.Error("avatarDataConfig error, avatarId: %v", avatar.AvatarId)
|
||||
return
|
||||
}
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_NONE] = 0.0
|
||||
// 白字攻防血
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_BASE_ATTACK] = gdconf.GetAvatarBaseADH(avatar.AvatarId, avatar.Level, avatar.Promote, constant.FIGHT_PROP_BASE_ATTACK)
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_BASE_DEFENSE] = gdconf.GetAvatarBaseADH(avatar.AvatarId, avatar.Level, avatar.Promote, constant.FIGHT_PROP_BASE_DEFENSE)
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_BASE_HP] = gdconf.GetAvatarBaseADH(avatar.AvatarId, avatar.Level, avatar.Promote, constant.FIGHT_PROP_BASE_HP)
|
||||
// 白字+绿字攻防血
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CUR_ATTACK] = gdconf.GetAvatarBaseADH(avatar.AvatarId, avatar.Level, avatar.Promote, constant.FIGHT_PROP_BASE_ATTACK)
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CUR_DEFENSE] = gdconf.GetAvatarBaseADH(avatar.AvatarId, avatar.Level, avatar.Promote, constant.FIGHT_PROP_BASE_DEFENSE)
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_MAX_HP] = gdconf.GetAvatarBaseADH(avatar.AvatarId, avatar.Level, avatar.Promote, constant.FIGHT_PROP_BASE_HP)
|
||||
// 双暴
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL] = avatarDataConfig.Critical
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL_HURT] = avatarDataConfig.CriticalHurt
|
||||
// 元素充能
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CHARGE_EFFICIENCY] = 1.0
|
||||
|
||||
// 武器基础属性加成
|
||||
weaponItemConfig := gdconf.GetItemDataById(int32(avatar.EquipWeapon.ItemId))
|
||||
if weaponItemConfig == nil {
|
||||
logger.Error("weaponItemConfig is nil, itemId: %v", avatar.EquipWeapon.ItemId)
|
||||
return
|
||||
}
|
||||
for _, prop := range weaponItemConfig.PropList {
|
||||
curveConfig := gdconf.GetWeaponCurveByLevelAndType(int32(avatar.EquipWeapon.Level), prop.Curve)
|
||||
if curveConfig == nil {
|
||||
logger.Error("curveConfig is nil, level: %v, curve: %v", avatar.EquipWeapon.Level, prop.Curve)
|
||||
return
|
||||
}
|
||||
avatar.FightPropMap[uint32(prop.Type)] += prop.Value * curveConfig.Value
|
||||
}
|
||||
|
||||
avatarFightPropNotify := &proto.AvatarFightPropNotify{
|
||||
AvatarGuid: avatar.Guid,
|
||||
|
||||
+1
-65
@@ -87,8 +87,6 @@ func (a *DbAvatar) InitAvatar(player *Player, avatar *Avatar) {
|
||||
avatar.FightPropMap[uint32(fightPropEnergy.MaxEnergy)] = float32(avatarSkillDataConfig.CostElemVal)
|
||||
avatar.FightPropMap[uint32(fightPropEnergy.CurEnergy)] = float32(avatar.CurrEnergy)
|
||||
}
|
||||
// 更新角色面板
|
||||
a.UpdateAvatarFightProp(avatar)
|
||||
// guid
|
||||
avatar.Guid = player.GetNextGameObjectGuid()
|
||||
player.GameObjectGuidMap[avatar.Guid] = GameObject(avatar)
|
||||
@@ -98,68 +96,6 @@ func (a *DbAvatar) InitAvatar(player *Player, avatar *Avatar) {
|
||||
return
|
||||
}
|
||||
|
||||
// GetAvatarBaseADH 获取角色基础攻防血
|
||||
func (a *DbAvatar) GetAvatarBaseADH(avatar *Avatar, fightProp int) float32 {
|
||||
adh := float32(0.0)
|
||||
avatarConfig := gdconf.GetAvatarDataById(int32(avatar.AvatarId))
|
||||
if avatarConfig == nil {
|
||||
logger.Error("avatar config is nil, avatarId: %v", avatar.AvatarId)
|
||||
return adh
|
||||
}
|
||||
switch fightProp {
|
||||
case constant.FIGHT_PROP_BASE_ATTACK:
|
||||
adh += avatarConfig.AttackBase
|
||||
case constant.FIGHT_PROP_BASE_DEFENSE:
|
||||
adh += avatarConfig.DefenseBase
|
||||
case constant.FIGHT_PROP_BASE_HP:
|
||||
adh += avatarConfig.HpBase
|
||||
}
|
||||
for _, propGrow := range avatarConfig.PropGrowList {
|
||||
if propGrow.Type == int32(fightProp) {
|
||||
avatarCurveConfig := gdconf.GetAvatarCurveByLevelAndType(int32(avatar.Level), propGrow.Curve)
|
||||
if avatarCurveConfig == nil {
|
||||
logger.Error("avatar curve config is nil, level: %v, curveType: %v", avatar.Level, propGrow.Curve)
|
||||
return adh
|
||||
}
|
||||
adh *= avatarCurveConfig.Value
|
||||
}
|
||||
}
|
||||
avatarPromoteConfig := gdconf.GetAvatarPromoteDataByIdAndLevel(avatarConfig.PromoteId, int32(avatar.Promote))
|
||||
if avatarPromoteConfig == nil {
|
||||
logger.Error("avatar promote config is nil, promoteId: %v, promoteLevel: %v", avatarConfig.PromoteId, avatar.Promote)
|
||||
return adh
|
||||
}
|
||||
for _, addProp := range avatarPromoteConfig.AddPropList {
|
||||
if addProp.Type == int32(fightProp) {
|
||||
adh += addProp.Value
|
||||
}
|
||||
}
|
||||
return adh
|
||||
}
|
||||
|
||||
// UpdateAvatarFightProp 更新角色面板
|
||||
func (a *DbAvatar) UpdateAvatarFightProp(avatar *Avatar) {
|
||||
avatarDataConfig := gdconf.GetAvatarDataById(int32(avatar.AvatarId))
|
||||
if avatarDataConfig == nil {
|
||||
logger.Error("avatarDataConfig error, avatarId: %v", avatar.AvatarId)
|
||||
return
|
||||
}
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_NONE] = 0.0
|
||||
// 白字攻防血
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_BASE_ATTACK] = a.GetAvatarBaseADH(avatar, constant.FIGHT_PROP_BASE_ATTACK)
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_BASE_DEFENSE] = a.GetAvatarBaseADH(avatar, constant.FIGHT_PROP_BASE_DEFENSE)
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_BASE_HP] = a.GetAvatarBaseADH(avatar, constant.FIGHT_PROP_BASE_HP)
|
||||
// 白字+绿字攻防血
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CUR_ATTACK] = a.GetAvatarBaseADH(avatar, constant.FIGHT_PROP_BASE_ATTACK)
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CUR_DEFENSE] = a.GetAvatarBaseADH(avatar, constant.FIGHT_PROP_BASE_DEFENSE)
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_MAX_HP] = a.GetAvatarBaseADH(avatar, constant.FIGHT_PROP_BASE_HP)
|
||||
// 双暴
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL] = avatarDataConfig.Critical
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CRITICAL_HURT] = avatarDataConfig.CriticalHurt
|
||||
// 元素充能
|
||||
avatar.FightPropMap[constant.FIGHT_PROP_CHARGE_EFFICIENCY] = 1.0
|
||||
}
|
||||
|
||||
func (a *DbAvatar) AddAvatar(player *Player, avatarId uint32) {
|
||||
avatarDataConfig := gdconf.GetAvatarDataById(int32(avatarId))
|
||||
if avatarDataConfig == nil {
|
||||
@@ -193,7 +129,7 @@ func (a *DbAvatar) AddAvatar(player *Player, avatarId uint32) {
|
||||
PromoteRewardMap: make(map[uint32]bool, len(avatarDataConfig.PromoteRewardMap)),
|
||||
}
|
||||
|
||||
avatar.CurrHP = float64(a.GetAvatarBaseADH(avatar, constant.FIGHT_PROP_BASE_HP))
|
||||
avatar.CurrHP = float64(gdconf.GetAvatarBaseADH(avatar.AvatarId, avatar.Level, avatar.Promote, constant.FIGHT_PROP_BASE_HP))
|
||||
// 角色突破奖励领取状态
|
||||
for promoteLevel := range avatarDataConfig.PromoteRewardMap {
|
||||
avatar.PromoteRewardMap[promoteLevel] = false
|
||||
|
||||
Reference in new issue
Block a user