From 839d02b17f4b7f85f5918025673e5fa9cf557570 Mon Sep 17 00:00:00 2001 From: 1 <1@72wo.cn> Date: Tue, 23 Dec 2025 13:53:34 +0000 Subject: [PATCH] =?UTF-8?q?"fix(logic):=20=E4=BF=AE=E5=A4=8D=E5=AE=A0?= =?UTF-8?q?=E7=89=A9=E6=8A=80=E8=83=BD=E5=AD=A6=E4=B9=A0=E6=A0=A1=E9=AA=8C?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E5=B9=B6=E7=A7=BB=E9=99=A4=E5=86=97=E4=BD=99?= =?UTF-8?q?=E6=88=98=E6=96=97=E6=95=88=E6=9E=9C=E5=AD=97=E6=AE=B5"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logic/controller/pet_skill.go | 11 +++++++++++ logic/service/fight/effect/effect_100.go | 1 - logic/service/fight/effect/effect_110.go | 1 - logic/service/fight/effect/effect_111.go | 1 - logic/service/fight/effect/effect_113.go | 1 - logic/service/fight/effect/effect_7.go | 3 +-- logic/service/fight/effect/effect_attr.go | 8 ++++---- logic/service/fight/fightc.go | 4 ++-- logic/service/fight/input.go | 19 ++----------------- 9 files changed, 20 insertions(+), 29 deletions(-) diff --git a/logic/controller/pet_skill.go b/logic/controller/pet_skill.go index 0b17609e6..b166764f5 100644 --- a/logic/controller/pet_skill.go +++ b/logic/controller/pet_skill.go @@ -8,6 +8,8 @@ import ( "blazing/logic/service/pet" "blazing/logic/service/player" "blazing/modules/blazing/model" + + "github.com/samber/lo" ) func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (result *pet.ChangeSkillOutInfo, err errorcode.ErrorCode) { @@ -16,6 +18,15 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re } c.Info.Coins -= 50 _, onpet, ok := c.FindPet(data.CatchTime) + if !ok { + return result, errorcode.ErrorCodes.ErrSystemBusy + } + canleaernskill := onpet.GetLevelRangeCanLearningSkills(1, onpet.Level) + + _, ok = lo.Find(canleaernskill, func(item uint32) bool { + return item == data.ReplaceSkill + }) + if !ok { return result, errorcode.ErrorCodes.ErrSystemBusy } diff --git a/logic/service/fight/effect/effect_100.go b/logic/service/fight/effect/effect_100.go index b1ed5cb81..fbdc12b45 100644 --- a/logic/service/fight/effect/effect_100.go +++ b/logic/service/fight/effect/effect_100.go @@ -11,7 +11,6 @@ import ( // 自身体力越少则威力越大 type Effect100 struct { node.EffectNode - can bool } func (e *Effect100) Skill_Hit() bool { diff --git a/logic/service/fight/effect/effect_110.go b/logic/service/fight/effect/effect_110.go index 0da907ff9..0c57014ad 100644 --- a/logic/service/fight/effect/effect_110.go +++ b/logic/service/fight/effect/effect_110.go @@ -9,7 +9,6 @@ import ( // n 回合内,每次躲避攻击都有m%几率使自身XX等级提升1个等级 type Effect110 struct { node.EffectNode - can bool } // 默认添加回合 diff --git a/logic/service/fight/effect/effect_111.go b/logic/service/fight/effect/effect_111.go index 75090a1a3..c0097e054 100644 --- a/logic/service/fight/effect/effect_111.go +++ b/logic/service/fight/effect/effect_111.go @@ -12,7 +12,6 @@ import ( // 固定伤害∈[100%,200%]*精灵等级 type Effect111 struct { node.EffectNode - can bool } func (e *Effect111) OnSkill() bool { diff --git a/logic/service/fight/effect/effect_113.go b/logic/service/fight/effect/effect_113.go index c6940638a..4ab7ecae9 100644 --- a/logic/service/fight/effect/effect_113.go +++ b/logic/service/fight/effect/effect_113.go @@ -10,7 +10,6 @@ import ( // 26+精灵个体值*4(有待验证) type Effect113 struct { node.EffectNode - can bool } func (e *Effect113) Skill_Hit() bool { diff --git a/logic/service/fight/effect/effect_7.go b/logic/service/fight/effect/effect_7.go index ba81f94df..4b4de944f 100644 --- a/logic/service/fight/effect/effect_7.go +++ b/logic/service/fight/effect/effect_7.go @@ -1,7 +1,6 @@ package effect import ( - "blazing/logic/service/fight/action" "blazing/logic/service/fight/info" "blazing/logic/service/fight/input" "blazing/logic/service/fight/node" @@ -25,7 +24,7 @@ type Effect7 struct { max alpacadecimal.Decimal } -func (e *Effect7) Action_start(a, b *action.SelectSkillAction) bool { +func (e *Effect7) Skill_Hit() bool { if e.Ctx().Opp.CurrentPet.Info.Hp <= e.Ctx().Our.CurrentPet.Info.Hp { e.Ctx().SkillEntity.Accuracy = 0 } diff --git a/logic/service/fight/effect/effect_attr.go b/logic/service/fight/effect/effect_attr.go index 18f79fdf3..f7643505c 100644 --- a/logic/service/fight/effect/effect_attr.go +++ b/logic/service/fight/effect/effect_attr.go @@ -171,11 +171,11 @@ func (e *EffectPropSyncReverse) Alive(t ...bool) bool { // 同步属性类型:保存我方原始值,覆盖为对方值 e.ctx.oldOurType = e.ourpet.PetInfo.Type e.ourpet.PetInfo.Type = e.opppet.PetInfo.Type - case opTypeMaxHP: // 减少最大生命值 - if e.opppet.GetMaxHP().Cmp(e.Args()[0]) == -1 { - e.opppet.Info.MaxHp -= uint32(e.Args()[0].IntPart()) + // case opTypeMaxHP: // 减少最大生命值 + // if e.opppet.GetMaxHP().Cmp(e.Args()[0]) == -1 { + // e.opppet.Info.MaxHp -= uint32(e.Args()[0].IntPart()) - } + // } } e.can = false diff --git a/logic/service/fight/fightc.go b/logic/service/fight/fightc.go index bca373963..37195d5ef 100644 --- a/logic/service/fight/fightc.go +++ b/logic/service/fight/fightc.go @@ -320,7 +320,7 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { defender.CurrentPet.Info.Hp = 1 } - if f.IsWin(defender, attacker.CurrentPet.Info.CatchTime) { //然后检查是否战斗结束 + if f.IsWin(defender) { //然后检查是否战斗结束 f.FightOverInfo.WinnerId = defender.UserID @@ -341,7 +341,7 @@ func (f *FightC) enterturn(fattack, sattack *action.SelectSkillAction) { //defender.CanAction = true //被打死就可以切精灵了 // AI自动技能 defender.CurrentPet.NotAlive = true - if f.IsWin(attacker, defender.CurrentPet.Info.CatchTime) { //然后检查是否战斗结束 + if f.IsWin(attacker) { //然后检查是否战斗结束 var WinnerId uint32 if i == 0 { WinnerId = f.First.Player.GetInfo().UserID diff --git a/logic/service/fight/input.go b/logic/service/fight/input.go index 316e8c04a..da4d3f516 100644 --- a/logic/service/fight/input.go +++ b/logic/service/fight/input.go @@ -372,24 +372,9 @@ func NewFight(p1, p2 common.PlayerI, fn func(*info.FightOverInfo)) (*FightC, err } // 被击败的ID -func (b *FightC) IsWin(c *input.Input, cache uint32) bool { +func (f *FightC) IsWin(c *input.Input) bool { - var tt []*info.BattlePetEntity - bbb := b.Our.AllPet - - if c.Player.GetInfo().UserID == b.ownerID { //如果是房主 - bbb = b.Opp.AllPet - } - - for _, v := range bbb { - if v.Info.CatchTime == cache { - v.NotAlive = true - - } - tt = append(tt, v) - } - - for _, v := range tt { + for _, v := range f.GetInputByPlayer(c.Player, true).AllPet { if !v.NotAlive { //如果存活 return false }