From 85f15a72aa842f3e0e7d030318b853c95640293d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <1@72wo.cn> Date: Mon, 5 Jan 2026 22:54:41 +0800 Subject: [PATCH] =?UTF-8?q?```=20refactor(fight):=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E6=88=98=E6=96=97=E7=B3=BB=E7=BB=9F=E6=96=B9=E6=B3=95=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E8=A7=84=E8=8C=83=E5=B9=B6=E4=BC=98=E5=8C=96=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将所有下划线命名的方法统一为驼峰命名,如 Turn_Start 改为 TurnStart, Action_end_ex 改为 ActionEndEx,Turn_End 改为 TurnEnd - 新增 IsOwner() 方法用于判断当前精灵是否为场上的当前宠物 - 将硬编码的 CatchTime 比较逻辑替换为 IsOwner() 方法调用 - 在 NewSel408 中实现消除对手能力强化效果的具体逻辑 - 修复 effect_74 中衰弱状态的数值引用,使用枚举类型代替硬编码 - 优化 input/fight.go 中的技能选择逻辑,使用伤害值比较代替权重比较 - 移除 shiny.go 中未使用的 utils 导入和相关逻辑 - 修正 NewSel77 从 Turn_End 重命名为 TurnStart 的方法 - 在 input/fight.go 中添加 Damage 方法的注释说明 ``` --- logic/service/fight/boss/NewSeIdx_1.go | 5 ++- logic/service/fight/boss/NewSeIdx_10.go | 2 +- logic/service/fight/boss/NewSeIdx_14.go | 2 +- logic/service/fight/boss/NewSeIdx_16.go | 2 +- logic/service/fight/boss/NewSeIdx_2.go | 2 +- logic/service/fight/boss/NewSeIdx_25.go | 2 +- logic/service/fight/boss/NewSeIdx_26.go | 2 +- logic/service/fight/boss/NewSeIdx_31.go | 2 +- logic/service/fight/boss/NewSeIdx_33.go | 2 +- logic/service/fight/boss/NewSeIdx_36.go | 2 +- logic/service/fight/boss/NewSeIdx_403.go | 2 +- logic/service/fight/boss/NewSeIdx_408.go | 13 +++++-- logic/service/fight/boss/NewSeIdx_409.go | 2 +- logic/service/fight/boss/NewSeIdx_44.go | 2 +- logic/service/fight/boss/NewSeIdx_46.go | 2 +- logic/service/fight/boss/NewSeIdx_49.go | 4 +- logic/service/fight/boss/NewSeIdx_5.go | 2 +- logic/service/fight/boss/NewSeIdx_503.go | 2 +- logic/service/fight/boss/NewSeIdx_53.go | 2 +- logic/service/fight/boss/NewSeIdx_54.go | 2 +- logic/service/fight/boss/NewSeIdx_56.go | 2 +- logic/service/fight/boss/NewSeIdx_59.go | 4 +- logic/service/fight/boss/NewSeIdx_6.go | 2 +- logic/service/fight/boss/NewSeIdx_7.go | 2 +- logic/service/fight/boss/NewSeIdx_71.go | 2 +- logic/service/fight/boss/NewSeIdx_74.go | 4 +- logic/service/fight/boss/NewSeIdx_75.go | 2 +- logic/service/fight/boss/NewSeIdx_77.go | 3 +- logic/service/fight/boss/NewSeIdx_78.go | 2 +- logic/service/fight/boss/NewSeIdx_81.go | 2 +- logic/service/fight/boss/NewSeIdx_82.go | 2 +- logic/service/fight/boss/NewSeIdx_9.go | 2 +- logic/service/fight/effect/effect_119_123.go | 2 +- logic/service/fight/effect/effect_124_126.go | 2 +- logic/service/fight/effect/effect_62.go | 4 +- logic/service/fight/effect/effect_73.go | 2 +- logic/service/fight/effect/effect_91.go | 2 +- logic/service/fight/effect/effect_attr.go | 2 +- logic/service/fight/fightc.go | 6 +-- logic/service/fight/input/fight.go | 41 ++++++++------------ logic/service/fight/input/interface.go | 6 +-- logic/service/fight/node/Turn.go | 4 +- logic/service/fight/node/fight.go | 2 +- modules/config/service/shiny.go | 24 ++++-------- 44 files changed, 87 insertions(+), 95 deletions(-) diff --git a/logic/service/fight/boss/NewSeIdx_1.go b/logic/service/fight/boss/NewSeIdx_1.go index d6a789247..4e6ac4de4 100644 --- a/logic/service/fight/boss/NewSeIdx_1.go +++ b/logic/service/fight/boss/NewSeIdx_1.go @@ -21,6 +21,9 @@ type NewSel0 struct { func (e *NewSel0) SwitchOut(in *input.Input) bool { return true } +func (e *NewSel0) IsOwner() bool { + return e.ID().GetCatchTime() == e.Ctx().Our.CurrentPet.Info.CatchTime +} // 免疫"能力(battle_lv)下降" type NewSel1 struct { @@ -30,7 +33,7 @@ type NewSel1 struct { func (e *NewSel1) PropBefer(in *input.Input, prop int8, level int8, ptype info.EnumAbilityOpType) bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 - if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { + if !e.IsOwner() { return true } if in == e.Ctx().Our { diff --git a/logic/service/fight/boss/NewSeIdx_10.go b/logic/service/fight/boss/NewSeIdx_10.go index 7bc77bb1d..9e90952f4 100644 --- a/logic/service/fight/boss/NewSeIdx_10.go +++ b/logic/service/fight/boss/NewSeIdx_10.go @@ -12,7 +12,7 @@ type NewSel10 struct { can bool } -func (e *NewSel10) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { +func (e *NewSel10) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { if e.can { e.Ctx().Our.HealPP(-1) diff --git a/logic/service/fight/boss/NewSeIdx_14.go b/logic/service/fight/boss/NewSeIdx_14.go index 37f631ac6..d5fddf0d8 100644 --- a/logic/service/fight/boss/NewSeIdx_14.go +++ b/logic/service/fight/boss/NewSeIdx_14.go @@ -11,7 +11,7 @@ type NewSel14 struct { NewSel0 } -func (e *NewSel14) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { +func (e *NewSel14) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { // TODO: 实现若遇到天敌, 则战斗开始时连续害怕 n 回合;(a1: n)的核心逻辑 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return diff --git a/logic/service/fight/boss/NewSeIdx_16.go b/logic/service/fight/boss/NewSeIdx_16.go index efeec3f85..28fb2a9f4 100644 --- a/logic/service/fight/boss/NewSeIdx_16.go +++ b/logic/service/fight/boss/NewSeIdx_16.go @@ -15,7 +15,7 @@ type NewSel16 struct { curhp alpacadecimal.Decimal } -func (e *NewSel16) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { +func (e *NewSel16) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { // fmt.Println(e.ID().GetCatchTime(), e.Ctx().Our.CurrentPet.Info.CatchTime) if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { diff --git a/logic/service/fight/boss/NewSeIdx_2.go b/logic/service/fight/boss/NewSeIdx_2.go index 0a2d20826..5066d0ef6 100644 --- a/logic/service/fight/boss/NewSeIdx_2.go +++ b/logic/service/fight/boss/NewSeIdx_2.go @@ -12,7 +12,7 @@ type NewSel2 struct { func (e *NewSel2) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 - if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { + if !e.IsOwner() { return true } diff --git a/logic/service/fight/boss/NewSeIdx_25.go b/logic/service/fight/boss/NewSeIdx_25.go index e70284538..4a50d1070 100644 --- a/logic/service/fight/boss/NewSeIdx_25.go +++ b/logic/service/fight/boss/NewSeIdx_25.go @@ -12,7 +12,7 @@ type NewSel25 struct { NewSel0 } -func (e *NewSel25) Action_end_ex() bool { +func (e *NewSel25) ActionEndEx() bool { if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true } diff --git a/logic/service/fight/boss/NewSeIdx_26.go b/logic/service/fight/boss/NewSeIdx_26.go index 1d86ff041..8584a9270 100644 --- a/logic/service/fight/boss/NewSeIdx_26.go +++ b/logic/service/fight/boss/NewSeIdx_26.go @@ -11,7 +11,7 @@ type NewSel26 struct { NewSel0 } -func (e *NewSel26) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { +func (e *NewSel26) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { } func init() { diff --git a/logic/service/fight/boss/NewSeIdx_31.go b/logic/service/fight/boss/NewSeIdx_31.go index aaa0780b1..29719841b 100644 --- a/logic/service/fight/boss/NewSeIdx_31.go +++ b/logic/service/fight/boss/NewSeIdx_31.go @@ -10,7 +10,7 @@ type NewSel31 struct { NewSel0 } -func (e *NewSel31) Action_end_ex() bool { +func (e *NewSel31) ActionEndEx() bool { if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true } diff --git a/logic/service/fight/boss/NewSeIdx_33.go b/logic/service/fight/boss/NewSeIdx_33.go index f7d03207c..eb62fd186 100644 --- a/logic/service/fight/boss/NewSeIdx_33.go +++ b/logic/service/fight/boss/NewSeIdx_33.go @@ -10,7 +10,7 @@ type NewSel33 struct { NewSel0 } -func (e *NewSel33) Action_end_ex() bool { +func (e *NewSel33) ActionEndEx() bool { if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true } diff --git a/logic/service/fight/boss/NewSeIdx_36.go b/logic/service/fight/boss/NewSeIdx_36.go index d2093d813..5dcbcb5a2 100644 --- a/logic/service/fight/boss/NewSeIdx_36.go +++ b/logic/service/fight/boss/NewSeIdx_36.go @@ -16,7 +16,7 @@ type NewSel36 struct { round int } -func (e *NewSel36) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { +func (e *NewSel36) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { e.round++ if e.round >= 5 { e.round = 0 diff --git a/logic/service/fight/boss/NewSeIdx_403.go b/logic/service/fight/boss/NewSeIdx_403.go index 72fda625a..a03abeb2b 100644 --- a/logic/service/fight/boss/NewSeIdx_403.go +++ b/logic/service/fight/boss/NewSeIdx_403.go @@ -10,7 +10,7 @@ type NewSel403 struct { NewSel0 } -func (e *NewSel403) Action_end_ex() bool { +func (e *NewSel403) ActionEndEx() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true diff --git a/logic/service/fight/boss/NewSeIdx_408.go b/logic/service/fight/boss/NewSeIdx_408.go index 1af0eea87..0720ea30d 100644 --- a/logic/service/fight/boss/NewSeIdx_408.go +++ b/logic/service/fight/boss/NewSeIdx_408.go @@ -1,22 +1,27 @@ package effect import ( + "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" ) -// 408. 给对手造成伤害时,附带消除能力强化效果(PVP无效) +// NewSel408 给对手造成伤害时,附带消除能力强化效果(PVP无效) type NewSel408 struct { NewSel0 } -// TODO: 实现消除能力强化效果的核心逻辑 -func (e *NewSel408) Action_end_ex() bool { +// ActionEndEx 实现消除能力强化效果的核心逻辑 +func (e *NewSel408) ActionEndEx() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 - if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { + if !e.IsOwner() { return true } // TODO: 需要判断是否是PVP战斗 + for i := 0; i < 6; i++ { + e.Ctx().Opp.SetProp(e.Ctx().Our, int8(i), 1, info.AbilityOpType.RESET) + } + // 消除对手的能力强化效果 // 这里需要调用相应的方法来消除对手的能力提升 return true diff --git a/logic/service/fight/boss/NewSeIdx_409.go b/logic/service/fight/boss/NewSeIdx_409.go index ea5993865..0e22a553f 100644 --- a/logic/service/fight/boss/NewSeIdx_409.go +++ b/logic/service/fight/boss/NewSeIdx_409.go @@ -10,7 +10,7 @@ type NewSel409 struct { NewSel0 } -func (e *NewSel409) Action_end_ex() bool { +func (e *NewSel409) ActionEndEx() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true diff --git a/logic/service/fight/boss/NewSeIdx_44.go b/logic/service/fight/boss/NewSeIdx_44.go index 01845cbcd..7c75e7167 100644 --- a/logic/service/fight/boss/NewSeIdx_44.go +++ b/logic/service/fight/boss/NewSeIdx_44.go @@ -11,7 +11,7 @@ type NewSel44 struct { count int } -func (e *NewSel44) Action_end_ex() bool { +func (e *NewSel44) ActionEndEx() bool { if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true } diff --git a/logic/service/fight/boss/NewSeIdx_46.go b/logic/service/fight/boss/NewSeIdx_46.go index 4afd3e301..785fc7963 100644 --- a/logic/service/fight/boss/NewSeIdx_46.go +++ b/logic/service/fight/boss/NewSeIdx_46.go @@ -15,7 +15,7 @@ type NewSel46 struct { lastRecoveryRound uint32 } -func (e *NewSel46) Action_end_ex() bool { +func (e *NewSel46) ActionEndEx() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true diff --git a/logic/service/fight/boss/NewSeIdx_49.go b/logic/service/fight/boss/NewSeIdx_49.go index 39cee62b1..0d4e39d38 100644 --- a/logic/service/fight/boss/NewSeIdx_49.go +++ b/logic/service/fight/boss/NewSeIdx_49.go @@ -18,7 +18,7 @@ type NewSel49 struct { remainingTurns int } -func (e *NewSel49) Action_end_ex() bool { +func (e *NewSel49) ActionEndEx() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true @@ -67,7 +67,7 @@ func (e *NewSel49) DamageDivEx(t *info.DamageZone) bool { return true } -func (e *NewSel49) Turn_End() { +func (e *NewSel49) TurnEnd() { // 每回合减少减伤效果剩余回合数 if e.remainingTurns > 0 { e.remainingTurns-- diff --git a/logic/service/fight/boss/NewSeIdx_5.go b/logic/service/fight/boss/NewSeIdx_5.go index e4165b39c..e629a1135 100644 --- a/logic/service/fight/boss/NewSeIdx_5.go +++ b/logic/service/fight/boss/NewSeIdx_5.go @@ -16,7 +16,7 @@ type NewSel5 struct { func (e *NewSel5) DamageLock_ex(t *info.DamageZone) bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 - if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { + if !e.IsOwner() { return true } if e.Ctx().SkillEntity == nil { diff --git a/logic/service/fight/boss/NewSeIdx_503.go b/logic/service/fight/boss/NewSeIdx_503.go index 658394653..fdf160971 100644 --- a/logic/service/fight/boss/NewSeIdx_503.go +++ b/logic/service/fight/boss/NewSeIdx_503.go @@ -11,7 +11,7 @@ type NewSel503 struct { NewSel0 } -func (e *NewSel503) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { +func (e *NewSel503) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return diff --git a/logic/service/fight/boss/NewSeIdx_53.go b/logic/service/fight/boss/NewSeIdx_53.go index 11ca0d2e6..ba04bd4a4 100644 --- a/logic/service/fight/boss/NewSeIdx_53.go +++ b/logic/service/fight/boss/NewSeIdx_53.go @@ -11,7 +11,7 @@ type NewSel53 struct { NewSel0 } -func (e *NewSel53) Turn_End() { +func (e *NewSel53) TurnEnd() { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return diff --git a/logic/service/fight/boss/NewSeIdx_54.go b/logic/service/fight/boss/NewSeIdx_54.go index 7f9e4adc3..43abe4580 100644 --- a/logic/service/fight/boss/NewSeIdx_54.go +++ b/logic/service/fight/boss/NewSeIdx_54.go @@ -10,7 +10,7 @@ type NewSel54 struct { NewSel0 } -func (e *NewSel54) Turn_End() { +func (e *NewSel54) TurnEnd() { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return diff --git a/logic/service/fight/boss/NewSeIdx_56.go b/logic/service/fight/boss/NewSeIdx_56.go index 104efb775..e4a155243 100644 --- a/logic/service/fight/boss/NewSeIdx_56.go +++ b/logic/service/fight/boss/NewSeIdx_56.go @@ -10,7 +10,7 @@ type NewSel56 struct { NewSel0 } -func (e *NewSel56) Turn_End() { +func (e *NewSel56) TurnEnd() { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return diff --git a/logic/service/fight/boss/NewSeIdx_59.go b/logic/service/fight/boss/NewSeIdx_59.go index dd147bc3b..979b58287 100644 --- a/logic/service/fight/boss/NewSeIdx_59.go +++ b/logic/service/fight/boss/NewSeIdx_59.go @@ -16,7 +16,7 @@ type NewSel59 struct { } // TODO: 需要了解魔王的附身触发条件 -func (e *NewSel59) Action_end_ex() bool { +func (e *NewSel59) ActionEndEx() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true @@ -48,7 +48,7 @@ func (e *NewSel59) DamageSubEx(t *info.DamageZone) bool { return true } -func (e *NewSel59) Turn_End() { +func (e *NewSel59) TurnEnd() { // 魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return diff --git a/logic/service/fight/boss/NewSeIdx_6.go b/logic/service/fight/boss/NewSeIdx_6.go index 2ee2ef354..48ab50748 100644 --- a/logic/service/fight/boss/NewSeIdx_6.go +++ b/logic/service/fight/boss/NewSeIdx_6.go @@ -11,7 +11,7 @@ type NewSel6 struct { NewSel0 } -func (e *NewSel6) Action_end_ex() bool { +func (e *NewSel6) ActionEndEx() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true diff --git a/logic/service/fight/boss/NewSeIdx_7.go b/logic/service/fight/boss/NewSeIdx_7.go index f178bcb43..3a97e23d3 100644 --- a/logic/service/fight/boss/NewSeIdx_7.go +++ b/logic/service/fight/boss/NewSeIdx_7.go @@ -11,7 +11,7 @@ type NewSel7 struct { } func (e *NewSel7) SkillHit_ex() bool { - if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { + if !e.IsOwner() { return true } // 技能为空时不处理 diff --git a/logic/service/fight/boss/NewSeIdx_71.go b/logic/service/fight/boss/NewSeIdx_71.go index e38ba0a72..feb395f39 100644 --- a/logic/service/fight/boss/NewSeIdx_71.go +++ b/logic/service/fight/boss/NewSeIdx_71.go @@ -10,7 +10,7 @@ type NewSel71 struct { NewSel0 } -func (e *NewSel71) Turn_End() { +func (e *NewSel71) TurnEnd() { if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return } diff --git a/logic/service/fight/boss/NewSeIdx_74.go b/logic/service/fight/boss/NewSeIdx_74.go index 4cf85b6df..e6a48e589 100644 --- a/logic/service/fight/boss/NewSeIdx_74.go +++ b/logic/service/fight/boss/NewSeIdx_74.go @@ -10,7 +10,7 @@ type NewSel74 struct { NewSel0 } -func (e *NewSel74) Action_end_ex() bool { +func (e *NewSel74) ActionEndEx() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true @@ -32,7 +32,7 @@ func (e *NewSel74) Action_end_ex() bool { // 给对手叠加衰弱状态(假设衰弱状态为特殊状态) // 这里用99表示衰弱状态,实际应根据游戏定义调整 - statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, 99) + statusEffect := e.Ctx().Our.InitEffect(input.EffectType.Status, int(info.PetStatus.Weakened)) if statusEffect != nil { e.Ctx().Opp.AddEffect(e.Ctx().Opp, statusEffect) } diff --git a/logic/service/fight/boss/NewSeIdx_75.go b/logic/service/fight/boss/NewSeIdx_75.go index f4fa7d2a8..41fe5814e 100644 --- a/logic/service/fight/boss/NewSeIdx_75.go +++ b/logic/service/fight/boss/NewSeIdx_75.go @@ -11,7 +11,7 @@ type NewSel75 struct { NewSel0 } -func (e *NewSel75) Turn_End() { +func (e *NewSel75) TurnEnd() { if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return } diff --git a/logic/service/fight/boss/NewSeIdx_77.go b/logic/service/fight/boss/NewSeIdx_77.go index a93e2cbe3..3f51c6e74 100644 --- a/logic/service/fight/boss/NewSeIdx_77.go +++ b/logic/service/fight/boss/NewSeIdx_77.go @@ -1,6 +1,7 @@ package effect import ( + "blazing/logic/service/fight/action" "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" ) @@ -10,7 +11,7 @@ type NewSel77 struct { NewSel0 } -func (e *NewSel77) Turn_End() { +func (e *NewSel77) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return } diff --git a/logic/service/fight/boss/NewSeIdx_78.go b/logic/service/fight/boss/NewSeIdx_78.go index e5a6cc169..c322ab2a3 100644 --- a/logic/service/fight/boss/NewSeIdx_78.go +++ b/logic/service/fight/boss/NewSeIdx_78.go @@ -10,7 +10,7 @@ type NewSel78 struct { NewSel0 } -func (e *NewSel78) Action_end_ex() bool { +func (e *NewSel78) ActionEndEx() bool { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true diff --git a/logic/service/fight/boss/NewSeIdx_81.go b/logic/service/fight/boss/NewSeIdx_81.go index 1085b13d6..29800c847 100644 --- a/logic/service/fight/boss/NewSeIdx_81.go +++ b/logic/service/fight/boss/NewSeIdx_81.go @@ -40,7 +40,7 @@ func (e *NewSel81) DamageDivEx(t *info.DamageZone) bool { return true } -func (e *NewSel81) Turn_End() { +func (e *NewSel81) TurnEnd() { // 魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return diff --git a/logic/service/fight/boss/NewSeIdx_82.go b/logic/service/fight/boss/NewSeIdx_82.go index 00b137260..4cb009472 100644 --- a/logic/service/fight/boss/NewSeIdx_82.go +++ b/logic/service/fight/boss/NewSeIdx_82.go @@ -20,7 +20,7 @@ func (e *NewSel82) Miss() { e.dodgedThisTurn = true } -func (e *NewSel82) Turn_End() { +func (e *NewSel82) TurnEnd() { //魂印特性有不在场的情况,绑定时候将精灵和特性绑定 if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return diff --git a/logic/service/fight/boss/NewSeIdx_9.go b/logic/service/fight/boss/NewSeIdx_9.go index a56abb019..b008ca558 100644 --- a/logic/service/fight/boss/NewSeIdx_9.go +++ b/logic/service/fight/boss/NewSeIdx_9.go @@ -10,7 +10,7 @@ type NewSel9 struct { NewSel0 } -func (e *NewSel9) Action_end_ex() bool { +func (e *NewSel9) ActionEndEx() bool { if e.ID().GetCatchTime() != e.Ctx().Our.CurrentPet.Info.CatchTime { return true } diff --git a/logic/service/fight/effect/effect_119_123.go b/logic/service/fight/effect/effect_119_123.go index 6676f384a..51e1cb78f 100644 --- a/logic/service/fight/effect/effect_119_123.go +++ b/logic/service/fight/effect/effect_119_123.go @@ -168,7 +168,7 @@ func (e *Effect123) SetArgs(t *input.Input, a ...int) { e.roundCount = e.EffectNode.SideEffectArgs[0] } -func (e *Effect123) Turn_Start(at, de *action.SelectSkillAction) { +func (e *Effect123) TurnStart(at, de *action.SelectSkillAction) { if e.roundCount > 0 { e.can = true e.roundCount-- diff --git a/logic/service/fight/effect/effect_124_126.go b/logic/service/fight/effect/effect_124_126.go index b4171b0ea..5204e3690 100644 --- a/logic/service/fight/effect/effect_124_126.go +++ b/logic/service/fight/effect/effect_124_126.go @@ -49,7 +49,7 @@ func (e *Effect126) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } -func (e *Effect126) Turn_Start(_, _ *action.SelectSkillAction) { +func (e *Effect126) TurnStart(_, _ *action.SelectSkillAction) { changeAmount := int(e.Args()[1].IntPart()) // 攻击等级+1 (属性索引0) diff --git a/logic/service/fight/effect/effect_62.go b/logic/service/fight/effect/effect_62.go index af35b5a7a..c42a11ef4 100644 --- a/logic/service/fight/effect/effect_62.go +++ b/logic/service/fight/effect/effect_62.go @@ -30,7 +30,7 @@ type Effect62_sub struct { } -func (e *Effect62_sub) Turn_End() { +func (e *Effect62_sub) TurnEnd() { e.duy-- @@ -60,7 +60,7 @@ func init() { } -// func (e *Effect62) Turn_Start() { +// func (e *Effect62) TurnStart() { // //如果对面还是我方放技能时候的玩家 // // if ctx.Player != e.opp.Player { // // return diff --git a/logic/service/fight/effect/effect_73.go b/logic/service/fight/effect/effect_73.go index 53291c918..8066e8474 100644 --- a/logic/service/fight/effect/effect_73.go +++ b/logic/service/fight/effect/effect_73.go @@ -32,7 +32,7 @@ func (e *Effect73) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0] - 1) } -func (e *Effect73) Action_end_ex() bool { +func (e *Effect73) ActionEndEx() bool { if !e.Input.FightC.IsFirst(e.Ctx().Our.Player) { return true diff --git a/logic/service/fight/effect/effect_91.go b/logic/service/fight/effect/effect_91.go index f6ff8a2d7..17802ea6c 100644 --- a/logic/service/fight/effect/effect_91.go +++ b/logic/service/fight/effect/effect_91.go @@ -32,7 +32,7 @@ func (e *Effect91) SetArgs(t *input.Input, a ...int) { e.EffectNode.Duration(e.EffectNode.SideEffectArgs[0]) } -func (e *Effect91) Turn_Start(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { +func (e *Effect91) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) { for i, v := range e.Ctx().Opp.Prop { diff --git a/logic/service/fight/effect/effect_attr.go b/logic/service/fight/effect/effect_attr.go index 9cb589f8c..8b98d85de 100644 --- a/logic/service/fight/effect/effect_attr.go +++ b/logic/service/fight/effect/effect_attr.go @@ -180,7 +180,7 @@ func (e *EffectPropSyncReverse) Alive(t ...bool) bool { return e.EffectNode.Alive(t...) } -func (e *EffectPropSyncReverse) Turn_End() { +func (e *EffectPropSyncReverse) TurnEnd() { if e.Duration() == 0 { // 保留 (负数表示永久) if e.can { diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index 80a7e7cc3..87b8ebcad 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -133,7 +133,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) ff.EffectCache = make([]input.Effect, 0) //先把上一回合数据清空,但是应该把本身延续类效果集成过来 ff.EffectLost = make([]input.Effect, 0) ff.Exec(func(effect input.Effect) bool { //回合开始前 - effect.Turn_Start(firstAttack, secondAttack) + effect.TurnStart(firstAttack, secondAttack) return true }) }) @@ -255,7 +255,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) }) defender.Exec(func(effect input.Effect) bool { effect.Ctx().SkillEntity = currentSkill - effect.Action_end_ex() + effect.ActionEndEx() return true }) @@ -340,7 +340,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction) ff.GenSataus() ff.Exec(func(t input.Effect) bool { //这个是能否使用技能 //结算状态 - t.Turn_End() //返回本身结算,如果false,说明不能使用技能了 + t.TurnEnd() //返回本身结算,如果false,说明不能使用技能了 return true }) ff.GenInfo() diff --git a/logic/service/fight/input/fight.go b/logic/service/fight/input/fight.go index 853faa27c..9289c59ec 100644 --- a/logic/service/fight/input/fight.go +++ b/logic/service/fight/input/fight.go @@ -96,6 +96,7 @@ func (our *Input) DelPP(value int) { } +// Damage 对方对我方造成伤害,处理伤害计算和扣减血量逻辑,包括各种增伤、减伤效果 // /红伤只允许调用一次来保持锁伤 // 这个方法是对对方造成伤害 // 伤害落实 // 血量扣减节点比如触发回神,反弹也在这里实现 @@ -205,12 +206,11 @@ func (our *Input) GetAction() { for _, v := range our.AllPet { if v.Info.Hp > 0 { our.FightC.ChangePet(our.Player, v.Info.CatchTime) - return } - } - + // 如果没有可用宠物,则直接返回,不执行任何操作 + return } //oppPet := opp.FightC.GetCurrPET(opp.Player) skills := selfPet.Skills @@ -236,12 +236,12 @@ func (our *Input) GetAction() { if s == nil { continue } - // 计算技能对对方的伤害(假设CalculatePower返回伤害值,或需从技能中获取) - damage := our.CalculatePower(our.Opp, s) - if !s.CanUse() { continue } + // 计算技能对对方的伤害(假设CalculatePower返回伤害值,或需从技能中获取) + damage := our.CalculatePower(our.Opp, s) + allSkills = append(allSkills, skillWithDamage{SkillEntity: s, damage: damage}) // 判断是否能秒杀(伤害 >= 对方当前生命值) @@ -253,16 +253,16 @@ func (our *Input) GetAction() { } } - // 若存在能秒杀的技能,优先使用(选权重最高的,避免浪费高伤害技能) + // 若存在能秒杀的技能,优先使用(选伤害最高的,避免浪费高伤害技能) if len(killableSkills) > 0 { bestKillSkill := killableSkills[0].SkillEntity - // maxWeight := killableSkills[0].SkillEntity.Weight // 假设技能有Weight字段表示权重 - // for _, ks := range killableSkills[1:] { - // if ks.skill.Weight > maxWeight { - // maxWeight = ks.skill.Weight - // bestKillSkill = ks.skill - // } - // } + maxDamage := killableSkills[0].damage + for _, ks := range killableSkills[1:] { + if ks.damage.Cmp(maxDamage) > 0 { // 使用decimal的比较方法比较伤害值 + maxDamage = ks.damage + bestKillSkill = ks.SkillEntity + } + } our.FightC.UseSkill(our.Player, uint32(bestKillSkill.ID)) return } @@ -271,17 +271,10 @@ func (our *Input) GetAction() { return } + // 优化随机选择技能的逻辑,直接使用随机索引 randomIdx := grand.Intn(len(allSkills)) - - for i := 0; i < len(allSkills); i++ { - if randomIdx == int(i) { - our.FightC.UseSkill(our.Player, uint32(allSkills[i].ID)) - - return - } - } - - our.FightC.UseSkill(our.Player, 0) + our.FightC.UseSkill(our.Player, uint32(allSkills[randomIdx].ID)) + return } // 计算技能威力 diff --git a/logic/service/fight/input/interface.go b/logic/service/fight/input/interface.go index ffe426899..80fba4214 100644 --- a/logic/service/fight/input/interface.go +++ b/logic/service/fight/input/interface.go @@ -9,7 +9,7 @@ import ( type Effect interface { Fight_Start() bool //战斗开始 首发也写这里吧,别)单独写了 - Turn_Start(fattack, sattack *action.SelectSkillAction) //回合开始,注入特性 + TurnStart(fattack, sattack *action.SelectSkillAction) //回合开始,注入特性 ComparePre(fattack, sattack *action.SelectSkillAction) bool //比较前对优先级的修改 //技能命中前的返回值代表是否可以出手 ,对命中本身的修改应该是对上下文本身的修改 //对技能修改 行动开始前,注入视为等参数在这里实现 @@ -34,7 +34,7 @@ type Effect interface { //Damage_Use() bool // 伤害作用 Skill_Use_ex() bool //技能PP减少节点 Skill_Useed() bool //技能PP减少节点 - Action_end_ex() bool + ActionEndEx() bool Action_end() bool //OnDefeat(opp *Input) bool // 精灵被击败时触发 @@ -46,7 +46,7 @@ type Effect interface { // OnOwnerSwitchIn() bool // 所属玩家精灵出战时触发 // OnOwnerSwitchOut() bool // 所属玩家精灵下场时触发 - Turn_End() //回合结束计算 + TurnEnd() //回合结束计算 HookAction() bool //出手前的hook参数,返回false阻止继续出手 //PreBattleEnd() bool //战斗结束前 OnBattleEnd() bool //战斗结束 diff --git a/logic/service/fight/node/Turn.go b/logic/service/fight/node/Turn.go index 9a24df1e7..d66906591 100644 --- a/logic/service/fight/node/Turn.go +++ b/logic/service/fight/node/Turn.go @@ -14,10 +14,10 @@ func (e *EffectNode) ComparePre(fattack, sattack *action.SelectSkillAction) bool return true } -func (e *EffectNode) Turn_Start(fattack, sattack *action.SelectSkillAction) { +func (e *EffectNode) TurnStart(fattack, sattack *action.SelectSkillAction) { //panic("not implemented") // TODO: Implement } -func (e *EffectNode) Turn_End() { +func (e *EffectNode) TurnEnd() { // println("效果结算", e.id.Suffix(), e.duration) if e.duration == 0 { // 保留 (负数表示永久) diff --git a/logic/service/fight/node/fight.go b/logic/service/fight/node/fight.go index d00a79d2c..1d52daab1 100644 --- a/logic/service/fight/node/fight.go +++ b/logic/service/fight/node/fight.go @@ -18,7 +18,7 @@ func (e *EffectNode) OnBattleEnd() bool { func (e *EffectNode) EFFect_Befer(in *input.Input, effEffect input.Effect) bool { return true } -func (e *EffectNode) Action_end_ex() bool { +func (e *EffectNode) ActionEndEx() bool { // panic("not implemented") // TODO: Implement return true } diff --git a/modules/config/service/shiny.go b/modules/config/service/shiny.go index 9cf9785ae..4d28df446 100644 --- a/modules/config/service/shiny.go +++ b/modules/config/service/shiny.go @@ -2,7 +2,6 @@ package service import ( "blazing/common/data" - "blazing/common/utils" "blazing/cool" "blazing/modules/config/model" "context" @@ -91,24 +90,15 @@ func (s *ShinyService) FixShiny(id uint32) *data.GlowFilter { Force: false, }).Scan(&ret) - rets := utils.ToMap(ret, func(t model.ColorfulSkin) uint32 { - return uint32(t.ID) - }) + v := ret[grand.Intn(len(ret))] - for _, v := range rets { - //print(v.ID) - - id := v.ID - - var t data.GlowFilter - - r := json.Unmarshal([]byte(v.Color), &t) - if r == nil { - m := cool.DBM(s.Model).Where("id", id) - m.Increment("usage_count", 1) - return &t - } + var t data.GlowFilter + r := json.Unmarshal([]byte(v.Color), &t) + if r == nil { + m := cool.DBM(s.Model).Where("id", v.ID) + m.Increment("usage_count", 1) + return &t } return nil