feat(player): 改进怪物生成逻辑支持多配置遍历 修改了Monster.go中的GenMonster函数,将原来的随机选择单个配置改为遍历所有配置, 确保每个符合条件的配置都有机会被处理。同时保持了原有的等级范围、特殊属性设置 和NPC战斗处理逻辑。 BREAKING CHANGE: 怪物生成机制从单一随机选择改为配置遍历匹配 ```
This commit is contained in:
@@ -59,32 +59,35 @@ func (p *Player) GenMonster() {
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
v := ogreconfig[grand.Intn(len(ogreconfig))]
|
||||
if !p.IsMatch(*v.Event) {
|
||||
continue
|
||||
}
|
||||
for _, v := range ogreconfig {
|
||||
|
||||
p.Data[i] = OgrePetInfo{}
|
||||
p.Data[i].ID = uint32(v.RefreshID[grand.Intn(len(v.RefreshID))])
|
||||
if !p.IsMatch(*v.Event) {
|
||||
continue
|
||||
}
|
||||
|
||||
if p.Data[i].ID != 0 {
|
||||
p.Data[i] = OgrePetInfo{}
|
||||
p.Data[i].ID = uint32(v.RefreshID[grand.Intn(len(v.RefreshID))])
|
||||
|
||||
p.Data[i].Lv = uint32(grand.N(v.MinLevel, v.MaxLevel))
|
||||
if p.Data[i].ID != 0 {
|
||||
|
||||
if len(v.RefreshID) == 1 { //说明这里只固定刷一个,概率变尼尔尼奥,不是稀有精灵
|
||||
p.Data[i].Lv = uint32(grand.N(v.MinLevel, v.MaxLevel))
|
||||
|
||||
if len(v.RefreshID) == 1 { //说明这里只固定刷一个,概率变尼尔尼奥,不是稀有精灵
|
||||
|
||||
nieo := grand.Meet(20, 1000)
|
||||
if nieo {
|
||||
p.Data[i].Ext = 77
|
||||
if grand.Meet(1, 2) {
|
||||
p.Data[i].Ext = 416
|
||||
}
|
||||
|
||||
nieo := grand.Meet(20, 1000)
|
||||
if nieo {
|
||||
p.Data[i].Ext = 77
|
||||
if grand.Meet(1, 2) {
|
||||
p.Data[i].Ext = 416
|
||||
}
|
||||
|
||||
}
|
||||
p.Data[i].HandleNPCFightSpecial(v.IsCapture)
|
||||
break
|
||||
|
||||
}
|
||||
p.Data[i].HandleNPCFightSpecial(v.IsCapture)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user