refactor: 重构战斗属性和特效应用逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user