feat(fight_pvp_king): 新增宠物王者对战模式支持 - 添加战斗类型11的处理逻辑,支持单人模式 - 验证宠物类型与对战类型的匹配性 - 根据战斗结果发放相应奖励物品 - 增加ItemAdd接口用于物品添加功能 - 扩展PetInfo结构体增加战斗类型字段 ```
This commit is contained in:
@@ -58,14 +58,29 @@ func (h Controller) PetKing(data *fight.PetKingJoinInboundInfo, c *player.Player
|
||||
c.Fightinfo.Mode = info.BattleMode.SINGLE_MODE
|
||||
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) {
|
||||
return nil, errorcode.ErrorCode(errorcode.ErrorCodes.ErrVictoryConditionNotMet)
|
||||
}
|
||||
c.Fightinfo.FightType = data.FightType
|
||||
}
|
||||
err = c.JoinFight(func(p common.PlayerI) bool {
|
||||
_, err = fight.NewFight(p, c, func(foi info.FightOverInfo) {
|
||||
if foi.Reason == 0 { //我放获胜
|
||||
if foi.WinnerId == c.GetInfo().UserID {
|
||||
c.Info.MonKingWin += 1
|
||||
} else {
|
||||
p.GetInfo().MonKingWin += 1
|
||||
switch data.Type {
|
||||
case 11:
|
||||
if foi.WinnerId == c.GetInfo().UserID {
|
||||
c.ItemAdd(80000000+int64(data.FightType), 1)
|
||||
} else {
|
||||
p.ItemAdd(80000000+int64(data.FightType), 1)
|
||||
}
|
||||
default:
|
||||
if foi.WinnerId == c.GetInfo().UserID {
|
||||
c.Info.MonKingWin += 1
|
||||
} else {
|
||||
p.GetInfo().MonKingWin += 1
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user