feat: 支持多精灵战斗位操作

This commit is contained in:
xinian
2026-04-04 04:28:04 +08:00
committed by cnb
parent 603c1b5ad3
commit 6439995434
404 changed files with 2567 additions and 1672 deletions

View File

@@ -18,7 +18,7 @@ import (
type Input struct {
CanChange uint32 //是否可以死亡切换CanChange
// CanAction bool //是否可以行动
CurrentPet *info.BattlePetEntity //当前精灵
CurrentPet []*info.BattlePetEntity //当前上场精灵
AllPet []*info.BattlePetEntity
Player common.PlayerI
Opp *Input
@@ -53,6 +53,7 @@ type Input struct {
func NewInput(c common.FightI, p common.PlayerI) *Input {
ret := &Input{FightC: c, Player: p}
ret.Effects = make([]Effect, 0)
ret.CurrentPet = make([]*info.BattlePetEntity, 0)
// t := Geteffect(EffectType.Damage, 0)
// t.Effect.SetArgs(ret)
@@ -63,6 +64,27 @@ func NewInput(c common.FightI, p common.PlayerI) *Input {
}
func (our *Input) CurrentPetAt(index int) *info.BattlePetEntity {
if our == nil || index < 0 || index >= len(our.CurrentPet) {
return nil
}
return our.CurrentPet[index]
}
func (our *Input) PrimaryCurrentPet() *info.BattlePetEntity {
return our.CurrentPetAt(0)
}
func (our *Input) SetCurrentPetAt(index int, pet *info.BattlePetEntity) {
if our == nil || index < 0 {
return
}
for len(our.CurrentPet) <= index {
our.CurrentPet = append(our.CurrentPet, nil)
}
our.CurrentPet[index] = pet
}
// 非原地交换收集非0血量精灵 + 0血量精灵拼接后返回
func (our *Input) SortPet() {
var nonZeroHP []*info.BattlePetEntity // 收集血量>0的精灵保持原顺序
@@ -102,7 +124,7 @@ func (our *Input) SortPet() {
func (our *Input) GetPetInfo() *info.BattlePetEntity {
return our.CurrentPet
return our.PrimaryCurrentPet()
}
func (our *Input) SetOPP(t *Input) {
@@ -164,9 +186,13 @@ func (our *Input) GenSataus() {
}
func (our *Input) GenInfo() {
currentPet := our.PrimaryCurrentPet()
if currentPet == nil {
return
}
our.RemainHp = int32(our.CurrentPet.Info.Hp)
our.SkillList = our.CurrentPet.Info.SkillList
our.RemainHp = int32(currentPet.Info.Hp)
our.SkillList = currentPet.Info.SkillList
// f.Second.SkillList = f.Second.CurrentPet.Info.SkillList
// f.Second.RemainHp = int32(f.Second.CurrentPet.Info.Hp)