diff --git a/logic/service/fight/effect/effect_status.go b/logic/service/fight/effect/effect_status.go index d69747d5..f23d14e9 100644 --- a/logic/service/fight/effect/effect_status.go +++ b/logic/service/fight/effect/effect_status.go @@ -18,7 +18,7 @@ type BaseStatus struct { } // 重写切换事件:我方单位切换时清除状态 -func (e *BaseStatus) Switch(in *input.Input, _ info.AttackValue, _ *info.BattlePetEntity) bool { +func (e *BaseStatus) SwitchOut(in *input.Input) bool { // 我方单位下场时,状态失效 if in == e.Ctx().Our { e.Alive(false) @@ -94,7 +94,8 @@ func (e *Burned) Skill_Hit() bool { // 寄生种子状态:扣血同时给对方回血 type ParasiticSeed struct { - BaseStatus + node.EffectNode + Status info.EnumPetStatus // 状态类型枚举 } // 技能命中前触发寄生效果 diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index 3f11ebfc..f0bc5646 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -249,6 +249,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) } fmt.Println(i, + "技能名称:", attacker.CurrentPet.Info.Name, "玩家技能伤害:", attacker.SumDamage, "自身剩余血量:", attacker.CurrentPet.Info.Hp, "对手剩余血量:", defender.CurrentPet.Info.Hp, @@ -291,7 +292,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) defender.CurrentPet.NotAlive = true f.Broadcast(func(ff *input.Input) { - defender.Exec(func(t input.Effect) bool { + ff.Exec(func(t input.Effect) bool { t.SwitchOut(defender) diff --git a/logic/service/fight/loop.go b/logic/service/fight/loop.go index cb60200f..12d99be9 100644 --- a/logic/service/fight/loop.go +++ b/logic/service/fight/loop.go @@ -64,7 +64,7 @@ func (f *FightC) battleLoop() { } - ff.Player.GetInfo().PetList[j].Hp = utils.Max(ff.Player.GetInfo().PetList[j].MaxHp, ff.AllPet[i].Info.Hp) + ff.Player.GetInfo().PetList[j].Hp = utils.Min(ff.Player.GetInfo().PetList[j].MaxHp, ff.AllPet[i].Info.Hp) ff.Player.GetInfo().PetList[j].SkillList = ff.AllPet[i].Info.SkillList } diff --git a/logic/service/fight/node/PetSwitch.go b/logic/service/fight/node/PetSwitch.go index 010af460..0ad7a2b9 100644 --- a/logic/service/fight/node/PetSwitch.go +++ b/logic/service/fight/node/PetSwitch.go @@ -17,5 +17,9 @@ func (e *EffectNode) SwitchOut(in *input.Input) bool { ///我放下场 e.Alive(false) } + + if in == e.Ctx().Our { + e.Alive(false) + } return true } diff --git a/modules/blazing/controller/admin/melee.go b/modules/config/controller/admin/cdk.go similarity index 53% rename from modules/blazing/controller/admin/melee.go rename to modules/config/controller/admin/cdk.go index f0c24080..6aa6c85e 100644 --- a/modules/blazing/controller/admin/melee.go +++ b/modules/config/controller/admin/cdk.go @@ -5,18 +5,18 @@ import ( "blazing/modules/config/service" ) -type MeleeController struct { +type CdkController struct { *cool.Controller } func init() { - var task_info_controller = &MeleeController{ - &cool.Controller{ - Prefix: "/admin/monster/melee", - Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"}, - Service: service.NewMELEEService(), - }, - } + // 注册路由 - cool.RegisterController(task_info_controller) + cool.RegisterController(&CdkController{ + &cool.Controller{ + Prefix: "/admin/game/cdk", + Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"}, + Service: service.NewCdkService(), + }, + }) } diff --git a/modules/config/controller/admin/item.go b/modules/config/controller/admin/item.go new file mode 100644 index 00000000..0d26c2b0 --- /dev/null +++ b/modules/config/controller/admin/item.go @@ -0,0 +1,22 @@ +package admin + +import ( + "blazing/cool" + "blazing/modules/config/service" +) + +type ItemController struct { + *cool.Controller +} + +func init() { + + // 注册路由 + cool.RegisterController(&ItemController{ + &cool.Controller{ + Prefix: "/admin/game/item", + Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"}, + Service: service.NewItemService(), + }, + }) +} diff --git a/modules/config/controller/admin/shiny.go b/modules/config/controller/admin/shiny.go new file mode 100644 index 00000000..a86264a8 --- /dev/null +++ b/modules/config/controller/admin/shiny.go @@ -0,0 +1,22 @@ +package admin + +import ( + "blazing/cool" + "blazing/modules/config/service" +) + +type ColorController struct { + *cool.Controller +} + +func init() { + + // 注册路由 + cool.RegisterController(&ColorController{ + &cool.Controller{ + Prefix: "/admin/game/shiny", + Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"}, + Service: service.NewShinyService(), + }, + }) +} diff --git a/modules/config/model/shiny.go b/modules/config/model/shiny.go index 5d4eb520..5a0ef661 100644 --- a/modules/config/model/shiny.go +++ b/modules/config/model/shiny.go @@ -1,10 +1,7 @@ package model import ( - "blazing/common/data" "blazing/cool" - "errors" - "fmt" ) // 表名常量定义:炫彩皮肤表 @@ -31,16 +28,6 @@ type ColorfulSkin struct { Remark string `gorm:"size:512;default:'';comment:'炫彩皮肤备注'" json:"remark" description:"备注信息"` } -// ColorfulSkinEX 炫彩皮肤扩展模型(用于前端/业务层展示,非数据库存储字段) -type ColorfulSkinEX struct { - ColorfulSkin // 嵌入核心炫彩皮肤模型 - - ColorS data.GlowFilter `json:"color" description:"光环名称(前端展示用,关联光环配置表查询)"` - BindElfNames []string `json:"bind_elf_names" description:"绑定精灵名称列表"` - IsEnabledDesc string `json:"is_enabled_desc" description:"启用状态描述"` - IsUniversalDesc string `json:"is_universal_desc" description:"通用状态描述"` -} - // -------------------------- 核心配套方法(仅更名适配,逻辑不变)-------------------------- func (*ColorfulSkin) TableName() string { return TableNameColorfulSkin @@ -65,55 +52,6 @@ func NewColorfulSkin() *ColorfulSkin { } } -// -------------------------- 业务操作方法(逻辑不变,仅调整提示信息标识)-------------------------- - -// AddBindElfId 为炫彩皮肤添加单个绑定精灵ID(避免重复添加) -func (c *ColorfulSkin) AddBindElfId(elfId uint32) error { - if elfId == 0 { - return errors.New("绑定精灵ID不能为空(不能为0)") - } - // 检查是否已绑定,避免重复 - for _, id := range c.BindElfIds { - if id == elfId { - return fmt.Errorf("精灵ID%d已绑定当前炫彩皮肤配置,无需重复添加", elfId) - } - } - c.BindElfIds = append(c.BindElfIds, elfId) - return nil -} - -// RemoveBindElfId 从炫彩皮肤移除单个绑定精灵ID -func (c *ColorfulSkin) RemoveBindElfId(elfId uint32) error { - if elfId == 0 { - return errors.New("绑定精灵ID不能为空(不能为0)") - } - for i, id := range c.BindElfIds { - if id == elfId { - c.BindElfIds = append(c.BindElfIds[:i], c.BindElfIds[i+1:]...) - return nil - } - } - return fmt.Errorf("当前炫彩皮肤配置未绑定精灵ID%d,无法移除", elfId) -} - -// AddRefreshCount 增加刷新次数(支持批量累加,默认累加1) -func (c *ColorfulSkin) AddRefreshCount(addNum uint32) error { - if addNum <= 0 { - return errors.New("增加的刷新次数必须大于0") - } - c.RefreshCount += addNum - return nil -} - -// AddUsageCount 增加使用次数(支持批量累加,默认累加1) -func (c *ColorfulSkin) AddUsageCount(addNum uint32) error { - if addNum <= 0 { - return errors.New("增加的使用次数必须大于0") - } - c.UsageCount += addNum - return nil -} - // -------------------------- 表结构自动同步 -------------------------- func init() { cool.CreateTable(&ColorfulSkin{}) diff --git a/modules/config/service/cdk.go b/modules/config/service/cdk.go new file mode 100644 index 00000000..de0c7cdd --- /dev/null +++ b/modules/config/service/cdk.go @@ -0,0 +1,18 @@ +package service + +import ( + "blazing/cool" + "blazing/modules/config/model" +) + +type CdkService struct { + *cool.Service +} + +func NewCdkService() *CdkService { + return &CdkService{ + &cool.Service{ + Model: model.NewCDKConfig(), + }, + } +} diff --git a/modules/config/service/shiny.go b/modules/config/service/shiny.go new file mode 100644 index 00000000..e30311c5 --- /dev/null +++ b/modules/config/service/shiny.go @@ -0,0 +1,18 @@ +package service + +import ( + "blazing/cool" + "blazing/modules/config/model" +) + +type ShinyService struct { + *cool.Service +} + +func NewShinyService() *ShinyService { + return &ShinyService{ + &cool.Service{ + Model: model.NewColorfulSkin(), + }, + } +}