refactor: 优化怪物生成逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-17 14:14:03 +08:00
committed by cnb
parent e4f2280625
commit a47b35df88

View File

@@ -59,35 +59,32 @@ 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 {
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
}
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
}
}
p.Data[i].HandleNPCFightSpecial(v.IsCapture)
}
p.Data[i].HandleNPCFightSpecial(v.IsCapture)
}
}