From cb1abe69b3ec6e56d8a7daf54982accaff9c3e60 Mon Sep 17 00:00:00 2001 From: 1 <1@72wo.cn> Date: Wed, 15 Oct 2025 14:24:46 +0000 Subject: [PATCH] =?UTF-8?q?```=20refactor(fight):=20=E9=87=8D=E6=9E=84?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E6=95=88=E6=9E=9C=E5=A4=84=E7=90=86=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E7=BB=9F=E4=B8=80=E4=BD=BF=E7=94=A8Skill=5FH?= =?UTF-8?q?it=5FPre=E6=96=B9=E6=B3=95=E5=B9=B6=E4=BF=AE=E5=A4=8D=E5=9B=9E?= =?UTF-8?q?=E5=90=88=E5=BC=80=E5=A7=8B=E8=A7=A6=E5=8F=91=E6=97=B6=E6=9C=BA?= =?UTF-8?q?```?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 待实现寄生种子 --- logic/service/fight/effect/effect_status.go | 31 +++++++++++---------- logic/service/fight/fightc.go | 21 ++++++++------ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/logic/service/fight/effect/effect_status.go b/logic/service/fight/effect/effect_status.go index 93d25759e..3bc2260f7 100644 --- a/logic/service/fight/effect/effect_status.go +++ b/logic/service/fight/effect/effect_status.go @@ -18,7 +18,8 @@ type StatusNotSkill struct { EffectStatus } -func (e *StatusNotSkill) CanSkill(opp *input.Input) bool { +// 不能出手 +func (e *StatusNotSkill) Skill_Hit_Pre(input.Ctx) bool { return false } @@ -28,19 +29,16 @@ type DrainHP struct { EffectStatus } -func (e *DrainHP) OnTurnStart(opp *input.Input) { +func (e *DrainHP) Skill_Hit_Pre(input input.Ctx) bool { + input.DamageZone = &info.DamageZone{ - e.Input.Damage(input.Ctx{ - - Input: opp, - DamageZone: &info.DamageZone{ - - Type: info.DamageType.Red, - Damage: decimal.NewFromUint64(uint64(opp.CurrentPet.Info.MaxHp)). - Div(decimal.NewFromInt(8)), - }, - }) + Type: info.DamageType.True, //状态类扣除无法被减伤 + Damage: decimal.NewFromUint64(uint64(e.Input.CurrentPet.Info.MaxHp)). + Div(decimal.NewFromInt(8)), + } + e.Input.Damage(input) + return true } // 被寄生种子 扣血类 @@ -48,10 +46,13 @@ type StatusDrainedHP struct { DrainHP } -func (e *StatusDrainedHP) OnTurnStart(opp *input.Input) { - e.DrainHP.OnTurnStart(opp) +func (e *StatusDrainedHP) Skill_Hit_Pre(input input.Ctx) bool { + e.DrainHP.Skill_Hit_Pre(input) //先调用父类扣血 + //TODO 寄生种子 给对面回血,待实现回血buff - opp.CurrentPet.Info.Hp = -e.Input.CurrentPet.Info.MaxHp / 8 + // input.CurrentPet.Info.Hp = -e.Input.CurrentPet.Info.MaxHp / 8 + + return true } func init() { diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index 6f8d90e00..967497472 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -390,7 +390,7 @@ func (f *FightC) processSkillAttack(attacker, defender *input.Input, a *action.S attacker.Exec(func(t input.Effect) bool { //计算命中 miss改命中 t.Skill_Hit_Pre(input.Ctx{ //调基础命中 - Input: attacker, + Input: defender, SkillEntity: a.Skill, }) //相当于先调整基础命中,不光调整命中,这里还能调整技能属性,暴击率 @@ -552,6 +552,18 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { } var attacker, defender *input.Input + f.First.Exec(func(t input.Effect) bool { //回合开始前 + + //结算状态 + t.Turn_Start(input.Ctx{Input: f.First}) + return true + }) + f.Second.Exec(func(t input.Effect) bool { //回合开始前 + + //结算状态 + t.Turn_Start(input.Ctx{Input: f.Second}) + return true + }) //开始回合操作 for i := 0; i < 2; i++ { var oldskill interface{} @@ -564,13 +576,6 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { oldskill, _ = deepcopy.Anything(sattack.Skill) //备份技能 } - attacker.Exec(func(t input.Effect) bool { //回合开始前 - - //结算状态 - t.Turn_Start(input.Ctx{Input: attacker}) - return true - }) - canuseskill := true // 实际上攻击方 还有系统选择放弃出手的 if IsNil(oldskill) || attacker.CurrentPet.Info.Hp <= 0 {