``` refactor(fight): 重构精灵切换逻辑,将切换效果处理移至回合收集阶段并优化闪光字段结构

This commit is contained in:
1
2025-12-10 16:03:45 +00:00
parent 2d69eef283
commit 2187d84663
5 changed files with 36 additions and 40 deletions

View File

@@ -108,8 +108,12 @@ type PetInfo struct {
SkinID uint32 `fieldDesc:"皮肤id默认为0" `
// 是否闪光(@UInt long → uint320=否1=是)
Shiny uint32 `fieldDesc:"是不是闪" `
// AbilityType uint32 `struc:"skip"` //特性
ShinyLen uint32 `struc:"sizeof=Shiny"`
Shiny []GlowFilter
//时间轮转然后effect根据type同时只共存一个特性是1 特质是1柱子是两种魂印是一个然后异色字段然后特训技能字段
ExtSKill []uint32 `struc:"skip"` //特训技能
}
// 定义常量,提升可维护性(避免魔法数字)
@@ -237,6 +241,7 @@ func (pet *PetInfo) RnadAN() {
}
}
// 1是特性特质<!-- Stat: 精灵特效Stat: 0: 无效(默认值), 1: 永久, 2: 有`有效次数'的特效 3: 爆发特效 4: 异能精灵特质5特训6魂印-->
func (pet *PetInfo) GetEffect(ptype int) (int, *PetEffectInfo, bool) {
return utils.FindWithIndex(pet.EffectInfo, func(item PetEffectInfo) bool {
@@ -411,7 +416,8 @@ func GenPetInfo(
// ---- 处理闪光 ----
if shinyid != -1 {
p.Shiny = uint32(shinyid)
//todo 待实现异色字段
// p.Shiny = uint32(shinyid)
}
// ---- 性格 ----
@@ -565,14 +571,6 @@ type GlowFilter struct {
Inner bool `json:"inner,omitempty"`
// Knockout 是否挖空,默认 false
Knockout bool `json:"knockout,omitempty"`
}
type ColorMatrixFilter struct {
// Matrix 4×5 颜色变换矩阵固定长度20的int8数组不可变长度避免越界
// 矩阵格式(行优先):
// [ Rr, Rg, Rb, Ra, Ro, // 输出R = Rr*输入R + Rg*输入G + Rb*输入B + Ra*输入A + Ro
// Gr, Gg, Gb, Ga, Go, // 输出G = Gr*输入R + Gg*输入G + Gb*输入B + Ga*输入A + Go
// Br, Bg, Bb, Ba, Bo, // 输出B = Br*输入R + Bg*输入G + Bb*输入B + Ba*输入A + Bo
// Ar, Ag, Ab, Aa, Ao ] // 输出A = Ar*输入R + Ag*输入G + Ab*输入B + Aa*输入A + Ao
Matrix [20]uint8 `json:"matrix,omitempty"`
Knockout bool `json:"knockout,omitempty"`
ColorMatrixFilter [20]uint8 `json:"matrix,omitempty"`
}