```
feat(pet): 宠物系统新增异色功能 - 在蛋游戏中添加异色宠物生成逻辑 - 在 boss 战斗中加入捕获时异色概率判定 - 优化宠物融合系统,支持融合后异色继承 - 重构宠物删除方法命名,修复方法调用问题
This commit is contained in:
@@ -63,23 +63,19 @@ func (f *baseplayer) FindPet(catchTime uint32) (int, *model.PetInfo, bool) {
|
||||
})
|
||||
}
|
||||
|
||||
// Pet_del 删除指定宠物
|
||||
// PetDel 删除指定宠物
|
||||
// catchTime: 宠物的捕捉时间戳
|
||||
func (f *Player) Pet_del(catchTime uint32) {
|
||||
index, _, ok := f.FindPet(catchTime)
|
||||
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.Service.Pet.PetInfo_One_exec(catchTime, func(petData *model.PetEX) {
|
||||
petData.Data = *olpet
|
||||
//t.InBag = 0
|
||||
|
||||
})
|
||||
f.Service.Pet.Pet_del(catchTime)
|
||||
}
|
||||
}
|
||||
|
||||
// // 计算整数的二进制1的个数(Integer.bitCount)
|
||||
// func bitsCount(n int) int {
|
||||
// count := 0
|
||||
// for n > 0 {
|
||||
// count += n & 1
|
||||
// n >>= 1
|
||||
// }
|
||||
// return count
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user