feat(fight_pvp_king): 添加宠物属性类型验证逻辑 新增元素类型映射数组,用于验证宠物属性类型匹配, 确保只有正确属性类型的宠物才能参与特定战斗模式。 ```
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user