EX7_019.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Sorcermon
  6. namespace DCGO.CardEffects.EX7
  7. {
  8. public class EX7_019 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Blocker
  14. if (timing == EffectTiming.None)
  15. {
  16. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  17. }
  18. #endregion
  19. #region On Play
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Unsuspend your digimon", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[On Play] If your opponent has no Digimon with digivolution cards, unsuspend 1 of your Digimon.";
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  33. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  34. return false;
  35. }
  36. bool CanSelectDigimonCondition(Permanent permanent)
  37. {
  38. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  43. {
  44. if (!CardEffectCommons.HasMatchConditionOpponentsPermanent(card,(permanent) => permanent.IsDigimon && !permanent.HasNoDigivolutionCards))
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimonCondition))
  54. {
  55. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimonCondition));
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectDigimonCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: null,
  62. maxCount: maxCount,
  63. canNoSelect: false,
  64. canEndNotMax: false,
  65. selectPermanentCoroutine: null,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.UnTap,
  68. cardEffect: activateClass);
  69. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will unsuspend", "The opponent is selecting 1 Digimon to unsuspend.");
  70. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  71. }
  72. }
  73. }
  74. #endregion
  75. #region When Attacking
  76. if (timing == EffectTiming.OnAllyAttack)
  77. {
  78. ActivateClass activateClass = new ActivateClass();
  79. activateClass.SetUpICardEffect("Trash digivolution cards", CanUseCondition, card);
  80. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  81. activateClass.SetIsInheritedEffect(true);
  82. activateClass.SetHashString("Unsuspend_EX7_019");
  83. cardEffects.Add(activateClass);
  84. string EffectDiscription()
  85. {
  86. return "[When Attacking] Trash 1 digivolution card at the top of 1 of your opponent's Digimon.";
  87. }
  88. bool CanSelectDigimonCondition(Permanent permanent)
  89. {
  90. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  91. {
  92. return true;
  93. }
  94. return false;
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  99. }
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectDigimonCondition))
  107. {
  108. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectDigimonCondition));
  109. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  110. selectPermanentEffect.SetUp(
  111. selectPlayer: card.Owner,
  112. canTargetCondition: CanSelectDigimonCondition,
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canEndSelectCondition: null,
  115. maxCount: maxCount,
  116. canNoSelect: false,
  117. canEndNotMax: false,
  118. selectPermanentCoroutine: SelectPermanentCoroutine,
  119. afterSelectPermanentCoroutine: null,
  120. mode: SelectPermanentEffect.Mode.Custom,
  121. cardEffect: activateClass);
  122. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  123. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  124. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  125. {
  126. Permanent selectedPermanent = permanent;
  127. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 1, isFromTop: true, activateClass: activateClass));
  128. }
  129. }
  130. }
  131. }
  132. #endregion
  133. return cardEffects;
  134. }
  135. }
  136. }