EX10_013.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Lucemon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_013 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution Requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Cupimon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Blocker
  23. if (timing == EffectTiming.None)
  24. {
  25. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region When Digivolving
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("Move digimon to battle area", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[Breeding] [When Digivolving] This Digimon may move.";
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBreedingAreaDigimon(card)
  42. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBreedingAreaDigimon(card)
  47. && card.PermanentOfThisCard().CanMove;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. if (card.Owner.CanMove)
  52. {
  53. yield return ContinuousController.instance.StartCoroutine(CardObjectController.MovePermanent(card.Owner.GetBreedingAreaPermanents()[0].PermanentFrame));
  54. }
  55. }
  56. }
  57. #endregion
  58. #region End of your turn
  59. if (timing == EffectTiming.OnEndTurn)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect("By returning 5 [lucemon] in text cards from trash to bottom of deck, digivolve into [Lucemon: Chaos Mode] in trash", CanUseCondition, card);
  63. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  64. cardEffects.Add(activateClass);
  65. string EffectDiscription()
  66. {
  67. return "[End of Your Turn] By returning 5 cards with [Lucemon] in their texts from your trash to the bottom of the deck, this Digimon may digivolve into [Lucemon: Chaos Mode] in the trash without paying the cost.";
  68. }
  69. bool CanUseCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  72. }
  73. bool CanActivateCondition(Hashtable hashtable)
  74. {
  75. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  76. && CardEffectCommons.IsOwnerTurn(card)
  77. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsLucemon)
  78. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsChaosMode);
  79. }
  80. bool IsLucemon(CardSource cardSource)
  81. {
  82. return cardSource.HasText("Lucemon");
  83. }
  84. bool IsChaosMode(CardSource cardSource)
  85. {
  86. return cardSource.EqualsCardName("Lucemon: Chaos Mode")
  87. && cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass);
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable hashtable)
  90. {
  91. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsLucemon))
  92. {
  93. List<CardSource> selectedCards = new List<CardSource>();
  94. #region Select 5 [Lucemon] in text cards from trash to bottom of deck
  95. int maxCount = Math.Min(5, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, IsLucemon));
  96. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  97. selectCardEffect.SetUp(
  98. canTargetCondition: IsLucemon,
  99. canTargetCondition_ByPreSelecetedList: null,
  100. canEndSelectCondition: null,
  101. canNoSelect: () => true,
  102. selectCardCoroutine: SelectCardCoroutine,
  103. afterSelectCardCoroutine: null,
  104. message: "Select 5 [Lucemon] in text cards to bottom deck",
  105. maxCount: maxCount,
  106. canEndNotMax: false,
  107. isShowOpponent: true,
  108. mode: SelectCardEffect.Mode.Custom,
  109. root: SelectCardEffect.Root.Trash,
  110. customRootCardList: null,
  111. canLookReverseCard: true,
  112. selectPlayer: card.Owner,
  113. cardEffect: activateClass);
  114. IEnumerator SelectCardCoroutine(CardSource cardSource)
  115. {
  116. selectedCards.Add(cardSource);
  117. yield return null;
  118. }
  119. selectCardEffect.SetUpCustomMessage("Select 5 [Lucemon] in text cards to bottom deck", "Your opponent is selecting 5 [Lucemon] in text cards to bottom deck");
  120. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Cards");
  121. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  122. #endregion
  123. if (selectedCards.Count == 5)
  124. {
  125. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ReturnRevealedCardsToLibraryBottom(
  126. remainingCards: selectedCards,
  127. activateClass: activateClass));
  128. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, IsChaosMode)) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  129. targetPermanent: card.PermanentOfThisCard(),
  130. cardCondition: IsChaosMode,
  131. payCost: false,
  132. reduceCostTuple: null,
  133. fixedCostTuple: null,
  134. ignoreDigivolutionRequirementFixedCost: -1,
  135. isHand: false,
  136. activateClass: activateClass,
  137. successProcess: null));
  138. }
  139. }
  140. }
  141. }
  142. #endregion
  143. #region ESS
  144. if (timing == EffectTiming.None)
  145. {
  146. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  147. }
  148. #endregion
  149. return cardEffects;
  150. }
  151. }
  152. }