BT11_065.cs 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_065 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Place [Vemmon] from trash to digivolution cards and return 1 [Fusionize] from trash to hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[When Digivolving] You may place up to 2 [Vemmon] from your trash under this Digimon as its bottom digivolution cards. Then, if there are 4 or more [Vemmon] in this Digimon's digivolution cards, return 1 [Fusionize] from your trash to your hand.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. return cardSource.CardNames.Contains("Vemmon");
  25. }
  26. bool CanSelectCardCondition1(CardSource cardSource)
  27. {
  28. return cardSource.CardNames.Contains("Fusionize");
  29. }
  30. bool CanUseCondition(Hashtable hashtable)
  31. {
  32. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. return true;
  39. }
  40. return false;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  47. {
  48. List<CardSource> selectedCards = new List<CardSource>();
  49. int maxCount = Math.Min(2, card.Owner.TrashCards.Count(CanSelectCardCondition));
  50. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  51. selectCardEffect.SetUp(
  52. canTargetCondition: CanSelectCardCondition,
  53. canTargetCondition_ByPreSelecetedList: null,
  54. canEndSelectCondition: null,
  55. canNoSelect: () => true,
  56. selectCardCoroutine: SelectCardCoroutine,
  57. afterSelectCardCoroutine: null,
  58. message: "Select [Vemmon] to place on bottom of digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  59. maxCount: maxCount,
  60. canEndNotMax: true,
  61. isShowOpponent: true,
  62. mode: SelectCardEffect.Mode.Custom,
  63. root: SelectCardEffect.Root.Trash,
  64. customRootCardList: null,
  65. canLookReverseCard: true,
  66. selectPlayer: card.Owner,
  67. cardEffect: activateClass);
  68. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards");
  69. selectCardEffect.SetUpCustomMessage("Select cards to place on bottom of digivolution cards.", "The opponent is selecting cards to place on bottom of digivolution cards.");
  70. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  71. IEnumerator SelectCardCoroutine(CardSource cardSource)
  72. {
  73. selectedCards.Add(cardSource);
  74. yield return null;
  75. }
  76. if (selectedCards.Count >= 1)
  77. {
  78. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  79. }
  80. }
  81. }
  82. if (CardEffectCommons.IsExistOnBattleArea(card))
  83. {
  84. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Vemmon")) >= 4)
  85. {
  86. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition1))
  87. {
  88. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition1));
  89. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  90. selectCardEffect.SetUp(
  91. canTargetCondition: CanSelectCardCondition1,
  92. canTargetCondition_ByPreSelecetedList: null,
  93. canEndSelectCondition: null,
  94. canNoSelect: () => false,
  95. selectCardCoroutine: null,
  96. afterSelectCardCoroutine: null,
  97. message: "Select 1 card to add to your hand.",
  98. maxCount: maxCount,
  99. canEndNotMax: false,
  100. isShowOpponent: true,
  101. mode: SelectCardEffect.Mode.AddHand,
  102. root: SelectCardEffect.Root.Trash,
  103. customRootCardList: null,
  104. canLookReverseCard: true,
  105. selectPlayer: card.Owner,
  106. cardEffect: activateClass);
  107. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  108. }
  109. }
  110. }
  111. }
  112. }
  113. if (timing == EffectTiming.OnDigivolutionCardReturnToDeckBottom)
  114. {
  115. ActivateClass activateClass = new ActivateClass();
  116. activateClass.SetUpICardEffect("Unsuspend this Digimon and it gain Blocker", CanUseCondition, card);
  117. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  118. activateClass.SetIsInheritedEffect(true);
  119. activateClass.SetHashString("Unsuspend_BT11_065");
  120. cardEffects.Add(activateClass);
  121. string EffectDiscription()
  122. {
  123. return "[All Turns][Once Per Turn] When [Vemmon] is placed from this Digimon's digivolution cards at the bottom of its owner's deck, unsuspend this Digimon, and it gains <Blocker> until the end of your opponent's turn.";
  124. }
  125. bool CanUseCondition(Hashtable hashtable)
  126. {
  127. return CardEffectCommons.CanTriggerOnReturnToLibraryBottomDigivolutionCard(hashtable, cardSource => cardSource.CardNames.Contains("Vemmon"), card);
  128. }
  129. bool CanActivateCondition(Hashtable hashtable)
  130. {
  131. if (CardEffectCommons.IsExistOnBattleArea(card))
  132. {
  133. return true;
  134. }
  135. return false;
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  138. {
  139. Permanent selectedPermanent = card.PermanentOfThisCard();
  140. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  141. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  142. }
  143. }
  144. return cardEffects;
  145. }
  146. }
  147. }