x89rt2 пре 2 месеци
родитељ
комит
d7fdba81fe
1 измењених фајлова са 63 додато и 153 уклоњено
  1. 63 153
      Assets/Scripts/CardEffect/EX7/Purple/EX7_072.cs

+ 63 - 153
Assets/Scripts/CardEffect/EX7/Purple/EX7_072.cs

@@ -1,8 +1,7 @@
-using System;
 using System.Collections;
 using System.Collections.Generic;
-using System.Linq;
 
+// Seventh Fascination
 namespace DCGO.CardEffects.EX7
 {
     public class EX7_072 : CEntity_Effect
@@ -16,69 +15,46 @@ namespace DCGO.CardEffects.EX7
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Return this to bottom of deck, Activate Main", CanUseCondition, card);
-                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
+                activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
                     return "[Trash] [Your Turn] When your Digimon digivolves into [Lilithmon (X Antibody)], by returning this card to the bottom of the deck, activate this card's [Main] effect.";
                 }
 
                 bool PermanentCondition(Permanent permanent)
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
-                    {
-                        if (permanent.TopCard.CardNames.Contains("Lilithmon (X Antibody)"))
-                        {
-                            return true;
-                        }
-
-                        if (permanent.TopCard.CardNames.Contains("Lilithmon(XAntibody)"))
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
-                }              
+                    return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
+                        && (permanent.TopCard.CardNames.Contains("Lilithmon (X Antibody)")
+                            || permanent.TopCard.CardNames.Contains("Lilithmon(XAntibody)"));
+                }
 
                 bool CanUseCondition(Hashtable hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnTrash(card))
-                    {
-                        if (CardEffectCommons.IsOwnerTurn(card))
-                        {
-                            if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition))
-                            {
-                                return true;
-                            }
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.IsExistOnTrashTrigger(card, activateClass)
+                        && CardEffectCommons.IsOwnerTurn(card)
+                        && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentCondition);
                 }
 
                 bool CanActivateCondition(Hashtable hashtable)
                 {
-                    return CardEffectCommons.IsExistOnTrash(card);
+                    return CardEffectCommons.IsExistOnTrashActivate(card, activateClass);
                 }
 
                 IEnumerator ActivateCoroutine(Hashtable _hashtable)
                 {
-                    if (CardEffectCommons.IsExistOnTrash(card))
-                    {
-                        List<CardSource> cardSources = new List<CardSource>() { card };
+                    List<CardSource> cardSources = new List<CardSource>() { card };
 
-                        yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
+                    yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
 
-                        yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect2(cardSources, "Deck Bottom Card", true, true));
+                    yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect2(cardSources, "Deck Bottom Card", true, true));
 
-                        ActivateClass mainActivateClass = CardEffectCommons.OptionMainEffect(card);
+                    ActivateClass mainActivateClass = CardEffectCommons.OptionMainEffect(card);
 
-                        if (mainActivateClass != null)
-                        {
-                            yield return ContinuousController.instance.StartCoroutine(mainActivateClass.Activate(CardEffectCommons.OptionMainCheckHashtable(card)));
-                        }
+                    if (mainActivateClass != null)
+                    {
+                        yield return ContinuousController.instance.StartCoroutine(mainActivateClass.Activate(CardEffectCommons.OptionMainCheckHashtable(card)));
                     }
                 }
             }
@@ -89,10 +65,10 @@ namespace DCGO.CardEffects.EX7
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("All Opponents Digimon gain \"Delete 1 of your Digimon\"", CanUseCondition, card);
-                activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
+                activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
                     return "[Main] All your opponent's Digimon gain \" [End of Your Turn] Delete 1 of your Digimon.\" until the end of their turn.";
                 }
