EX10_063.cs 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //Close
  4. namespace DCGO.CardEffects.EX10
  5. {
  6. public class EX10_063 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Your Main Phase
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("By returning this card, Play [Close], Then 1 [Sunarizamon]", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Start of Your Main Phase] By returning this Tamer to the bottom of the deck, you may play 1 [Close] from your hand without paying the cost. Then, if you don't have a Digimon, you may play 1 [Sunarizamon] from your trash without paying the cost.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.IsExistOnField(card) &&
  25. CardEffectCommons.IsOwnerTurn(card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.IsExistOnField(card);
  30. }
  31. bool IsClose(CardSource source)
  32. {
  33. return source.EqualsCardName("Close") &&
  34. CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass);
  35. }
  36. bool IsSunarizamon(CardSource source)
  37. {
  38. return source.EqualsCardName("Sunarizamon") &&
  39. CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass, SelectCardEffect.Root.Trash);
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable hashtable)
  42. {
  43. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeckBouncePeremanentAndProcessAccordingToResult(
  44. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  45. activateClass: activateClass,
  46. successProcess: SuccessProcess(),
  47. failureProcess: null));
  48. IEnumerator SuccessProcess()
  49. {
  50. if (CardEffectCommons.HasMatchConditionOwnersHand(card, IsClose))
  51. {
  52. List<CardSource> selectedTamerCards = new List<CardSource>();
  53. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  54. selectHandEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: IsClose,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: 1,
  60. canNoSelect: true,
  61. canEndNotMax: false,
  62. isShowOpponent: true,
  63. selectCardCoroutine: SelectCardCoroutine,
  64. afterSelectCardCoroutine: null,
  65. mode: SelectHandEffect.Mode.Custom,
  66. cardEffect: activateClass);
  67. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  68. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  69. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  70. IEnumerator SelectCardCoroutine(CardSource cardSource)
  71. {
  72. selectedTamerCards.Add(cardSource);
  73. yield return null;
  74. }
  75. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedTamerCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  76. }
  77. if (card.Owner.GetBattleAreaDigimons().Count == 0)
  78. {
  79. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsSunarizamon))
  80. {
  81. List<CardSource> selectedDigimonCards = new List<CardSource>();
  82. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  83. selectCardEffect.SetUp(
  84. canTargetCondition: IsSunarizamon,
  85. canTargetCondition_ByPreSelecetedList: null,
  86. canEndSelectCondition: null,
  87. canNoSelect: () => true,
  88. selectCardCoroutine: SelectCardCoroutine,
  89. afterSelectCardCoroutine: null,
  90. message: "Select 1 Digimon card.",
  91. maxCount: 1,
  92. canEndNotMax: false,
  93. isShowOpponent: true,
  94. mode: SelectCardEffect.Mode.Custom,
  95. root: SelectCardEffect.Root.Trash,
  96. customRootCardList: null,
  97. canLookReverseCard: true,
  98. selectPlayer: card.Owner,
  99. cardEffect: activateClass);
  100. selectCardEffect.SetUpCustomMessage("Select 1 Digimon to play.", "The opponent is selecting 1 Digimon to play.");
  101. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  102. IEnumerator SelectCardCoroutine(CardSource cardSource)
  103. {
  104. selectedDigimonCards.Add(cardSource);
  105. yield return null;
  106. }
  107. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedDigimonCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  108. }
  109. }
  110. }
  111. }
  112. }
  113. #endregion
  114. #region Your Turn
  115. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect("Suspend to +1 Memory", CanUseCondition, card);
  119. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  120. cardEffects.Add(activateClass);
  121. string EffectDiscription()
  122. {
  123. return "[All Turns] When effects trash any of your [Mineral] or [Rock] trait Digimon's digivolution cards, by suspending this Tamer, gain 1 memory.";
  124. }
  125. bool HasProperTraits(CardSource source)
  126. {
  127. return source.EqualsTraits("Mineral") || source.EqualsTraits("Rock");
  128. }
  129. bool PermanentCondition(Permanent permanent)
  130. {
  131. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  132. return HasProperTraits(permanent.TopCard);
  133. return false;
  134. }
  135. bool CanUseCondition(Hashtable hashtable)
  136. {
  137. if (CardEffectCommons.IsExistOnBattleArea(card))
  138. {
  139. if (CardEffectCommons.CanTriggerOnTrashDigivolutionCard(hashtable, PermanentCondition, effect => effect != null, source => source != null))
  140. {
  141. return true;
  142. }
  143. }
  144. return false;
  145. }
  146. bool CanActivateCondition(Hashtable hashtable)
  147. {
  148. if (CardEffectCommons.IsExistOnBattleArea(card))
  149. {
  150. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  151. {
  152. return true;
  153. }
  154. }
  155. return false;
  156. }
  157. IEnumerator ActivateCoroutine(Hashtable hashtable)
  158. {
  159. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  160. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  161. }
  162. }
  163. #endregion
  164. #region Security Effect
  165. if (timing == EffectTiming.SecuritySkill)
  166. {
  167. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  168. }
  169. #endregion
  170. return cardEffects;
  171. }
  172. }
  173. }