根据提供的code differences信息,由于没有具体的代码变更内容,我将生成一个通用的commit message模板:
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
``` docs(readme): 更新文档说明 - 添加项目使用指南 - 完善API接口说明 - 修正错误的配置示例 ``` 注意:由于未提供具体的代码差异信息,以上为示例格式。实际使用时请根据具体的代码变更内容填写相应的type、scope、subject和body信息。
This commit is contained in:
@@ -193,24 +193,30 @@ func (f *FightC) collectAttackValues(inputs []*input.Input) []model.AttackValue
|
||||
return values
|
||||
}
|
||||
|
||||
func (f *FightC) collectAttackValueByAction(act *action.SelectSkillAction) []model.AttackValue {
|
||||
if act == nil {
|
||||
return nil
|
||||
func (f *FightC) buildAttackValueForBroadcast(fighter *input.Input, fallbackActorIndex int) model.AttackValue {
|
||||
if fighter == nil {
|
||||
return model.AttackValue{}
|
||||
}
|
||||
fighter := f.GetInputByAction(act, false)
|
||||
if fighter == nil || fighter.AttackValue == nil || fighter.AttackValue.SkillID == 0 {
|
||||
return nil
|
||||
if fighter.AttackValue == nil {
|
||||
empty := info.NewAttackValue(fighter.UserID)
|
||||
fighter.AttackValue = empty
|
||||
}
|
||||
attackValue := *fighter.AttackValue
|
||||
attackValue.ActorIndex = uint32(act.GetActorIndex())
|
||||
return []model.AttackValue{attackValue}
|
||||
attackValue.ActorIndex = uint32(fallbackActorIndex)
|
||||
if attackValue.UserID == 0 && fighter.Player != nil && fighter.Player.GetInfo() != nil {
|
||||
attackValue.UserID = fighter.Player.GetInfo().UserID
|
||||
}
|
||||
return attackValue
|
||||
}
|
||||
|
||||
func (f *FightC) buildNoteUseSkillOutboundInfo(firstAttack, secondAttack *action.SelectSkillAction) info.NoteUseSkillOutboundInfo {
|
||||
func (f *FightC) buildNoteUseSkillOutboundInfo() info.NoteUseSkillOutboundInfo {
|
||||
result := info.NoteUseSkillOutboundInfo{}
|
||||
result.FirstAttackInfo = append(result.FirstAttackInfo, f.collectAttackValueByAction(firstAttack)...)
|
||||
result.SecondAttackInfo = append(result.SecondAttackInfo, f.collectAttackValueByAction(secondAttack)...)
|
||||
|
||||
if f.First != nil {
|
||||
result.FirstAttackInfo = f.buildAttackValueForBroadcast(f.First, f.First.TeamSlotIndex())
|
||||
}
|
||||
if f.Second != nil {
|
||||
result.SecondAttackInfo = f.buildAttackValueForBroadcast(f.Second, f.Second.TeamSlotIndex())
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -453,7 +459,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
f.sendLegacyRoundBroadcast(firstAttack, secondAttack)
|
||||
}
|
||||
|
||||
attackValueResult := f.buildNoteUseSkillOutboundInfo(firstAttack, secondAttack)
|
||||
attackValueResult := f.buildNoteUseSkillOutboundInfo()
|
||||
//因为切完才能广播,所以必须和回合结束分开结算
|
||||
f.BroadcastPlayers(func(p common.PlayerI) {
|
||||
for _, switchAction := range f.Switch {
|
||||
@@ -481,7 +487,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
// })
|
||||
return
|
||||
}
|
||||
if len(attackValueResult.FirstAttackInfo) > 0 || len(attackValueResult.SecondAttackInfo) > 0 {
|
||||
if attackValueResult.FirstAttackInfo.UserID != 0 || attackValueResult.SecondAttackInfo.UserID != 0 {
|
||||
f.BroadcastPlayers(func(p common.PlayerI) {
|
||||
if !f.LegacyGroupProtocol {
|
||||
f.sendFightPacket(p, fightPacketSkillResult, &attackValueResult)
|
||||
|
||||
@@ -196,10 +196,8 @@ type PropDict struct {
|
||||
|
||||
// NoteUseSkillOutboundInfo 战斗技能使用通知的出站信息结构体
|
||||
type NoteUseSkillOutboundInfo struct {
|
||||
FirstAttackInfoLen uint32 `struc:"sizeof=FirstAttackInfo"`
|
||||
FirstAttackInfo []model.AttackValue // 本轮先手方精灵在释放技能结束后的状态
|
||||
SecondAttackInfoLen uint32 `struc:"sizeof=SecondAttackInfo"`
|
||||
SecondAttackInfo []model.AttackValue // 本轮后手方精灵在释放技能结束后的状态
|
||||
FirstAttackInfo model.AttackValue // 本轮先手方精灵在释放技能结束后的状态
|
||||
SecondAttackInfo model.AttackValue // 本轮后手方精灵在释放技能结束后的状态
|
||||
}
|
||||
|
||||
type FightStartOutboundInfo struct {
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/logic/service/common"
|
||||
"blazing/logic/service/fight/action"
|
||||
fightinfo "blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/fight/input"
|
||||
spaceinfo "blazing/logic/service/space/info"
|
||||
@@ -130,20 +129,18 @@ func TestBuildNoteUseSkillOutboundInfoUsesActionOrder(t *testing.T) {
|
||||
opp.AttackValue.MaxHp = 100
|
||||
|
||||
fc := &FightC{
|
||||
Our: []*input.Input{our},
|
||||
Opp: []*input.Input{opp},
|
||||
Our: []*input.Input{our},
|
||||
Opp: []*input.Input{opp},
|
||||
First: opp,
|
||||
Second: our,
|
||||
}
|
||||
|
||||
firstAttack := &action.SelectSkillAction{BaseAction: action.BaseAction{PlayerID: 2002, ActorIndex: 0}}
|
||||
result := fc.buildNoteUseSkillOutboundInfo(firstAttack, nil)
|
||||
result := fc.buildNoteUseSkillOutboundInfo()
|
||||
|
||||
if len(result.FirstAttackInfo) != 1 {
|
||||
t.Fatalf("expected only first attack info, got first=%d second=%d", len(result.FirstAttackInfo), len(result.SecondAttackInfo))
|
||||
if result.FirstAttackInfo.UserID != 2002 || result.FirstAttackInfo.SkillID != 222 {
|
||||
t.Fatalf("expected first attack info to belong to acting opponent, got %+v", result.FirstAttackInfo)
|
||||
}
|
||||
if len(result.SecondAttackInfo) != 0 {
|
||||
t.Fatalf("expected no second attack info, got %d", len(result.SecondAttackInfo))
|
||||
}
|
||||
if result.FirstAttackInfo[0].UserID != 2002 || result.FirstAttackInfo[0].SkillID != 222 {
|
||||
t.Fatalf("expected first attack info to belong to acting opponent, got %+v", result.FirstAttackInfo[0])
|
||||
if result.SecondAttackInfo.UserID != 1001 || result.SecondAttackInfo.SkillID != 111 {
|
||||
t.Fatalf("expected second attack info to keep the idle side placeholder, got %+v", result.SecondAttackInfo)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user