feat: 重构怪物生成和NPC战斗处理逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

调整怪物等级处理方式,将固定等级逻辑移至GetLevel方法
优化NPC战斗特殊情况的处理流程
This commit is contained in:
xinian
2026-02-26 19:28:02 +08:00
committed by cnb
parent de297c9904
commit 21ae004979
3 changed files with 14 additions and 8 deletions

View File

@@ -140,7 +140,7 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
-1,
0, //野怪没特性
int(refPet.Lv),
int(refPet.GetLevel()),
refPet.ShinyInfo, -1)
monster.CatchMap = p.Info.MapID //设置当前地图
if refPet.Ext != 0 {

View File

@@ -65,7 +65,6 @@ func (p *Player) GenMonster() {
p.Data[i].Lv = uint32(grand.N(v.MinLevel, v.MaxLevel))
if len(v.RefreshID) == 1 { //说明这里只固定刷一个,概率变尼尔尼奥,不是稀有精灵
nieo := grand.Meet(20, 1000)
@@ -75,8 +74,6 @@ func (p *Player) GenMonster() {
p.Data[i].Ext = 416
}
p.Data[i].Lv = 16
}
}

View File

@@ -46,6 +46,13 @@ func (o *OgrePetInfo) GetID() int {
}
return int(o.ID)
}
func (o *OgrePetInfo) GetLevel() int {
if o.Ext != 0 {
return 16
}
return int(o.Lv)
}
func (o *OgrePetInfo) FixSHiny() {
var co *data.GlowFilter
if o.Ext == 0 {
@@ -80,14 +87,16 @@ func (o *OgrePetInfo) RandomByWeightShiny() {
// handleNPCFightSpecial 处理NPC战斗特殊情况
func (o *OgrePetInfo) HandleNPCFightSpecial(v int) {
npcPetID := int(o.ID)
if o.Ext != 0 {
npcPetID = int(o.Ext)
} else {
if v == 0 {
o.IsCapture = 0
return
}
npcPetID := int(o.ID)
if o.Ext != 0 {
npcPetID = int(o.Ext)
}
petCfg, ok := xmlres.PetMAP[npcPetID]