@@ -106,127 +82,70 @@ namespace DCGO.CardEffects.EX7
                 {
                     bool PermanentCondition(Permanent permanent)
                     {
-                        if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
-                        {
-                            if (!permanent.TopCard.CanNotBeAffected(activateClass))
-                            {
-                                return true;
-                            }
-                        }
-
-                        return false;
+                        return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
+                            && !permanent.TopCard.CanNotBeAffected(activateClass);
                     }
 
                     foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaPermanents())
                     {
                         if (PermanentCondition(permanent))
-                        {
-                            yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
-                        }
-                    }
-
-                    AddSkillClass addSkillClass = new AddSkillClass();
-                    addSkillClass.SetUpICardEffect("Delete 1 of your Digimon", CanUseCondition1, card);
-                    addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
-
-                    card.Owner.UntilOpponentTurnEndEffects.Add((_timing) => addSkillClass);
-                    card.Owner.UntilOpponentTurnEndEffects.Add(GetDetailEffect);
-
-                    bool CanUseCondition1(Hashtable hashtable)
-                    {
-                        return true;
-                    }
-
-                    bool CardSourceCondition(CardSource cardSource)
-                    {
-                        if (PermanentCondition(cardSource.PermanentOfThisCard()))
-                        {
-                            if (cardSource == cardSource.PermanentOfThisCard().TopCard)
-                            {
-                                return true;
-                            }
-                        }
-
-                        return false;
-                    }
-
-                    ICardEffect GetDetailEffect(EffectTiming timing)
-                    {
-                        if (timing == EffectTiming.None)
-                        {
-                            return CardEffectFactory.AddDetailClass(CanUseCondition1, PermanentCondition, "[End of your turn] Delete 1 of your Digimon", true, card);
-                        }
-                        return null;
-                    }
-
-                    List<ICardEffect> GetEffects(CardSource cardSource, List<ICardEffect> cardEffects, EffectTiming _timing)
-                    {
-                        if (_timing == EffectTiming.OnEndTurn)
                         {
                             ActivateClass activateClass1 = new ActivateClass();
-                            activateClass1.SetUpICardEffect("Delete 1 of your Digimon", CanUseCondition2, cardSource);
-                            activateClass1.SetUpActivateClass(CanActivateCondition2, ActivateCoroutine1, -1, false, EffectDiscription1());
-                            activateClass1.SetEffectSourceCard(cardSource);
-                            cardEffects.Add(activateClass1);
+                            activateClass1.SetUpICardEffect("Delete 1 of your Digimon", CanUseCondition1, permanent.TopCard);
+                            activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDescription1());
+                            activateClass1.SetEffectSourcePermanent(permanent);
+                            CardEffectCommons.AddEffectToPermanent(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: PermanentEffectFactory.AddDetailClass(permanent, "[End of Your Turn] Delete 1 of your Digimon.", true, activateClass), timing: EffectTiming.None);
+                            CardEffectCommons.AddEffectToPermanent(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, card: card, cardEffect: activateClass1, timing: EffectTiming.OnEndTurn);
 
-                            if (cardSource.PermanentOfThisCard() != null)
+                            if (!permanent.TopCard.CanNotBeAffected(activateClass))
                             {
-                                activateClass1.SetEffectSourcePermanent(cardSource.PermanentOfThisCard());
+                                yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
                             }
 
-                            string EffectDiscription1()
+                            string EffectDescription1()
                             {
                                 return "[End of Your Turn] Delete 1 of your Digimon.";
                             }
 
-                            bool CanSelectPermanentCondition(Permanent permanent)
+                            bool CanUseCondition1(Hashtable hashtable1)
                             {
-                                return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, cardSource);
+                                return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
+                                    && permanent.TopCard.Owner.GetBattleAreaDigimons().Contains(permanent)
+                                    && GManager.instance.turnStateMachine.gameContext.TurnPlayer == permanent.TopCard.Owner
+                                    && !permanent.TopCard.CanNotBeAffected(activateClass);
                             }
 
