```
feat(fight): 实现精灵切换时的出战和下场触发机制 - 新增SwitchOut接口方法用于精灵下场时触发 - 重命名Switch为SwitchIn用于精灵出战时触发 - 在战斗流程中添加精灵下场时的广播调用 - 修改EffectDefeatTrigger等效果的切换逻辑 refactor(effects): 优化战斗效果的切换处理逻辑 - 修改Effect147和Effect148的触发条件判断逻辑 -
This commit is contained in:
@@ -33,7 +33,7 @@ func (h Controller) GetTalkCategory(data *item.TalkCateInboundInfo, c *player.Pl
|
||||
|
||||
//service.NewItemService().GetItemCount(config.ItemID)
|
||||
|
||||
for _, itemID := range config.ItemID {
|
||||
for _, itemID := range config.ItemIDS {
|
||||
itemCount := service.NewItemService().GetItemCount(itemID)
|
||||
success := c.ItemAdd(uint32(itemID), uint32(itemCount))
|
||||
if success {
|
||||
|
||||
@@ -18,7 +18,7 @@ type NewSel0 struct {
|
||||
// 重写回合结束效果,特性都是无线回合类的
|
||||
// 次数类本质上也是这种
|
||||
// 特性,无法被切精灵消除
|
||||
func (e *NewSel0) Switch(in *input.Input, at info.AttackValue, outpet *info.BattlePetEntity) bool {
|
||||
func (e *NewSel0) SwitchOut(in *input.Input) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ type EffectDefeatTrigger struct {
|
||||
node.EffectNode
|
||||
can bool // 标记技能是否生效(当次攻击有效)
|
||||
effectID int // 效果ID,用于区分不同触发行为
|
||||
isd bool
|
||||
info info.AttackValue
|
||||
}
|
||||
|
||||
// 工厂函数:创建"击败触发"效果实例,传入效果ID
|
||||
@@ -51,9 +53,7 @@ func (e *EffectDefeatTrigger) OnSkill() bool {
|
||||
e.can = true // 标记当次攻击有效
|
||||
return true
|
||||
}
|
||||
|
||||
// Switch:检查是否击败对方,满足条件则根据effectID触发对应行为
|
||||
func (e *EffectDefeatTrigger) Switch(in *input.Input, at info.AttackValue, oldpet *info.BattlePetEntity) bool {
|
||||
func (e *EffectDefeatTrigger) SwitchOut(in *input.Input) bool {
|
||||
// 1. 检查效果是否生效(当次攻击有效)
|
||||
if !e.can {
|
||||
return true
|
||||
@@ -62,10 +62,29 @@ func (e *EffectDefeatTrigger) Switch(in *input.Input, at info.AttackValue, oldpe
|
||||
if in == e.Ctx().Our {
|
||||
return true
|
||||
}
|
||||
// 3. 检查对方上一只精灵是否被击败(触发条件)
|
||||
if oldpet.NotAlive {
|
||||
e.triggerByID(at)
|
||||
|
||||
if e.Ctx().Our.CurrentPet.Info.Hp > 0 {
|
||||
return true
|
||||
}
|
||||
e.isd = true
|
||||
e.info = *e.Ctx().Opp.AttackValue
|
||||
return true
|
||||
}
|
||||
|
||||
// Switch:检查是否击败对方,满足条件则根据effectID触发对应行为
|
||||
func (e *EffectDefeatTrigger) SwitchIn(in *input.Input) bool {
|
||||
// 1. 检查效果是否生效(当次攻击有效)
|
||||
if !e.can {
|
||||
return true
|
||||
}
|
||||
if !e.isd { //不是击败触发
|
||||
return true
|
||||
}
|
||||
// 2. 过滤我方切精灵的情况(只处理对方切精灵)
|
||||
if in == e.Ctx().Our {
|
||||
return true
|
||||
}
|
||||
e.triggerByID(e.info)
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/action"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
"blazing/logic/service/fight/node"
|
||||
|
||||
"github.com/alpacahq/alpacadecimal"
|
||||
)
|
||||
|
||||
// -----------------------------------------------------------
|
||||
@@ -21,18 +18,10 @@ func (e *Effect147) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
// 后出手判定:我方速度 <= 对方速度
|
||||
if e.Ctx().Our.CurrentPet.Info.Prop[4] <= e.Ctx().Opp.CurrentPet.Info.Prop[4] {
|
||||
e.can = true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect147) Switch(in *input.Input, _ info.AttackValue, _ *info.BattlePetEntity) bool {
|
||||
if !e.can {
|
||||
if e.Ctx().Our.FightC.IsFirst(e.Ctx().Our.Player) {
|
||||
return true
|
||||
}
|
||||
|
||||
chance := int(e.Args()[0].IntPart())
|
||||
|
||||
ok, _, _ := e.Input.Player.Roll(chance, 100)
|
||||
@@ -45,7 +34,7 @@ func (e *Effect147) Switch(in *input.Input, _ info.AttackValue, _ *info.BattlePe
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, statusEff)
|
||||
}
|
||||
}
|
||||
e.can = false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -61,18 +50,9 @@ func (e *Effect148) OnSkill() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
// 后出手判定
|
||||
if e.Ctx().Our.CurrentPet.Info.Prop[4] <= e.Ctx().Opp.CurrentPet.Info.Prop[4] {
|
||||
e.can = true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *Effect148) Switch(in *input.Input, _ info.AttackValue, _ *info.BattlePetEntity) bool {
|
||||
if !e.can {
|
||||
if e.Ctx().Our.FightC.IsFirst(e.Ctx().Our.Player) {
|
||||
return true
|
||||
}
|
||||
|
||||
propIndex := int(e.Args()[0].IntPart())
|
||||
chance := int(e.Args()[1].IntPart())
|
||||
changeAmount := int(e.Args()[2].IntPart())
|
||||
@@ -85,33 +65,6 @@ func (e *Effect148) Switch(in *input.Input, _ info.AttackValue, _ *info.BattlePe
|
||||
}
|
||||
e.Ctx().Opp.SetProp(e.Ctx().Our, int8(propIndex), int8(changeAmount), opType)
|
||||
}
|
||||
e.can = false
|
||||
return true
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------
|
||||
// 效果154:若对手{0},则对对方造成伤害的1/{1}恢复自身体力
|
||||
// -----------------------------------------------------------
|
||||
type Effect154 struct {
|
||||
node.EffectNode
|
||||
oppStatus info.EnumPetStatus
|
||||
}
|
||||
|
||||
func (e *Effect154) SetArgs(t *input.Input, a ...int) {
|
||||
e.EffectNode.SetArgs(t, a...)
|
||||
e.oppStatus = info.EnumPetStatus(e.Args()[0].IntPart())
|
||||
}
|
||||
|
||||
func (e *Effect154) Skill_Useed() bool {
|
||||
if !e.Hit() {
|
||||
return true
|
||||
}
|
||||
|
||||
// 简化实现:直接使用状态类型判断(实际应用中可以通过其他方式检查对手状态)
|
||||
// 恢复自身体力:造成伤害的1/{1}
|
||||
denominator := int(e.Args()[1].IntPart())
|
||||
healAmount := e.Ctx().Our.SumDamage.Div(alpacadecimal.NewFromInt(int64(denominator)))
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||||
|
||||
return true
|
||||
}
|
||||
@@ -156,6 +109,6 @@ func (e *Effect159) OnSkill() bool {
|
||||
func init() {
|
||||
input.InitEffect(input.EffectType.Skill, 147, &Effect147{})
|
||||
input.InitEffect(input.EffectType.Skill, 148, &Effect148{})
|
||||
input.InitEffect(input.EffectType.Skill, 154, &Effect154{})
|
||||
//input.InitEffect(input.EffectType.Skill, 154, &Effect154{})
|
||||
input.InitEffect(input.EffectType.Skill, 159, &Effect159{})
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func (e *Effect59) OnSkill() bool {
|
||||
e.Ctx().Our.CurrentPet.NotAlive = true
|
||||
return true
|
||||
}
|
||||
func (e *Effect59) Switch(in *input.Input, at info.AttackValue, oldpet *info.BattlePetEntity) bool {
|
||||
func (e *Effect59) SwitchIn(in *input.Input) bool {
|
||||
// 1. 检查效果是否生效(当次攻击有效)
|
||||
if !e.can {
|
||||
return true
|
||||
|
||||
@@ -110,14 +110,3 @@ func (e *Effect62) OnSkill() bool {
|
||||
e.Ctx().Opp.AddEffect(e.Ctx().Our, ee)
|
||||
return true
|
||||
}
|
||||
|
||||
// // 因为对方切精灵,这个效果也要无效掉
|
||||
// func (this *Effect62) OnSwitchIn(input.Ctx) bool {
|
||||
// if this.Hide { //如果还在隐藏,就直接返回
|
||||
// return true
|
||||
// }
|
||||
// //this.GetBattle().Effects[this.GetInput().UserID].RemoveEffect(this)
|
||||
// //否则触发秒杀 在对面使用技能后
|
||||
// return true
|
||||
|
||||
// }
|
||||
|
||||
@@ -43,7 +43,7 @@ func (e *Effect71) OnSkill() bool {
|
||||
e.Ctx().Our.CurrentPet.NotAlive = true
|
||||
return true
|
||||
}
|
||||
func (e *Effect71) Switch(in *input.Input, at info.AttackValue, oldpet *info.BattlePetEntity) bool {
|
||||
func (e *Effect71) SwitchIn(in *input.Input) bool {
|
||||
// 1. 检查效果是否生效(当次攻击有效)
|
||||
if !e.can {
|
||||
return true
|
||||
|
||||
@@ -254,7 +254,16 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
"对手剩余血量:", defender.CurrentPet.Info.Hp,
|
||||
)
|
||||
if attacker.CurrentPet.Info.Hp <= 0 {
|
||||
defender.CurrentPet.NotAlive = true
|
||||
attacker.CurrentPet.NotAlive = true
|
||||
f.Broadcast(func(ff *input.Input) {
|
||||
|
||||
ff.Exec(func(t input.Effect) bool {
|
||||
|
||||
t.SwitchOut(attacker)
|
||||
|
||||
return true
|
||||
})
|
||||
})
|
||||
if defender.CurrentPet.Info.Hp == 0 { //先手方死亡,触发反同归于尽
|
||||
|
||||
defender.CurrentPet.Info.Hp = 1
|
||||
@@ -280,6 +289,15 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
//defender.CanAction = true //被打死就可以切精灵了
|
||||
// AI自动技能
|
||||
defender.CurrentPet.NotAlive = true
|
||||
f.Broadcast(func(ff *input.Input) {
|
||||
|
||||
defender.Exec(func(t input.Effect) bool {
|
||||
|
||||
t.SwitchOut(defender)
|
||||
|
||||
return true
|
||||
})
|
||||
})
|
||||
if f.IsWin(attacker) { //然后检查是否战斗结束
|
||||
var WinnerId uint32
|
||||
if i == 0 {
|
||||
|
||||
@@ -40,7 +40,8 @@ type Effect interface {
|
||||
|
||||
// 首发其实就是切换的精灵为nil
|
||||
|
||||
Switch(in *Input, at info.AttackValue, outpet *info.BattlePetEntity) bool // 精灵出战 / 上场时触发
|
||||
SwitchIn(in *Input) bool // 精灵出战 / 上场时触发
|
||||
SwitchOut(in *Input) bool // 精灵下场时触发
|
||||
//OnSwitchOut() bool // 精灵下场时触发
|
||||
// OnOwnerSwitchIn() bool // 所属玩家精灵出战时触发
|
||||
// OnOwnerSwitchOut() bool // 所属玩家精灵下场时触发
|
||||
|
||||
@@ -147,13 +147,22 @@ func (f *FightC) collectPlayerActions(ourID, oppID uint32) map[uint32]action.Bat
|
||||
if selfinput.CanChange == 0 {
|
||||
if selfinput.CurrentPet.Info.Hp > 0 { //非死亡切换
|
||||
selfinput.CanChange = 1
|
||||
f.Broadcast(func(ff *input.Input) {
|
||||
|
||||
ff.Exec(func(t input.Effect) bool {
|
||||
|
||||
t.SwitchOut(selfinput)
|
||||
|
||||
return true
|
||||
})
|
||||
})
|
||||
} else {
|
||||
|
||||
selfinput.CanChange = 2
|
||||
|
||||
}
|
||||
oldpet := selfinput.CurrentPet
|
||||
InitAttackValue := *selfinput.AttackValue
|
||||
// oldpet := selfinput.CurrentPet
|
||||
// InitAttackValue := *selfinput.AttackValue
|
||||
selfinput.CurrentPet, ret.Reason = selfinput.GetPet(ret.Cid)
|
||||
selfinput.Player.SendPackCmd(2407, &ret.Reason)
|
||||
|
||||
@@ -166,7 +175,7 @@ func (f *FightC) collectPlayerActions(ourID, oppID uint32) map[uint32]action.Bat
|
||||
|
||||
ff.Exec(func(t input.Effect) bool {
|
||||
|
||||
t.Switch(selfinput, InitAttackValue, oldpet)
|
||||
t.SwitchIn(selfinput)
|
||||
|
||||
return true
|
||||
})
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
)
|
||||
|
||||
// 切精灵返回false,重写change方法来实现切换效果
|
||||
// 精灵切换相关触发
|
||||
func (e *EffectNode) SwitchIn(in *input.Input) bool {
|
||||
|
||||
func (e *EffectNode) Switch(in *input.Input, at info.AttackValue, outpet *info.BattlePetEntity) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (e *EffectNode) SwitchOut(in *input.Input) bool {
|
||||
//说明是我放切精灵
|
||||
if e.Input == in {
|
||||
//下场,执行消回合效果
|
||||
@@ -17,6 +17,5 @@ func (e *EffectNode) Switch(in *input.Input, at info.AttackValue, outpet *info.B
|
||||
///我放下场
|
||||
e.Alive(false)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"blazing/common/data"
|
||||
"blazing/cool"
|
||||
)
|
||||
|
||||
const (
|
||||
TableNameBossConfig = "config_pet_boss" // BOSS配置表(全量包含基础/奖励/护盾/捕捉/特效/世界野怪/地图费用/战斗通用逻辑)
|
||||
)
|
||||
|
||||
// BossConfig BOSS配置模型(覆盖所有补充的配置项:GBTL/非VIP费用/首场景/战斗通用逻辑)
|
||||
type BossConfig struct {
|
||||
*cool.Model // 嵌入通用Model(包含ID/创建时间/更新时间等通用字段)
|
||||
MeleeConfig
|
||||
// ISboss uint32 `gorm:"not null;default:0;comment:'是否是Boss'" json:"is_boss"`
|
||||
|
||||
// ISgift uint32 `gorm:"not null;default:0;comment:'是否是礼物'" json:"is_gif"`
|
||||
}
|
||||
|
||||
// BossConfigEX 扩展BOSS配置模型(用于前端/业务层的数组格式解析)
|
||||
type BossConfigEX struct {
|
||||
BossConfig
|
||||
Color data.GlowFilter `json:"color"`
|
||||
}
|
||||
|
||||
// TableName 指定BossConfig对应的数据库表名
|
||||
func (*BossConfig) TableName() string {
|
||||
return TableNameBossConfig
|
||||
}
|
||||
|
||||
// GroupName 指定表所属的分组(保持和怪物刷新表一致)
|
||||
func (*BossConfig) GroupName() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
// NewBossConfig 创建一个新的BossConfig实例(初始化通用Model字段+所有默认值)
|
||||
|
||||
func NewBossConfig() *BossConfig {
|
||||
return &BossConfig{
|
||||
Model: cool.NewModel(),
|
||||
}
|
||||
}
|
||||
|
||||
// init 程序启动时自动创建/同步boss_config表结构
|
||||
func init() {
|
||||
cool.CreateTable(&BossConfig{})
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
)
|
||||
|
||||
const (
|
||||
TableNameMeleeConfig = "config_pet_melee" // BOSS配置表(全量包含基础/奖励/护盾/捕捉/特效/世界野怪/地图费用/战斗通用逻辑)
|
||||
)
|
||||
|
||||
// MeleeConfig BOSS配置模型(覆盖所有补充的配置项:GBTL/非VIP费用/首场景/战斗通用逻辑)
|
||||
type MeleeConfig struct {
|
||||
*cool.Model // 嵌入通用Model(包含ID/创建时间/更新时间等通用字段)
|
||||
|
||||
// ===================== 基础配置 =====================
|
||||
//BossID int32 `gorm:"not null;comment:'BOSS唯一标识ID'" json:"boss_id"`
|
||||
//MapID int32 `gorm:"not null;comment:'BOSS所在地图ID'" json:"map_id"`
|
||||
// InitX int32 `gorm:"not null;default:0;comment:'BOSS初始X坐标(对应玩家登陆坐标逻辑)'" json:"init_x"`
|
||||
// InitY int32 `gorm:"not null;default:0;comment:'BOSS初始Y坐标(对应玩家登陆坐标逻辑)'" json:"init_y"`
|
||||
// BossVisible int32 `gorm:"not null;default:0;comment:'BOSS是否可见(0:不可见,1:可见)'" json:"boss_visible"`
|
||||
// AppearTime string `gorm:"not null;comment:'BOSS出现时间(格式示例:0 23,空格分隔的时间点)'" json:"appear_time"`
|
||||
// Name string `gorm:"not null;comment:'BOSS名称'" json:"name"`
|
||||
// NonVipCost int32 `gorm:"not null;default:0;comment:'非VIP用户进地图需支付的赛尔豆(VIP用户免费,默认0)'" json:"non_vip_cost"`
|
||||
// PrimaryScene int32 `gorm:"not null;default:0;comment:'首场景标识(0:非首场景地图;n>0:第n星系的星球且是首场景,默认0)'" json:"primary_scene"`
|
||||
|
||||
// ===================== 战斗核心属性(BossMon节点) =====================
|
||||
MonID int32 `gorm:"not null;comment:'BOSS对应的精灵ID'" json:"mon_id"`
|
||||
Hp int32 `gorm:"not null;comment:'BOSS血量值(LvHpMatchUser非0时此配置无效)'" json:"hp"`
|
||||
Lv int32 `gorm:"not null;comment:'BOSS等级(LvHpMatchUser非0时此配置无效)'" json:"lv"`
|
||||
// ===================== BOSS属性(Boss_prop) =====================
|
||||
Prop []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS属性'" json:"prop"`
|
||||
Nature uint32 `gorm:"not null;default:0;comment:'BOSS属性-性格'" json:"nature"`
|
||||
SKill []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS技能'" json:"skill"`
|
||||
Effect []uint32 `gorm:"type:jsonb;not null;default:'[]';comment:'BOSS特性'" json:"effect"`
|
||||
Color string `gorm:"comment:'BOSS颜色'" json:"color"`
|
||||
IsEnable uint32 `gorm:"not null;default:0;comment:'是否启用'" json:"is_enable"`
|
||||
Desc *string `gorm:"comment:'BOSS描述'" json:"desc"`
|
||||
|
||||
// ISMELEE uint32 `gorm:"not null;default:0;comment:'是否乱斗配置'" json:"is_melee"`
|
||||
// // ===================== BOSS奖励规则(Boss_bonus) =====================
|
||||
// BonusProbability int32 `gorm:"not null;default:0;comment:'打赢BOSS给奖励概率-分子(值域:0-1000,默认0)'" json:"bonus_probability"`
|
||||
// BonusTotalProbability int32 `gorm:"not null;default:1000;comment:'打赢BOSS给奖励概率-分母(值域:1000,默认1000)'" json:"bonus_total_probability"`
|
||||
// BonusMonsterProbability int32 `gorm:"not null;default:0;comment:'给精灵奖励比例(值域:0-1000,默认0;物品奖励比例=分母-此值)'" json:"bonus_monster_probability"`
|
||||
// BonusID int32 `gorm:"not null;comment:'奖励ID(必配,有效BonusID)'" json:"bonus_id"`
|
||||
// MonBonusOutID int32 `gorm:"not null;comment:'精灵奖励ID(必配,有效精灵BonusID,奖精灵时生效)'" json:"mon_bonus_out_id"`
|
||||
// ItemBonusOutID int32 `gorm:"not null;comment:'物品奖励ID(必配,有效物品BonusID,奖物品时生效)'" json:"item_bonus_out_id"`
|
||||
|
||||
// NewSeIdxs string `gorm:"type:text;not null;default:'0';comment:'新特效idx(值域:1-2000,0无特效,对应conf/new_se.xml,空格分隔列表)'" json:"new_se_idxs"`
|
||||
|
||||
// // ===================== BOSS护盾属性 =====================
|
||||
// Shield int32 `gorm:"not null;default:0;comment:'BOSS护盾Hp(如蘑菇怪,默认0)'" json:"shield"`
|
||||
// MaxAccLostShield int32 `gorm:"not null;default:0;comment:'护盾变化通知AS的阈值(默认0)'" json:"max_acc_lost_shield"`
|
||||
// ShieldRecoverTime int32 `gorm:"not null;default:0;comment:'护盾恢复时间间隔(默认0)'" json:"shield_recover_time"`
|
||||
|
||||
// // ===================== BOSS对战/捕捉规则 =====================
|
||||
// BossCatchable int32 `gorm:"not null;default:0;comment:'BOSS是否可被捕捉(0:否,1:是,默认0)'" json:"boss_catchable"`
|
||||
// BossFinOnce int32 `gorm:"not null;default:0;comment:'拥有后是否不能再打(0:否,1:是,默认0)'" json:"boss_fin_once"`
|
||||
// BossFinTaskWay int32 `gorm:"not null;default:0;comment:'完成任务方式(0:正常+捕捉;1:仅正常;2:仅捕捉,默认0)'" json:"boss_fin_task_way"`
|
||||
// PkFlag int32 `gorm:"not null;default:0;comment:'是否单精灵对战(0:否,1:是,默认0)'" json:"pk_flag"`
|
||||
// LvHpMatchUser int32 `gorm:"not null;default:0;comment:'等级血量匹配用户(0:无效;2:低5级;3:高2级;4:高5级;5:低10级;6:低5级且HP4倍;7:同等级且HP2.5倍)'" json:"lv_hp_match_user"`
|
||||
// //VipOnly int32 `gorm:"not null;default:0;comment:'仅VIP可打(0:否,1:是,默认0)'" json:"vip_only"`
|
||||
|
||||
// // ===================== 世界野怪变身配置 =====================
|
||||
// WorldWildProb int32 `gorm:"not null;default:0;comment:'变身世界野怪概率分子(值域:0-1000,默认0)'" json:"world_wild_prob"`
|
||||
// WorldWildMonId int32 `gorm:"not null;default:0;comment:'变身世界野怪的精灵ID(默认0)'" json:"world_wild_mon_id"`
|
||||
// WorldWildMonLv int32 `gorm:"not null;default:0;comment:'变身世界野怪的等级(默认0)'" json:"world_wild_mon_lv"`
|
||||
// WorldWildStart int32 `gorm:"not null;default:0;comment:'世界野怪出现起始时间(值域:0-23,默认0)'" json:"world_wild_start"`
|
||||
// WorldWildEnd int32 `gorm:"not null;default:23;comment:'世界野怪出现终止时间(值域:0-23,默认23)'" json:"world_wild_end"`
|
||||
|
||||
// // ===================== 战斗开始/结束通用逻辑配置 =====================
|
||||
// // 支持battle_mode_vs_boss battle_mode_no_region_boss,战斗协议2411、41129
|
||||
// TimeFlag int32 `gorm:"not null;default:0;comment:'战斗时间判断标识(关联activity_config_pool.xml,默认0)'" json:"time_flag"`
|
||||
// DailyKey string `gorm:"not null;default:'';comment:'战斗每天挑战次数key(为空则不限制次数)'" json:"daily_key"`
|
||||
// MaxTimes int32 `gorm:"not null;default:0;comment:'每天挑战上限(非0生效,默认0)'" json:"max_times"`
|
||||
// VipMaxTimes int32 `gorm:"not null;default:0;comment:'VIP每天挑战上限(非0生效,0时等于MaxTimes,默认0)'" json:"vip_max_times"`
|
||||
// WinBonusId int32 `gorm:"not null;default:0;comment:'战斗成功输出奖励ID(对应no_wait_bonus.xml,默认0)'" json:"win_bonus_id"`
|
||||
// WinOutId int32 `gorm:"not null;default:0;comment:'战斗成功输出奖励OutID(对应no_wait_bonus.xml,默认0)'" json:"win_out_id"`
|
||||
// FailBonusId int32 `gorm:"not null;default:0;comment:'战斗失败输出奖励ID(对应no_wait_bonus.xml,默认0)'" json:"fail_bonus_id"`
|
||||
// FailOutId int32 `gorm:"not null;default:0;comment:'战斗失败输出奖励OutID(对应no_wait_bonus.xml,默认0)'" json:"fail_out_id"`
|
||||
// BitSet string `gorm:"type:text;not null;default:'';comment:'战斗成功bitset限制条件(默认空)'" json:"bit_set"`
|
||||
}
|
||||
|
||||
// MeleeConfigEX 扩展BOSS配置模型(用于前端/业务层的数组格式解析)
|
||||
|
||||
|
||||
// TableName 指定MeleeConfig对应的数据库表名
|
||||
func (*MeleeConfig) TableName() string {
|
||||
return TableNameMeleeConfig
|
||||
}
|
||||
|
||||
// GroupName 指定表所属的分组(保持和怪物刷新表一致)
|
||||
func (*MeleeConfig) GroupName() string {
|
||||
return "default"
|
||||
}
|
||||
|
||||
// NewMeleeConfig 创建一个新的MeleeConfig实例(初始化通用Model字段+所有默认值)
|
||||
|
||||
func NewMeettConfig() *MeleeConfig {
|
||||
return &MeleeConfig{
|
||||
Model: cool.NewModel(),
|
||||
}
|
||||
}
|
||||
|
||||
// init 程序启动时自动创建/同步boss_config表结构
|
||||
func init() {
|
||||
cool.CreateTable(&MeleeConfig{})
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/blazing/model"
|
||||
)
|
||||
|
||||
type BossService struct {
|
||||
*cool.Service
|
||||
}
|
||||
|
||||
func NewBossService() *BossService {
|
||||
return &BossService{
|
||||
&cool.Service{
|
||||
Model: model.NewBossConfig(),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ type MineralCollectionConfig struct {
|
||||
DailyCollectCount uint32 `gorm:"column:daily_collect_count;not null;comment:每日可采集次数" json:"daily_collect_count"`
|
||||
|
||||
// ItemID 物品编号(对应道具系统ID)
|
||||
ItemID []uint32 `gorm:"column:item_id; not null;index:idx_mineral_collection_config_item_id;comment:物品编号(对应道具系统ID)" json:"item_id"`
|
||||
ItemIDS []uint32 `gorm:"column:item_ids;type:jsonb;index:idx_mineral_collection_config_item_id;comment:物品编号(对应道具系统ID)" json:"item_ids"`
|
||||
// ItemMinCount 单次采集最小产出数量
|
||||
// ItemMinCount uint32 `gorm:"column:item_min_count;not null;comment:单次采集最小产出数量" json:"item_min_count"`
|
||||
// // ItemMaxCount 单次采集最大产出数量
|
||||
|
||||
@@ -2,7 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/blazing/model"
|
||||
"blazing/modules/config/model"
|
||||
)
|
||||
|
||||
type BossService struct {
|
||||
|
||||
@@ -2,7 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"blazing/cool"
|
||||
"blazing/modules/blazing/model"
|
||||
"blazing/modules/config/model"
|
||||
)
|
||||
|
||||
type MELEEService struct {
|
||||
@@ -16,9 +16,9 @@ func NewMELEEService() *MELEEService {
|
||||
},
|
||||
}
|
||||
}
|
||||
func (s *MELEEService) Def() []model.MeleeConfig {
|
||||
func (s *MELEEService) Def() []model.PetBaseConfig {
|
||||
|
||||
var pets []model.MeleeConfig
|
||||
var pets []model.PetBaseConfig
|
||||
m := cool.DBM(s.Model)
|
||||
|
||||
m.OrderRandom().Limit(3).Scan(&pets)
|
||||
|
||||
Reference in New Issue
Block a user