feat(effect): 新增回合结束计数逻辑并调整伤害处理流程

在 Effect46 中新增 `Turn_End` 方法用于回合结束时增加计数器,并移除了原有在
`Damage_DIV_ex` 方法中重复的自增操作,以确保逻辑清晰且统一。

---

fix(monster): 调整异色宠物生成规则及捕获概率

测试服环境下强制开启异色宠物生成,并将原捕获概率由 30% 调整为 1%,提升
稀有精灵
This commit is contained in:
2025-12-15 04:02:03 +08:00
parent 77f3d153c6
commit d2467363e8
6 changed files with 166 additions and 72 deletions

View File

@@ -16,6 +16,9 @@ type Effect46 struct {
conut int64
}
func (e *Effect46) Turn_End() {
e.conut++
}
func (e *Effect46) Damage_DIV_ex(t *info.DamageZone) bool {
if !e.Hit() {
return true
@@ -37,7 +40,7 @@ func (e *Effect46) Damage_DIV_ex(t *info.DamageZone) bool {
t.Damage = alpacadecimal.NewFromInt(0)
}
e.conut++
//fmt.Println("Effect46_n", t.Damage)
return true
}

View File

@@ -2,6 +2,7 @@ package player
import (
"blazing/common/data/xmlres"
"blazing/cool"
"blazing/logic/service/common"
"strings"
"sync/atomic"
@@ -50,11 +51,12 @@ func (p *Player) genMonster() {
if ttt.Id != 0 {
ttt.Lv = gconv.Uint32(RandomStringFromSlice(lv))
if xmlres.PetMAP[int(ttt.Id)].CatchRate != 0 && grand.Meet(30, 100) {
if cool.Config.PortBL == 2 { //测试服,百分百异色
ttt.RandSHiny(int64(i))
}
if xmlres.PetMAP[int(ttt.Id)].CatchRate != 0 && grand.Meet(1, 100) {
ttt.RandSHiny(int64(i))
}
if len(id) == 1 { //说明这里只固定刷一个,概率变尼尔尼奥
// nier, _, _ := p.Roll(10, 1000)

View File

@@ -0,0 +1,22 @@
package admin
import (
"blazing/cool"
"blazing/modules/blazing/service"
)
type MeleeController 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)
}

View File

@@ -5,81 +5,22 @@ import (
)
const (
TableNameBossConfig = "boss_config" // BOSS配置表全量包含基础/奖励/护盾/捕捉/特效/世界野怪/地图费用/战斗通用逻辑)
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"`
// ===================== 基础配置 =====================
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"`
Atk int32 `gorm:"not null;comment:'BOSS物理攻击'" json:"atk"`
Def int32 `gorm:"not null;comment:'BOSS物理防御'" json:"def"`
Spatk int32 `gorm:"not null;comment:'BOSS特殊攻击'" json:"spatk"`
Spdef int32 `gorm:"not null;comment:'BOSS特殊防御'" json:"spdef"`
Spd int32 `gorm:"not null;comment:'BOSS速度'" json:"spd"`
// ===================== 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-20000无特效对应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"`
ISgift uint32 `gorm:"not null;default:0;comment:'是否是礼物'" json:"is_gif"`
}
// BossConfigEX 扩展BOSS配置模型用于前端/业务层的数组格式解析)
type BossConfigEX struct {
BossConfig
NewSeIdxs []uint32 `json:"new_se_idxs"` // 特效idx数组解析空格分隔的字符串为数组
Color GlowFilter `json:"color"`
}
// TableName 指定BossConfig对应的数据库表名
@@ -93,12 +34,10 @@ func (*BossConfig) GroupName() string {
}
// NewBossConfig 创建一个新的BossConfig实例初始化通用Model字段+所有默认值)
func NewBossConfig() *BossConfig {
return &BossConfig{
Model: cool.NewModel(),
BonusTotalProbability: 1000, // 奖励概率分母默认1000
WorldWildEnd: 23, // 世界野怪结束时间默认23
Model: cool.NewModel(),
}
}

View File

@@ -0,0 +1,110 @@
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:"not null;default:'0';comment:'BOSS颜色'" json:"color"`
// 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-20000无特效对应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配置模型用于前端/业务层的数组格式解析)
type MeleeConfigEX struct {
MeleeConfig
Color GlowFilter `json:"color"`
ISboss uint32 `gorm:"not null;default:0;comment:'是否是Boss'" json:"is_boss"`
ISgift uint32 `gorm:"not null;default:0;comment:'是否是礼物'" json:"is_gif"`
}
// 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{})
}

View File

@@ -0,0 +1,18 @@
package service
import (
"blazing/cool"
"blazing/modules/blazing/model"
)
type MELEEService struct {
*cool.Service
}
func NewMELEEService() *MELEEService {
return &MELEEService{
&cool.Service{
Model: model.NewMeettConfig(),
},
}
}