"fix(logic): 修复宠物技能学习校验逻辑并移除冗余战斗效果字段"

This commit is contained in:
1
2025-12-23 13:53:34 +00:00
parent 83ee9fba43
commit 839d02b17f
9 changed files with 20 additions and 29 deletions

View File

@@ -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
}

View File

@@ -11,7 +11,6 @@ import (
// 自身体力越少则威力越大
type Effect100 struct {
node.EffectNode
can bool
}
func (e *Effect100) Skill_Hit() bool {

View File

@@ -9,7 +9,6 @@ import (
// n 回合内每次躲避攻击都有m%几率使自身XX等级提升1个等级
type Effect110 struct {
node.EffectNode
can bool
}
// 默认添加回合

View File

@@ -12,7 +12,6 @@ import (
// 固定伤害∈[100%200%]*精灵等级
type Effect111 struct {
node.EffectNode
can bool
}
func (e *Effect111) OnSkill() bool {

View File

@@ -10,7 +10,6 @@ import (
// 26+精灵个体值*4有待验证
type Effect113 struct {
node.EffectNode
can bool
}
func (e *Effect113) Skill_Hit() bool {

View File

@@ -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
}

View File

@@ -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

View File

@@ -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

View File

@@ -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
}