refactor: 重构战斗属性和特效应用逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-04-06 03:11:38 +08:00
committed by cnb
parent a16a06e389
commit 40ec827342
9 changed files with 166 additions and 39 deletions

View File

@@ -145,28 +145,6 @@ func (our *Input) SetCurPetAt(index int, pet *info.BattlePetEntity) {
our.CurPet[index] = pet
}
func applyInitPetEffectBonus(pet *info.BattlePetEntity, effect model.PetEffectInfo) {
if pet == nil || effect.EID != 26 || len(effect.Args) < 2 {
return
}
for i := 0; i+1 < len(effect.Args); i += 2 {
attr := effect.Args[i]
value := effect.Args[i+1]
if value <= 0 {
continue
}
switch attr {
case 0:
pet.Info.MaxHp += uint32(value)
pet.Info.Hp += uint32(value)
case 1, 2, 3, 4, 5:
pet.Info.Prop[attr-1] += uint32(value)
}
}
}
// 非原地交换收集非0血量精灵 + 0血量精灵拼接后返回
func (our *Input) SortPet() {
var nonZeroHP []*info.BattlePetEntity // 收集血量>0的精灵保持原顺序
@@ -189,7 +167,7 @@ func (our *Input) SortPet() {
t.Duration(-1)
applyInitPetEffectBonus(s, e1)
s.ApplyInitEffectBonus(e1)
our.AddEffect(our, t)
}