```
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

feat(fight_boss): 优化怪物战斗掉落逻辑

- 将随机数生成方法从 grand.Intn(2) + 1 替换为更直观的 grand.N(1, 2)
- 为闪亮怪物奖励添加随机数量机制,从固定1个改为1
This commit is contained in:
昔念
2026-03-10 09:36:22 +08:00
parent 8992132d13
commit f58463c0d4

View File

@@ -175,7 +175,7 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
item := p.GetSpace().GetDrop()
if item != 0 {
count := int64(grand.Intn(2) + 1)
count := int64(grand.N(1, 2))
ok := p.ItemAdd(item, count)
if ok {
items.ADDitem(uint32(item), uint32(count))
@@ -185,9 +185,10 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
}
if monster.IsShiny() && p.CanGetXUAN() && pettype < 16 {
xuan := 400686 + pettype
ok := p.ItemAdd(xuan, 1)
count := uint32(grand.N(1, 2))
ok := p.ItemAdd(xuan, int64(count))
if ok {
items.ADDitem(uint32(xuan), 1)
items.ADDitem(uint32(xuan), count)
}
}