feat(fight): 新增疲惫状态并优化睡眠状态机制 - 实现疲惫状态(StatusTired),仅限制攻击技能,允许属性技能正常使用 - 重构睡眠状态,改为在被攻击且未miss时立即解除,而非技能使用后 - 修复寄生种子效果触发时机,改为回合开始时触发 - 调整寄生效果的目标为技能施放者而非对手 fix(fight): 修正战斗回合逻辑和技能持续时间处理 - 修复Effect2194中状态添加函数调用,使用带时间参数的版本 - 修正Effect13中技能持续时间计算,避免额外减1的问题 - 优化回合处理逻辑,当双方都未出手时跳过动作阶段 refactor(cdk): 重构CDK配置结构和服务器冠名功能 - 将CDKConfig中的CDKType字段重命名为Type以符合GORM映射 - 优化UseServerNamingCDK方法的上下文处理逻辑 - 修复服务器冠名CDK使用时的类型检查条件 feat(player): 完善宠物经验系统和CDK兑换功能 - 增强AddPetExp方法,处理宠物等级达到100级的情况 - 添加查询当前账号有效期内服务器冠名信息的API接口 - 实现服务器服务相关的数据模型和查询方法 fix(task): 任务查询支持启用和未启用状态 - 修改任务服务中的Get、GetDaily、GetWeek方法 - 当启用状态下无结果时,自动查询未启用状态的任务配置 ```
This commit is contained in:
@@ -193,10 +193,23 @@ func (f *FightC) collectAttackValues(inputs []*input.Input) []model.AttackValue
|
||||
return values
|
||||
}
|
||||
|
||||
func (f *FightC) buildNoteUseSkillOutboundInfo() info.NoteUseSkillOutboundInfo {
|
||||
func (f *FightC) collectAttackValueByAction(act *action.SelectSkillAction) []model.AttackValue {
|
||||
if act == nil {
|
||||
return nil
|
||||
}
|
||||
fighter := f.GetInputByAction(act, false)
|
||||
if fighter == nil || fighter.AttackValue == nil || fighter.AttackValue.SkillID == 0 {
|
||||
return nil
|
||||
}
|
||||
attackValue := *fighter.AttackValue
|
||||
attackValue.ActorIndex = uint32(act.GetActorIndex())
|
||||
return []model.AttackValue{attackValue}
|
||||
}
|
||||
|
||||
func (f *FightC) buildNoteUseSkillOutboundInfo(firstAttack, secondAttack *action.SelectSkillAction) info.NoteUseSkillOutboundInfo {
|
||||
result := info.NoteUseSkillOutboundInfo{}
|
||||
result.FirstAttackInfo = append(result.FirstAttackInfo, f.collectAttackValues(f.Our)...)
|
||||
result.SecondAttackInfo = append(result.SecondAttackInfo, f.collectAttackValues(f.Opp)...)
|
||||
result.FirstAttackInfo = append(result.FirstAttackInfo, f.collectAttackValueByAction(firstAttack)...)
|
||||
result.SecondAttackInfo = append(result.SecondAttackInfo, f.collectAttackValueByAction(secondAttack)...)
|
||||
|
||||
return result
|
||||
}
|
||||
@@ -302,12 +315,18 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
var currentAction *action.SelectSkillAction
|
||||
if i == 0 {
|
||||
currentAction = firstAttack
|
||||
if currentAction == nil {
|
||||
continue
|
||||
}
|
||||
attacker, defender = f.getSkillParticipants(firstAttack)
|
||||
originalSkill = f.copySkill(firstAttack)
|
||||
//先手阶段,先修复后手效果
|
||||
f.Second.RecoverEffect()
|
||||
} else {
|
||||
currentAction = secondAttack
|
||||
if currentAction == nil {
|
||||
continue
|
||||
}
|
||||
attacker, defender = f.getSkillParticipants(secondAttack)
|
||||
originalSkill = f.copySkill(secondAttack)
|
||||
//取消后手历史效果
|
||||
@@ -434,7 +453,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
|
||||
f.sendLegacyRoundBroadcast(firstAttack, secondAttack)
|
||||
}
|
||||
|
||||
attackValueResult := f.buildNoteUseSkillOutboundInfo()
|
||||
attackValueResult := f.buildNoteUseSkillOutboundInfo(firstAttack, secondAttack)
|
||||
//因为切完才能广播,所以必须和回合结束分开结算
|
||||
f.BroadcastPlayers(func(p common.PlayerI) {
|
||||
for _, switchAction := range f.Switch {
|
||||
|
||||
@@ -5,6 +5,7 @@ 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"
|
||||
@@ -111,3 +112,38 @@ func TestBuildFightStateStartEnvelope(t *testing.T) {
|
||||
t.Fatalf("unexpected right fighter snapshot: %+v", envelope.Right[0])
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildNoteUseSkillOutboundInfoUsesActionOrder(t *testing.T) {
|
||||
ourPlayer := &stubPlayer{info: model.PlayerInfo{UserID: 1001}}
|
||||
oppPlayer := &stubPlayer{info: model.PlayerInfo{UserID: 2002}}
|
||||
|
||||
our := input.NewInput(nil, ourPlayer)
|
||||
our.InitAttackValue()
|
||||
our.AttackValue.SkillID = 111
|
||||
our.AttackValue.RemainHp = 80
|
||||
our.AttackValue.MaxHp = 100
|
||||
|
||||
opp := input.NewInput(nil, oppPlayer)
|
||||
opp.InitAttackValue()
|
||||
opp.AttackValue.SkillID = 222
|
||||
opp.AttackValue.RemainHp = 70
|
||||
opp.AttackValue.MaxHp = 100
|
||||
|
||||
fc := &FightC{
|
||||
Our: []*input.Input{our},
|
||||
Opp: []*input.Input{opp},
|
||||
}
|
||||
|
||||
firstAttack := &action.SelectSkillAction{BaseAction: action.BaseAction{PlayerID: 2002, ActorIndex: 0}}
|
||||
result := fc.buildNoteUseSkillOutboundInfo(firstAttack, nil)
|
||||
|
||||
if len(result.FirstAttackInfo) != 1 {
|
||||
t.Fatalf("expected only first attack info, got first=%d second=%d", len(result.FirstAttackInfo), len(result.SecondAttackInfo))
|
||||
}
|
||||
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])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user