-                            bool CanUseCondition2(Hashtable hashtable)
+                            bool CanActivateCondition1(Hashtable hashtable1)
                             {
-                                if (CardEffectCommons.IsOwnerTurn(cardSource))
-                                {
-                                    if(CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource))
-                                        return CardSourceCondition(cardSource);                                    
-                                }
-
-                                return false;
+                                return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
+                                    && !permanent.TopCard.CanNotBeAffected(activateClass);
                             }
 
-                            bool CanActivateCondition2(Hashtable hashtable)
+                            bool CanSelectPermanentCondition(Permanent permanent)
                             {
-                                return CardEffectCommons.IsExistOnBattleAreaDigimon(cardSource);
+                                return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
                             }
 
-                            IEnumerator ActivateCoroutine1(Hashtable _hashtable)
+                            IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
                             {
-                                if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
-                                {
-                                    int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
-
-                                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
-
-                                    selectPermanentEffect.SetUp(
-                                        selectPlayer: cardSource.Owner,
-                                        canTargetCondition: CanSelectPermanentCondition,
-                                        canTargetCondition_ByPreSelecetedList: null,
-                                        canEndSelectCondition: null,
-                                        maxCount: maxCount,
-                                        canNoSelect: false,
-                                        canEndNotMax: false,
-                                        selectPermanentCoroutine: null,
-                                        afterSelectPermanentCoroutine: null,
-                                        mode: SelectPermanentEffect.Mode.Destroy,
-                                        cardEffect: activateClass);
-
-                                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
-                                }
+                                SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                                selectPermanentEffect.SetUp(
+                                    selectPlayer: permanent.TopCard.Owner,
+                                    canTargetCondition: CanSelectPermanentCondition,
+                                    canTargetCondition_ByPreSelecetedList: null,
+                                    canEndSelectCondition: null,
+                                    maxCount: 1,
+                                    canNoSelect: false,
+                                    canEndNotMax: false,
+                                    selectPermanentCoroutine: null,
+                                    afterSelectPermanentCoroutine: null,
+                                    mode: SelectPermanentEffect.Mode.Destroy,
+                                    cardEffect: activateClass);
+
+                                yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
                             }
                         }
-
-                        return cardEffects;
                     }
                 }
             }
@@ -237,26 +156,19 @@ namespace DCGO.CardEffects.EX7
             {
                 ActivateClass activateClass = new ActivateClass();
                 activateClass.SetUpICardEffect("Delete 1 Opponents unsuspended Digimon", CanUseCondition, card);
-                activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
+                activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
                 activateClass.SetIsSecurityEffect(true);
                 cardEffects.Add(activateClass);
 
-                string EffectDiscription()
+                string EffectDescription()
                 {
                     return "[Main] Delete 1 of your opponent's unsuspended Digimon.";
                 }
 
                 bool CanSelectPermanentCondition(Permanent permanent)
                 {
-                    if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
-                    {
-                        if (!permanent.IsSuspended)
-                        {
-                            return true;
-                        }
-                    }
-
-                    return false;
+                    return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
+                        && !permanent.IsSuspended;
                 }
 
                 bool CanUseCondition(Hashtable hashtable)
@@ -268,8 +180,6 @@ namespace DCGO.CardEffects.EX7
                 {
                     if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
                     {
-                        int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
-
                         SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
 
                         selectPermanentEffect.SetUp(
@@ -277,7 +187,7 @@ namespace DCGO.CardEffects.EX7
                             canTargetCondition: CanSelectPermanentCondition,
                             canTargetCondition_ByPreSelecetedList: null,
                             canEndSelectCondition: null,
-                            maxCount: maxCount,
+                            maxCount: 1,
                             canNoSelect: false,
                             canEndNotMax: false,
                             selectPermanentCoroutine: null,
@@ -294,4 +204,4 @@ namespace DCGO.CardEffects.EX7
             return cardEffects;
         }
     }
-}
+}