refactor(controller): 重构控制器函数命名和代码注释

- 重命名 EGG 函数为 EggGamePlay,更新宠物生成逻辑
- 重命名 Leiyi 函数为 GetLeiyiTrainStatus
- 重命名 Cacthpet 函数为 CatchPet,添加详细函数注释
- 为 ArenaSetOwner、ArenaFightOwner、ArenaGetInfo、ArenaUpfight、ArenaOwnerAcce
  等擂台相关函数添加注释前缀
- 重命名 PETKing 函数为 PetKing
- 重命名 FRESH_CHOICE_FIGHT_LEVEL 函数为 FreshChoiceFightLevel,添加详细参数说明
- 重命名 BuyMItem 函数为 BuyMultipleItems
- 重命名 ITEM_SALE 函数为 ItemSale,优化代码结构
- 重命名 UserItemList 函数为 GetUserItemList,重命名 ItemUsePet 为 UsePetItemOutOfFight
 添加 ResetNature 函数注释
- 重命名 COMMEND_ONLINE 函数为 GetServerOnline
- 重命名 Login 函数,优化变量命名
- 重命名 MapEnter 为 EnterMap,MapHot 为 GetMapHot,MapLeave 为 LeaveMap
  MapList 为 GetMapPlayerList,Attack_Boss 为 AttackBoss
- 为 GetNonoInfo 函数添加注释前缀
- 重命名 IS_COLLECT 函数为 IsCollect
- 重命名 PetEVdiy 函数为 PetEVDiy,添加详细注释
- 为 GetPetInfo、GetPetList、GetPetReleaseList、PetReleaseToWarehouse、
  PetRetrieveFromWarehouse、TogglePetBagWarehouse、PlayerShowPet、
  PetOneCure、PetFirst、GetPetBargeList 等宠物相关函数添加注释
- 重命名 SetPetSkill 为 SetPetSkill,SkillSort 为 SortPetSkills
- 重命名 BUY_FITMENT 为 BuyFitment,添加函数注释
```
This commit is contained in:
2025-12-24 19:03:49 +08:00
9 changed files with 21 additions and 32 deletions

View File

@@ -8,6 +8,8 @@ import (
"blazing/logic/service/pet"
"blazing/logic/service/player"
"blazing/modules/blazing/model"
"github.com/samber/lo"
)
// SetPetSkill 设置宠物技能消耗50赛尔豆
@@ -24,12 +26,19 @@ func (h Controller) SetPetSkill(data *pet.ChangeSkillInfo, c *player.Player) (re
if !ok {
return nil, errorcode.ErrorCodes.ErrSystemBusy
}
canleaernskill := onpet.GetLevelRangeCanLearningSkills(1, onpet.Level)
// 检查要替换的技能是否已存在
_, _, exists := utils.FindWithIndex(currentPet.SkillList, func(item model.SkillInfo) bool {
_, ok = lo.Find(canleaernskill, func(item uint32) bool {
return item == data.ReplaceSkill
})
if !ok {
return result, errorcode.ErrorCodes.ErrSystemBusy
}
_, _, ok = utils.FindWithIndex(onpet.SkillList, func(item model.SkillInfo) bool { //已经存在技能
return item.ID == data.ReplaceSkill
})
if exists {
if ok {
return nil, 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

@@ -259,7 +259,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *action.SelectSkillAction)
defender.CurrentPet.Info.Hp = 1
}
if f.IsWin(defender, attacker.CurrentPet.Info.CatchTime) { //然后检查是否战斗结束
if f.IsWin(defender) { //然后检查是否战斗结束
f.FightOverInfo.WinnerId = defender.UserID
@@ -280,7 +280,7 @@ func (f *FightC) enterturn(firstAttack, secondAttack *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
}