fix: 添加宠物进化等级检查并修复降级逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-01 11:25:30 +08:00
committed by cnb
parent 9b344d3753
commit 74ede45d92
2 changed files with 5 additions and 5 deletions

View File

@@ -11,10 +11,6 @@ import (
"github.com/jinzhu/copier"
)
// PetEVDiy 自定义分配宠物努力值EV
// data: 包含宠物捕获时间和EV分配数据的输入信息
// c: 当前玩家对象
// 返回: 分配结果和错误码
func (h Controller) PetELV(data *pet.C2S_PET_EVOLVTION, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
_, currentPet, found := c.FindPet(data.CacthTime)
if !found {
@@ -26,6 +22,9 @@ func (h Controller) PetELV(data *pet.C2S_PET_EVOLVTION, c *player.Player) (resul
if flag == 0 {
return nil, errorcode.ErrorCodes.ErrPokemonNotEvolveReady
}
if xmlres.PetMAP[int(currentPet.ID)].EvolvingLv > int(currentPet.Level) {
return nil, errorcode.ErrorCodes.ErrPokemonNotEvolveReady
}
evinfo := xmlres.EVOLVMAP[flag].Branches[data.Index-1]
if c.Service.Item.CheakItem(uint32(evinfo.EvolvItem)) < int64(evinfo.EvolvItemCount) {

View File

@@ -313,7 +313,8 @@ func (pet *PetInfo) Downgrade(level uint32) {
if ok {
if basic.EvolvesFrom != 0 {
if basic.EvolvesFrom != 0 && xmlres.PetMAP[int(basic.EvolvesFrom)].EvolvFlag == 0 {
pet.ID = uint32(basic.EvolvesFrom)
}