public IActor GetTargetAIArrow(MonoBehaviour component)
        {
            if (GameMode.IsPartnerMode)
            {
                return GetTargetAIArrowPartnerMode(component);
            }
            
            foreach (var triggerEffect in cardObject.GetEffects().SelectMany(e => e.triggerEffects))
            {
                // 如果是不需要选目标的效果就直接返回
                if (!cardObject.IsNeedChooseTargetEffect(triggerEffect.playerInputEventType))
                {
                    continue;
                }
                
                // 如果有指向随从的效果
                if (triggerEffect.targetType.HasFlag(TargetType.Minion))
                {
                    if (component is MinionCardDisplayer minionCardDisPlayer)
                    {
                        // 未部署好，无法选中
                        if (!minionCardDisPlayer.cardObject.GetIsDeployed())
                        {
                            return null;
                        }
                        
                        // 魔法陷阱卡不能指向魔免单位
                        if((cardObject.GetCardType() == CardTypes.MagicCard||cardObject.GetCardType()== CardTypes.TrapCard) 
                           && minionCardDisPlayer.cardObject.HasEffect(CardKeyWordType.MagicImmunity))
                        {
                            return null;
                        }
                        
                        if (triggerEffect.targetType.HasFlag(TargetType.OwnSide) && minionCardDisPlayer.cardObject
                                .GetOwnerPlayer().IsSameWith(cardObject.GetOwnerPlayer()))
                        {
                            return minionCardDisPlayer.cardObject;
                        }
                        if (triggerEffect.targetType.HasFlag(TargetType.OppositeSide) && !minionCardDisPlayer.cardObject
                                .GetOwnerPlayer().IsSameWith(cardObject.GetOwnerPlayer()))
                        {
                            return minionCardDisPlayer.cardObject;
                        }
                    }
                }
                // 如果有指向建筑的效果
                if (triggerEffect.targetType.HasFlag(TargetType.Structure))
                {
                    if (component is StructureCardDisplayer structureCardDisPlayer)
                    {
                        if (triggerEffect.targetType.HasFlag(TargetType.OwnSide) && structureCardDisPlayer.cardObject
                                .GetOwnerPlayer().IsSameWith(cardObject.GetOwnerPlayer()))
                        {
                            return structureCardDisPlayer.cardObject;
                        }
                        if (triggerEffect.targetType.HasFlag(TargetType.OppositeSide) && !structureCardDisPlayer.cardObject
                                .GetOwnerPlayer().IsSameWith(cardObject.GetOwnerPlayer()))
                        {
                            return structureCardDisPlayer.cardObject;
                        }
                    }
                }
                // 如果有指向英雄的效果
                if (triggerEffect.targetType.HasFlag(TargetType.Hero))
                {
                    if (component is HeroDisplayer heroDisPlayer)
                    {
                        Hero hero = heroDisPlayer.GetActorObject<Hero>();
                        if (triggerEffect.targetType.HasFlag(TargetType.OwnSide) && hero
                                .GetOwner().IsSameWith(cardObject.GetOwnerPlayer()))
                        {
                            return hero;
                        }
                        if (triggerEffect.targetType.HasFlag(TargetType.OppositeSide) && !hero
                                .GetOwner().IsSameWith(cardObject.GetOwnerPlayer()))
                        {
                            return hero;
                        }
                    }
                }
                // 如果有指向陷阱的效果
                if (triggerEffect.targetType.HasFlag(TargetType.Trap))
                {
                    if (component is TrapCardDisplayer trapCardDisPlayer)
                    {
                        if (triggerEffect.targetType.HasFlag(TargetType.OwnSide) && trapCardDisPlayer.cardObject
                                .GetOwnerPlayer().IsSameWith(cardObject.GetOwnerPlayer()))
                        {
                            return trapCardDisPlayer.cardObject;
                        }
                        if (triggerEffect.targetType.HasFlag(TargetType.OppositeSide) && !trapCardDisPlayer.cardObject
                                .GetOwnerPlayer().IsSameWith(cardObject.GetOwnerPlayer()))
                        {
                            return trapCardDisPlayer.cardObject;
                        }
                    }
                }
            }

            return null;
        }
        
        private IActor GetTargetAIArrowPartnerMode(MonoBehaviour component)
        {
            ActorRef<Player> cardOwner = cardObject.GetOwnerPlayer();
            foreach (var triggerEffect in cardObject.GetEffects().SelectMany(e => e.triggerEffects))
            {
                // 如果是不需要选目标的效果就直接返回
                if (!cardObject.IsNeedChooseTargetEffect(triggerEffect.playerInputEventType))
                {
                    continue;
                }
                
                // 如果有指向随从的效果
                if (triggerEffect.targetType.HasFlag(TargetType.Minion))
                {
                    if (component is MinionCardDisplayer minionCardDisPlayer)
                    {
                        // 未部署好，无法选中
                        if (!minionCardDisPlayer.cardObject.GetIsDeployed())
                        {
                            return null;
                        }
                        
                        // 魔法陷阱卡不能指向魔免单位
                        if((cardObject.GetCardType() == CardTypes.MagicCard || cardObject.GetCardType()== CardTypes.TrapCard) 
                           && minionCardDisPlayer.cardObject.HasEffect(CardKeyWordType.MagicImmunity))
                        {
                            return null;
                        }

                        ActorRef<Player> targetCardOwner = minionCardDisPlayer.cardObject.GetOwnerPlayer();
                        if (triggerEffect.targetType.HasFlag(TargetType.OwnSide) && (targetCardOwner.IsSameWith(cardOwner) || 
                                GameMode.IsPartner(targetCardOwner,cardOwner)))
                        {
                            return minionCardDisPlayer.cardObject;
                        }
                        if (triggerEffect.targetType.HasFlag(TargetType.OppositeSide) && !(targetCardOwner.IsSameWith(cardOwner) || 
                                GameMode.IsPartner(targetCardOwner,cardOwner)))
                        {
                            return minionCardDisPlayer.cardObject;
                        }
                    }
                }
                // 如果有指向建筑的效果
                if (triggerEffect.targetType.HasFlag(TargetType.Structure))
                {
                    if (component is StructureCardDisplayer structureCardDisPlayer)
                    {
                        ActorRef<Player> targetCardOwner = structureCardDisPlayer.cardObject.GetOwnerPlayer();
                        if (triggerEffect.targetType.HasFlag(TargetType.OwnSide) && (targetCardOwner.IsSameWith(cardOwner) || 
                                GameMode.IsPartner(targetCardOwner,cardOwner)))
                        {
                            return structureCardDisPlayer.cardObject;
                        }
                        if (triggerEffect.targetType.HasFlag(TargetType.OppositeSide) && !(targetCardOwner.IsSameWith(cardOwner) || 
                                GameMode.IsPartner(targetCardOwner,cardOwner)))
                        {
                            return structureCardDisPlayer.cardObject;
                        }
                    }
                }
                // 如果有指向英雄的效果
                if (triggerEffect.targetType.HasFlag(TargetType.Hero))
                {
                    if (component is HeroDisplayer heroDisPlayer)
                    {
                        Hero hero = heroDisPlayer.GetActorObject<Hero>();
                        ActorRef<Player> targetHeroOwner = hero.GetOwner();
                        if (triggerEffect.targetType.HasFlag(TargetType.OwnSide) && (targetHeroOwner.IsSameWith(cardOwner) || 
                                GameMode.IsPartner(targetHeroOwner,cardOwner)))
                        {
                            return hero;
                        }
                        if (triggerEffect.targetType.HasFlag(TargetType.OppositeSide) && !(targetHeroOwner.IsSameWith(cardOwner) || 
                                GameMode.IsPartner(targetHeroOwner,cardOwner)))
                        {
                            return hero;
                        }
                    }
                }
                // 如果有指向陷阱的效果
                if (triggerEffect.targetType.HasFlag(TargetType.Trap))
                {
                    if (component is TrapCardDisplayer trapCardDisPlayer)
                    {
                        ActorRef<Player> targetCardOwner = trapCardDisPlayer.cardObject.GetOwnerPlayer();
                        if (triggerEffect.targetType.HasFlag(TargetType.OwnSide) && (targetCardOwner.IsSameWith(cardOwner) || 
                                GameMode.IsPartner(targetCardOwner,cardOwner)))
                        {
                            return trapCardDisPlayer.cardObject;
                        }
                        if (triggerEffect.targetType.HasFlag(TargetType.OppositeSide) && !(targetCardOwner.IsSameWith(cardOwner) || 
                                GameMode.IsPartner(targetCardOwner,cardOwner)))
                        {
                            return trapCardDisPlayer.cardObject;
                        }
                    }
                }
            }

            return null;
        } 帮忙优化一下这段代码