``` refactor(pet): 优化宠物特性随机逻辑并修复宠物删除数组操作

This commit is contained in:
1
2025-12-30 02:15:33 +00:00
parent 94391abe5f
commit f91b88e90f
5 changed files with 17 additions and 21 deletions

View File

@@ -68,8 +68,8 @@ func (f *baseplayer) FindPet(catchTime uint32) (int, *model.PetInfo, bool) {
func (f *Player) PetDel(catchTime uint32) {
index, olpet, ok := f.FindPet(catchTime)
if ok {
copy(f.Info.PetList[index:], f.Info.PetList[index+1:])
f.Info.PetList = f.Info.PetList[:len(f.Info.PetList)-1]
f.Info.PetList = append(f.Info.PetList[:index], f.Info.PetList[index+1:]...)
//先将背包更新
f.Service.Pet.PetInfo_One_exec(catchTime, func(petData *model.PetEX) {
petData.Data = *olpet