refactor(common): 重构宠物相关数据结构和命名
- 将 PetMM 结构体重命名为 PetInfo,更准确地反映其用途 - 更新了相关文件中的结构体引用和变量命名 - 优化了部分代码的格式和注释
This commit is contained in:
@@ -31,7 +31,7 @@ var (
|
||||
MonsterMap map[int]TMapConfig
|
||||
//Skill MovesTbl //技能配置
|
||||
SkillMap map[int]Move
|
||||
PetMAP map[int]PetMM //宠物配置
|
||||
PetMAP map[int]PetInfo //宠物配置
|
||||
NatureRootMap map[int]NatureItem
|
||||
)
|
||||
|
||||
@@ -54,7 +54,7 @@ func initfile() {
|
||||
|
||||
})
|
||||
pet := getXml[Monsters](path + "226.xml")
|
||||
PetMAP = utils.ToMap[PetMM, int](pet.Monsters, func(m PetMM) int {
|
||||
PetMAP = utils.ToMap[PetInfo, int](pet.Monsters, func(m PetInfo) int {
|
||||
return m.ID
|
||||
|
||||
})
|
||||
|
||||
@@ -13,13 +13,13 @@ type LearnableMoves struct {
|
||||
Moves []PetMoves `xml:"Move"`
|
||||
}
|
||||
|
||||
// PetMM 表示一个怪物的信息
|
||||
type PetMM struct {
|
||||
// PetInfo 表示一个怪物的信息
|
||||
type PetInfo struct {
|
||||
ID int `xml:"ID,attr"`
|
||||
DefName string `xml:"DefName,attr"`
|
||||
Type int `xml:"Type,attr"`
|
||||
GrowthType int `xml:"GrowthType,attr"`
|
||||
HP int `xml:"HP,attr"`
|
||||
DefName string `xml:"DefName,attr"` //名字
|
||||
Type int `xml:"Type,attr"` //类型
|
||||
GrowthType int `xml:"GrowthType,attr"` //成长类型
|
||||
HP int `xml:"HP,attr"` //血量种族值
|
||||
Atk int `xml:"Atk,attr"`
|
||||
Def int `xml:"Def,attr"`
|
||||
SpAtk int `xml:"SpAtk,attr"`
|
||||
@@ -45,6 +45,6 @@ type PetMM struct {
|
||||
|
||||
// Monsters 表示所有怪物的集合
|
||||
type Monsters struct {
|
||||
XMLName xml.Name `xml:"Monsters"`
|
||||
Monsters []PetMM `xml:"Monster"`
|
||||
XMLName xml.Name `xml:"Monsters"`
|
||||
Monsters []PetInfo `xml:"Monster"`
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package info
|
||||
|
||||
import (
|
||||
element "blazing/common/data/Element"
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/modules/blazing/model"
|
||||
"context"
|
||||
"sync"
|
||||
@@ -41,7 +42,8 @@ func (a *Attribute) Value() int64 {
|
||||
}
|
||||
|
||||
type BattlePetEntity struct {
|
||||
model.PetInfo //通过偏移赋值
|
||||
xmlres.PetInfo
|
||||
info model.PetInfo //通过偏移赋值
|
||||
ctx context.Context
|
||||
Capturable bool // 是否可捕获
|
||||
statusConditions sync.Map // key: StatusCondition, value: int (剩余回合)
|
||||
|
||||
@@ -36,16 +36,15 @@ var Category = enum.New[struct {
|
||||
// 战斗中可以修改技能实体值,比如是否暴击,是否必中等
|
||||
type BattleSkillEntity struct {
|
||||
xmlres.Move
|
||||
ctx context.Context
|
||||
SideEffects []int
|
||||
SideEffectArgs []int
|
||||
PP int
|
||||
InfinityPP bool
|
||||
DamageZone map[EnumCategory]map[EnumsZoneType]map[EnumsZoneType][]float64 // 三维map 伤害类型-》增还是减-》加还是乘-》值
|
||||
isCritical bool //技能是否暴击
|
||||
isHIt bool //技能是否命中
|
||||
ATTACK_COUNT_ZONE int //攻击次数
|
||||
DamageValue decimal.Decimal // 伤害值
|
||||
ctx context.Context
|
||||
SideEffects []int
|
||||
SideEffectArgs []int
|
||||
PP int
|
||||
InfinityPP bool
|
||||
DamageZone map[EnumCategory]map[EnumsZoneType]map[EnumsZoneType][]float64 // 三维map 伤害类型-》增还是减-》加还是乘-》值
|
||||
|
||||
ATTACK_COUNT_ZONE int //攻击次数
|
||||
DamageValue decimal.Decimal // 伤害值
|
||||
|
||||
// 技能类型属性
|
||||
//SkillType EnumCategory // 技能类型(物理/特殊/状态)
|
||||
|
||||
Reference in New Issue
Block a user