refactor: 简化战斗宠物列表处理逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -93,13 +93,8 @@ func (h Controller) PetKing(data *fight.PetKingJoinInboundInfo, c *player.Player
|
||||
}
|
||||
|
||||
err = c.JoinFight(func(p common.PlayerI) bool {
|
||||
var u1, u2 []model.PetInfo
|
||||
if c.Fightinfo.Mode == info.BattleMode.SINGLE_MODE {
|
||||
u1, u2 = p.GetInfo().PetList[:1], c.GetInfo().PetList[:1]
|
||||
} else {
|
||||
u1, u2 = p.GetInfo().PetList, c.GetInfo().PetList
|
||||
}
|
||||
_, err = fight.NewFight(p, c, u1, u2, func(foi model.FightOverInfo) {
|
||||
|
||||
_, err = fight.NewFight(p, c, p.GetInfo().PetList, c.GetInfo().PetList, func(foi model.FightOverInfo) {
|
||||
if foi.Reason == 0 { //我放获胜
|
||||
switch data.Type {
|
||||
case 11:
|
||||
|
||||
@@ -54,13 +54,8 @@ func (h Controller) OnPlayerHandleFightInvite(data *fight.HandleFightInviteInbou
|
||||
atomic.StoreUint32(&c.Fightinfo.Mode, 0)
|
||||
return
|
||||
}
|
||||
var u1, u2 []model.PetInfo
|
||||
if data.Mode == info.BattleMode.SINGLE_MODE {
|
||||
u1, u2 = v.GetInfo().PetList[:1], c.GetInfo().PetList[:1]
|
||||
} else {
|
||||
u1, u2 = v.GetInfo().PetList, c.GetInfo().PetList
|
||||
}
|
||||
_, err = fight.NewFight(v, c, u1, u2, func(foi model.FightOverInfo) {
|
||||
|
||||
_, err = fight.NewFight(v, c, v.GetInfo().PetList, c.GetInfo().PetList, func(foi model.FightOverInfo) {
|
||||
|
||||
//println("好友对战测试", foi.Reason)
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ func (h Controller) ArenaFightOwner(data1 *fight.ARENA_FIGHT_OWENR, c *player.Pl
|
||||
c.Fightinfo.Mode = info.BattleMode.SINGLE_MODE
|
||||
c.Fightinfo.Status = info.BattleMode.FIGHT_ARENA
|
||||
|
||||
_, err = fight.NewFight(c, c.GetSpace().Owner.ARENA_Player, c.Info.PetList[:1], c.GetSpace().Owner.ARENA_Player.GetInfo().PetList[:1], func(foi model.FightOverInfo) { //我方邀请擂主挑战,我方先手
|
||||
_, err = fight.NewFight(c, c.GetSpace().Owner.ARENA_Player, c.Info.PetList, c.GetSpace().Owner.ARENA_Player.GetInfo().PetList, func(foi model.FightOverInfo) { //我方邀请擂主挑战,我方先手
|
||||
|
||||
if foi.Reason != 0 && foi.WinnerId == c.GetInfo().UserID { //异常退出
|
||||
|
||||
|
||||
Reference in New Issue
Block a user