refactor(common): 重构宠物相关数据结构和命名

- 将 PetMM 结构体重命名为 PetInfo,更准确地反映其用途
- 更新了相关文件中的结构体引用和变量命名
- 优化了部分代码的格式和注释
This commit is contained in:
2025-09-03 02:09:43 +08:00
parent 85d0dbf527
commit 5c6f35b1da
4 changed files with 22 additions and 21 deletions

View File

@@ -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
})

View File

@@ -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"`
}