From d14dbde6974f7c13463833b68fcb799dd5581c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Wed, 4 Mar 2026 20:52:39 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(fight=5Fpvp=5Fking):=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AE=A0=E7=89=A9=E5=B1=9E=E6=80=A7=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增元素类型映射数组,用于验证宠物属性类型匹配, 确保只有正确属性类型的宠物才能参与特定战斗模式。 ``` --- logic/controller/fight_pvp_king.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/logic/controller/fight_pvp_king.go b/logic/controller/fight_pvp_king.go index c1941df4..76350ef6 100644 --- a/logic/controller/fight_pvp_king.go +++ b/logic/controller/fight_pvp_king.go @@ -59,10 +59,15 @@ func (h Controller) PetKing(data *fight.PetKingJoinInboundInfo, c *player.Player case 6: c.Fightinfo.Mode = info.BattleMode.MULTI_MODE case 11: - c.Fightinfo.Mode = info.BattleMode.SINGLE_MODE - if c.GetPetInfo()[0].Type() != int(data.FightType) { + //草","水","火","电","战斗","飞行","机械","地面","冰" + // 按顺序:草、水、火、电、战斗、飞行、机械、地面、冰 + var ElementTypeNumbers = []int{1, 2, 3, 5, 11, 4, 6, 7, 9} + + println("11", c.GetPetInfo()[0].Type(), ElementTypeNumbers[data.FightType-1]) + if c.GetPetInfo()[0].Type() != int(ElementTypeNumbers[data.FightType-1]) { return nil, errorcode.ErrorCode(errorcode.ErrorCodes.ErrVictoryConditionNotMet) } + c.Fightinfo.Mode = info.BattleMode.SINGLE_MODE c.Fightinfo.FightType = data.FightType } err = c.JoinFight(func(p common.PlayerI) bool {