```
feat(fight): 实现主动切换宠物逻辑并优化相关结构体字段 - 在 `ActiveSwitchAction` 中新增 `Cid` 字段用于标识要切换的宠物 ID - 调整 `ChangePet` 方法逻辑,移除旧有输入处理,改为在 loop 中统一处理 - 更新 `collectPlayerActions` 方法以正确设置当前宠物及发送指令 - 优化 `PetInfo` 结构体字段标签,去除冗余描述,并重命名部分字段提升可读性 - 增加 `ExtSkin` 字段支持记录可用皮肤信息 - 移除玩家信息中的 `LastResetTime` 注释字段 ```
This commit is contained in:
@@ -62,13 +62,9 @@ func (f *FightC) ChangePet(c common.PlayerI, id uint32) {
|
||||
//todo 待实现无法切精灵的情况
|
||||
ret := &action.ActiveSwitchAction{
|
||||
BaseAction: action.NewBaseAction(c.GetInfo().UserID),
|
||||
Cid: id,
|
||||
}
|
||||
|
||||
selfinput := f.GetInputByPlayer(c, false)
|
||||
|
||||
selfinput.CurrentPet, ret.Reason = selfinput.GetPet(id)
|
||||
c.SendPackCmd(2407, &ret.Reason)
|
||||
|
||||
f.actionChan <- ret
|
||||
}
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ func (a *BaseAction) GetPlayerID() uint32 {
|
||||
// ActiveSwitchAction 主动切换宠物的战斗动作
|
||||
type ActiveSwitchAction struct {
|
||||
BaseAction
|
||||
Cid uint32
|
||||
|
||||
Reason info.ChangePetInfo
|
||||
// CurrentPet BattlePetEntity // 当前在场宠物
|
||||
|
||||
@@ -151,6 +151,8 @@ func (f *FightC) collectPlayerActions(ourID, oppID uint32) map[uint32]action.Bat
|
||||
|
||||
}
|
||||
|
||||
selfinput.CurrentPet, ret.Reason = selfinput.GetPet(ret.Cid)
|
||||
selfinput.Player.SendPackCmd(2407, &ret.Reason)
|
||||
InitAttackValue := *selfinput.AttackValue
|
||||
oldpet := selfinput.CurrentPet
|
||||
f.Switch[selfinput.UserID] = ret
|
||||
|
||||
Reference in New Issue
Block a user