新增精灵融合接口及处理逻辑,支持主副精灵融合生成新精灵,并消耗金币与材料。 同时调整了战斗技能选择流程、修复地图热度统计安全问题以及完善宠物删除机制。 - 添加 `PetFusion` 控制器方法实现融合核心逻辑 - 新增 `C2S_PetFusion` 和 `PetFusionInfo` 结构体用于通信 - 修正战斗中技能随机选取后立即返回的问题 - 修复太空站进入/离开时对地图热度的并发访问风险 -
46 lines
1.7 KiB
Go
46 lines
1.7 KiB
Go
package model
|
||
|
||
import (
|
||
"blazing/cool"
|
||
)
|
||
|
||
const (
|
||
TableNamePetFusionConfig = "pet_fusion_config" // 宠物融合配置表(尼尔/闪皮融合规则)
|
||
)
|
||
|
||
// PetFusionConfig 宠物融合配置模型(对应尼尔/闪皮融合卡鲁/闪尼的规则)
|
||
type PetFusionConfig struct {
|
||
*cool.Model
|
||
|
||
MainPetID int32 `gorm:"not null;comment:'主精灵ID(尼尔)'" json:"main_pet_id"`
|
||
AuxPetID int32 `gorm:"not null;comment:'副精灵ID(闪皮)'" json:"aux_pet_id"`
|
||
FusionMaterial1 int32 `gorm:"not null;default:0;comment:'融合材料1编号'" json:"fusion_material1"`
|
||
FusionMaterial2 int32 `gorm:"not null;default:0;comment:'融合材料2编号'" json:"fusion_material2"`
|
||
FusionMaterial3 int32 `gorm:"not null;default:0;comment:'融合材料3编号'" json:"fusion_material3"`
|
||
FusionMaterial4 int32 `gorm:"not null;default:0;comment:'融合材料4编号'" json:"fusion_material4"`
|
||
FusionProbability float64 `gorm:"not null;comment:'融合成功概率(百分比,0-100)'" json:"fusion_probability"`
|
||
ResultPetID int32 `gorm:"not null;comment:'融合结果精灵ID(卡鲁/闪尼)'" json:"result_pet_id"`
|
||
}
|
||
|
||
// TableName PetFusionConfig's table name
|
||
func (*PetFusionConfig) TableName() string {
|
||
return TableNamePetFusionConfig
|
||
}
|
||
|
||
// GroupName PetFusionConfig's table group
|
||
func (*PetFusionConfig) GroupName() string {
|
||
return "default" // 与原模型保持一致的分组名
|
||
}
|
||
|
||
// NewPetFusionConfig create a new PetFusionConfig
|
||
func NewPetFusionConfig() *PetFusionConfig {
|
||
return &PetFusionConfig{
|
||
Model: cool.NewModel(),
|
||
}
|
||
}
|
||
|
||
// 初始化表结构(与原模型保持一致的初始化方式)
|
||
func init() {
|
||
cool.CreateTable(&PetFusionConfig{})
|
||
}
|