EX7_034.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_034 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Vortex
  11. if (timing == EffectTiming.OnEndTurn)
  12. {
  13. cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card,
  14. condition: null));
  15. }
  16. #endregion
  17. #region When Digivolving
  18. if (timing == EffectTiming.OnEnterFieldAnyone)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  23. cardEffects.Add(activateClass);
  24. string EffectDescription()
  25. {
  26. return
  27. "[When Digivolving] You may suspend 1 Digimon. If this effect suspended your Digimon, this Digimon isn't affected by the effect of your opponent's Digimon's until the end of their turn.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  32. }
  33. bool CanSelectPermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent) &&
  36. permanent.IsDigimon;
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  45. {
  46. Permanent selectedPermanent = null;
  47. bool ownDigimon = false;
  48. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  49. selectPermanentEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: CanSelectPermanentCondition,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: 1,
  55. canNoSelect: true,
  56. canEndNotMax: false,
  57. selectPermanentCoroutine: SelectPermanentCoroutine,
  58. afterSelectPermanentCoroutine: null,
  59. mode: SelectPermanentEffect.Mode.Custom,
  60. cardEffect: activateClass);
  61. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  62. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  63. {
  64. selectedPermanent = permanent;
  65. yield return null;
  66. }
  67. if (selectedPermanent != null &&
  68. selectedPermanent.TopCard &&
  69. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  70. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(
  73. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  74. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  75. ownDigimon = selectedPermanent.IsSuspended &&
  76. CardEffectCommons.IsOwnerPermanent(selectedPermanent, card);
  77. }
  78. if (ownDigimon)
  79. {
  80. Permanent permanentOfThisCard = card.PermanentOfThisCard();
  81. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  82. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effects",
  83. CanUseConditionImmunity, card);
  84. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition,
  85. SkillCondition: SkillCondition);
  86. permanentOfThisCard.UntilOpponentTurnEndEffects.Add(GetCardEffect);
  87. bool CanUseConditionImmunity(Hashtable hashtableImmunity)
  88. {
  89. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanentOfThisCard, card);
  90. }
  91. bool CardCondition(CardSource cardSource)
  92. {
  93. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanentOfThisCard) &&
  94. cardSource == permanentOfThisCard.TopCard;
  95. }
  96. bool SkillCondition(ICardEffect cardEffect)
  97. {
  98. return CardEffectCommons.IsOpponentEffect(cardEffect, card) &&
  99. cardEffect.IsDigimonEffect;
  100. }
  101. ICardEffect GetCardEffect(EffectTiming timingImmunity)
  102. {
  103. return timingImmunity == EffectTiming.None ? canNotAffectedClass : null;
  104. }
  105. }
  106. }
  107. }
  108. }
  109. #endregion
  110. #region Your Turn - ESS
  111. if (timing == EffectTiming.OnAllyAttack)
  112. {
  113. ActivateClass activateClass = new ActivateClass();
  114. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  115. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  116. activateClass.SetIsInheritedEffect(true);
  117. activateClass.SetHashString("Unsuspend_EX7_034");
  118. cardEffects.Add(activateClass);
  119. string EffectDescription()
  120. {
  121. return "[Your Turn] (Once Per Turn) When this Digimon attacks your opponent's Digimon, you may unsuspend this Digimon.";
  122. }
  123. bool CanUseCondition(Hashtable hashtable)
  124. {
  125. return CardEffectCommons.CanTriggerOnAttack(hashtable, card) &&
  126. CardEffectCommons.IsOwnerTurn(card) &&
  127. CardEffectCommons.IsPermanentExistsOnBattleArea(GManager.instance.attackProcess.DefendingPermanent);
  128. }
  129. bool CanActivateCondition(Hashtable hashtable)
  130. {
  131. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  132. }
  133. IEnumerator ActivateCoroutine(Hashtable hashtable)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(
  136. new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  137. }
  138. }
  139. #endregion
  140. return cardEffects;
  141. }
  142. }
  143. }