BT18_092.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Zenith
  5. namespace DCGO.CardEffects.BT18
  6. {
  7. public class BT18_092 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Main
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Trash 1 card from hand to gain Memory +1 and Draw 1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  18. activateClass.SetIsSkippable(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDescription()
  21. {
  22. return "[Start of Your Main Phase] By trashing 1 [Vemmon] in your hand, <Draw 1> and gain 1 memory.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  27. && CardEffectCommons.IsOwnerTurn(card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  32. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  33. }
  34. bool CanSelectCardCondition(CardSource cardSource)
  35. {
  36. return cardSource.EqualsCardName("Vemmon");
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  39. {
  40. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  41. selectHandEffect.SetUp(
  42. selectPlayer: card.Owner,
  43. canTargetCondition: CanSelectCardCondition,
  44. canTargetCondition_ByPreSelecetedList: null,
  45. canEndSelectCondition: null,
  46. maxCount: 1,
  47. canNoSelect: true,
  48. canEndNotMax: false,
  49. isShowOpponent: true,
  50. selectCardCoroutine: null,
  51. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  52. mode: SelectHandEffect.Mode.Discard,
  53. cardEffect: activateClass);
  54. yield return StartCoroutine(selectHandEffect.Activate());
  55. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  56. {
  57. if (cardSources.Count >= 1)
  58. {
  59. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  60. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  61. }
  62. }
  63. }
  64. }
  65. #endregion
  66. #region Your Turn
  67. if (timing == EffectTiming.OnAllyAttack)
  68. {
  69. ActivateClass activateClass = new ActivateClass();
  70. activateClass.SetUpICardEffect("Return 2 [Vemmon] to <De-Digivolve - 1>", CanUseCondition, card);
  71. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  72. cardEffects.Add(activateClass);
  73. string EffectDescription()
  74. {
  75. return "[Your Turn] When any of your Digimon attacks, by suspending this Tamer and returning 2 [Vemmon] from that Digimon's digivolution cards to the bottom of the deck, <De-Digivolve - 1> 1 of your opponent's Digimon.";
  76. }
  77. bool CanUseCondition(Hashtable hashtable)
  78. {
  79. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  80. && CardEffectCommons.IsOwnerTurn(card)
  81. && CardEffectCommons.CanTriggerOnPermanentAttack(hashtable, PermanentCondition);
  82. }
  83. bool CanActivateCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  86. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  87. }
  88. bool PermanentCondition(Permanent permanent)
  89. {
  90. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  91. && permanent.DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("Vemmon")) >= 2;
  92. }
  93. bool CanSelectCardCondition(CardSource cardSource)
  94. {
  95. return cardSource.EqualsCardName("Vemmon");
  96. }
  97. bool CanSelectPermanentCondition(Permanent permanent)
  98. {
  99. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  100. }
  101. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  104. if (GManager.instance.attackProcess.AttackingPermanent != null
  105. && GManager.instance.attackProcess.AttackingPermanent.TopCard != null
  106. && GManager.instance.attackProcess.AttackingPermanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Vemmon")) >= 2
  107. && GManager.instance.attackProcess.AttackingPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 2)
  108. {
  109. List<CardSource> selectedCards = new List<CardSource>();
  110. bool returnedToLibrary = false;
  111. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  112. selectCardEffect.SetUp(
  113. canTargetCondition: CanSelectCardCondition,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. canNoSelect: () => true,
  117. selectCardCoroutine: SelectCardCoroutine,
  118. afterSelectCardCoroutine: null,
  119. message: "Select digivolution cards to return to the bottom of deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  120. maxCount: 2,
  121. canEndNotMax: false,
  122. isShowOpponent: true,
  123. mode: SelectCardEffect.Mode.Custom,
  124. root: SelectCardEffect.Root.Custom,
  125. customRootCardList: GManager.instance.attackProcess.AttackingPermanent.DigivolutionCards,
  126. canLookReverseCard: true,
  127. selectPlayer: card.Owner,
  128. cardEffect: null);
  129. selectCardEffect.SetUpCustomMessage("Select digivolution cards to return to the bottom of deck.", "The opponent is selecting digivolution cards to return to the bottom of deck.");
  130. selectCardEffect.SetNotShowCard();
  131. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  132. IEnumerator SelectCardCoroutine(CardSource cardSource)
  133. {
  134. selectedCards.Add(cardSource);
  135. yield return null;
  136. }
  137. if (selectedCards.Count >= 1)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(new ReturnToLibraryBottomDigivolutionCardsClass(
  140. GManager.instance.attackProcess.AttackingPermanent,
  141. selectedCards,
  142. CardEffectCommons.CardEffectHashtable(activateClass)).ReturnToLibraryBottomDigivolutionCards());
  143. if (selectedCards.Count == 2)
  144. {
  145. returnedToLibrary = true;
  146. }
  147. }
  148. if (returnedToLibrary)
  149. {
  150. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  151. {
  152. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  153. selectPermanentEffect.SetUp(
  154. selectPlayer: card.Owner,
  155. canTargetCondition: CanSelectPermanentCondition,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canEndSelectCondition: null,
  158. maxCount: 1,
  159. canNoSelect: false,
  160. canEndNotMax: false,
  161. selectPermanentCoroutine: SelectPermanentCoroutine,
  162. afterSelectPermanentCoroutine: null,
  163. mode: SelectPermanentEffect.Mode.Custom,
  164. cardEffect: activateClass);
  165. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  166. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  167. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  168. {
  169. Permanent selectedPermanent = permanent;
  170. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  171. }
  172. }
  173. }
  174. }
  175. }
  176. }
  177. #endregion
  178. #region Security Effect
  179. if (timing == EffectTiming.SecuritySkill)
  180. {
  181. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  182. }
  183. #endregion
  184. return cardEffects;
  185. }
  186. }
  187. }