feat: 为怪物生成和宠物信息添加随机条件
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -46,7 +46,7 @@ func (p *Player) GenMonster() {
|
||||
mapss, ok := xmlres.MonsterMap[gconv.Int(p.Info.MapID)]
|
||||
|
||||
if ok && mapss.Monsters != nil {
|
||||
ok := grand.Meet(3, 10)
|
||||
|
||||
for i, m := range mapss.Monsters.Monsters { //这里是9个
|
||||
|
||||
_, rok := lo.Find(replce, func(it int) bool {
|
||||
@@ -90,7 +90,7 @@ func (p *Player) GenMonster() {
|
||||
}
|
||||
}
|
||||
|
||||
if ok && len(mapinfo.DropItemIds) > 0 {
|
||||
if grand.Meet(3, 10) && len(mapinfo.DropItemIds) > 0 {
|
||||
|
||||
p.OgreInfo.Data[i].Item = append(p.OgreInfo.Data[i].Item, int64(mapinfo.DropItemIds[grand.Intn(len(mapinfo.DropItemIds))]))
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
csmap "github.com/mhmtszr/concurrent-swiss-map"
|
||||
"github.com/panjf2000/gnet/v2"
|
||||
)
|
||||
@@ -46,7 +47,10 @@ func (o *OgrePetInfo) FixSHiny() {
|
||||
|
||||
if co != nil && len(o.ShinyInfo) == 0 {
|
||||
o.ShinyInfo = append(o.ShinyInfo, *co)
|
||||
o.Item = append(o.Item, 400686+int64(xmlres.PetMAP[int(o.ID)].Type))
|
||||
if grand.Meet(1, 2) {
|
||||
o.Item = append(o.Item, 400686+int64(xmlres.PetMAP[int(o.ID)].Type))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -59,7 +63,9 @@ func (o *OgrePetInfo) RandomByWeightShiny() {
|
||||
|
||||
if co != nil && len(o.ShinyInfo) == 0 {
|
||||
o.ShinyInfo = append(o.ShinyInfo, *co)
|
||||
o.Item = append(o.Item, 400686+int64(xmlres.PetMAP[int(o.ID)].Type))
|
||||
if grand.Meet(1, 2) {
|
||||
o.Item = append(o.Item, 400686+int64(xmlres.PetMAP[int(o.ID)].Type))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user