Просмотр исходного кода

Merge pull request #1564 from DCGO2/hooperk-EX7-072

Update EX7-072
x89rt2 1 месяц назад
Родитель
Сommit
fa9f7d713f
1 измененных файлов с 62 добавлено и 34 удалено
  1. 62 34
      Assets/Scripts/CardEffect/EX7/Purple/EX7_072.cs

+ 62 - 34
Assets/Scripts/CardEffect/EX7/Purple/EX7_072.cs

@@ -86,21 +86,32 @@ namespace DCGO.CardEffects.EX7
                             && !permanent.TopCard.CanNotBeAffected(activateClass);
                     }
 
-                    foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaPermanents())
+                    AddSkillClass addSkillClass = new AddSkillClass();
+                    addSkillClass.SetUpICardEffect("Your opponent's Digimon gain [End of your Turn] Delete 1 of your Digimon", CanUseCondition, card);
+                    addSkillClass.SetUpAddSkillClass(cardSourceCondition: CardSourceCondition, getEffects: GetEffects);
+                    card.Owner.UntilOpponentTurnEndEffects.Add((_timing) => addSkillClass);
+
+                    bool CardSourceCondition(CardSource cardSource)
                     {
-                        if (PermanentCondition(permanent))
+                        if (PermanentCondition(cardSource.PermanentOfThisCard()))
                         {
-                            ActivateClass activateClass1 = new ActivateClass();
-                            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 (!permanent.TopCard.CanNotBeAffected(activateClass))
+                            if (cardSource == cardSource.PermanentOfThisCard().TopCard)
                             {
-                                yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
+                                return true;
                             }
+                        }
+
+                        return false;
+                    }
+
+                    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", CanUseCondition1, cardSource);
+                            activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDescription1());
+                            cardEffects.Add(activateClass1);
 
                             string EffectDescription1()
                             {
@@ -109,43 +120,60 @@ namespace DCGO.CardEffects.EX7
 
                             bool CanUseCondition1(Hashtable hashtable)
                             {
-                                return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
-                                    && permanent.TopCard.Owner.GetBattleAreaDigimons().Contains(permanent)
-                                    && GManager.instance.turnStateMachine.gameContext.TurnPlayer == permanent.TopCard.Owner
-                                    && !permanent.TopCard.CanNotBeAffected(activateClass);
+                                return CardEffectCommons.IsExistOnBattleAreaTrigger(cardSource, activateClass1)
+                                    && CardEffectCommons.IsOwnerTurn(cardSource)
+                                    && !cardSource.CanNotBeAffected(activateClass);
                             }
 
                             bool CanActivateCondition1(Hashtable hashtable)
                             {
-                                return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
-                                    && !permanent.TopCard.CanNotBeAffected(activateClass);
+                                return CardEffectCommons.IsExistOnBattleAreaActivate(cardSource, activateClass1)
+                                    && !cardSource.CanNotBeAffected(activateClass);
                             }
 
                             bool CanSelectPermanentCondition(Permanent permanent)
                             {
-                                return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
+                                return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, cardSource);
                             }
 
                             IEnumerator ActivateCoroutine1(Hashtable hashtable)
                             {
-                                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());
+                                if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
+                                {
+                                    SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
+
+                                    selectPermanentEffect.SetUp(
+                                        selectPlayer: cardSource.Owner,
+                                        canTargetCondition: CanSelectPermanentCondition,
+                                        canTargetCondition_ByPreSelecetedList: null,
+                                        canEndSelectCondition: null,
+                                        maxCount: 1,
+                                        canNoSelect: false,
+                                        canEndNotMax: false,
+                                        selectPermanentCoroutine: null,
+                                        afterSelectPermanentCoroutine: null,
+                                        mode: SelectPermanentEffect.Mode.Destroy,
+                                        cardEffect: activateClass1);
+
+                                    yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
+                                }
                             }
                         }
+
+                        if (_timing == EffectTiming.None)
+                        {
+                            cardEffects.Add(PermanentEffectFactory.AddDetailClass(cardSource.PermanentOfThisCard(), "[End of Your Turn] Delete 1 of your Digimon.", true, activateClass));
+                        }
+
+                        return cardEffects;
+                    }
+
+                    foreach (Permanent permanent in card.Owner.Enemy.GetBattleAreaDigimons())
+                    {
+                        if (!permanent.TopCard.CanNotBeAffected(activateClass))
+                        {
+                            yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
+                        }
                     }
                 }
             }