private void RemoveBuff(ActorRef<Card> card)
        {
            var buffInfos = BuffManager.GetBuffInfo(card);
            // 如果有光环效果
            if (buffInfos != null && buffInfos.Count > 0)
            {
                foreach (var buffInfoData in buffInfos)
                {
                    Card cardObject = GetActorObject(card);
                    // 获取buff词条
                    List<Effect> buffEffects = cardObject.GetCardAllEffectsByKeyword(CardKeyWordType.Buff);
                    foreach (var triggerEffect in buffEffects.SelectMany(e => e.triggerEffects))
                    {
                        string luaPath = triggerEffect.luaPath;
                        if (luaPath.Equals(buffInfoData.buffEffect))
                        {
                            if (triggerEffect.targetType.HasFlag(TargetType.OppositeSide))
                            {
                                var buffCardsIn = new BuffCardsIn
                                {
                                    BuffCards = buffInfoData.targetCards.ToList(),
                                    BuffValue = triggerEffect.targetValue
                                };
                                if (luaPath.Contains("Attack"))
                                {
                                    BuffCardsAttack(buffCardsIn);
                                }
                                else if (luaPath.Contains("Health"))
                                {
                                    BuffCardsHealth(buffCardsIn);
                                }
                            }

                            if (triggerEffect.targetType.HasFlag(TargetType.OwnSide))
                            {
                                BuffCardsIn buffCardsIn = new BuffCardsIn
                                {
                                    BuffCards = buffInfoData.targetCards.ToList(),
                                    BuffValue = -triggerEffect.targetValue
                                };
                                if (luaPath.Contains("Attack"))
                                {
                                    BuffCardsAttack(buffCardsIn);
                                }
                                else if (luaPath.Contains("Health"))
                                {
                                    BuffCardsHealth(buffCardsIn);
                                }            
                                else if (luaPath.Contains("Cost"))
                                {
                                    BuffCardsCost(buffCardsIn);
                                }
                            }
                        }
                    }

                    foreach (var hero in buffInfoData.targetHeroes)
                    {
                        Hero heroObject = GetActorObject(hero);
                        int spellPowerData = heroObject.GetSpellPowerValue();
                        List<Effect> spellPowerEffects =
                            cardObject.GetCardAllEffectsByKeyword(CardKeyWordType.SpellPower);

                        var currentSpellPowerData = spellPowerEffects.SelectMany(effect => effect.triggerEffects)
                            .Aggregate(spellPowerData, (current, triggerEffect) => current - triggerEffect.targetValue);

                        Debug.Log($"hero remove spellPower {currentSpellPowerData} by {card.ID}");
                        heroObject.SetSpellPowerValue(currentSpellPowerData);
                    }
                }
            }

            BuffManager.RemoveBuffInfo(card);
        } 帮忙优化一下这段代码