EX9_014.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Gabumon
  5. namespace DCGO.CardEffects.EX9
  6. {
  7. public class EX9_014 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. if (targetPermanent.TopCard.IsLevel2)
  18. {
  19. if (targetPermanent.TopCard.EqualsTraits("DM"))
  20. {
  21. return true;
  22. }
  23. }
  24. return false;
  25. }
  26. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  27. permanentCondition: PermanentCondition,
  28. digivolutionCost: 0,
  29. ignoreDigivolutionRequirement: false,
  30. card: card,
  31. condition: null)
  32. );
  33. }
  34. #endregion
  35. #region On Play
  36. if (timing == EffectTiming.OnEnterFieldAnyone)
  37. {
  38. ActivateClass activateClass = new ActivateClass();
  39. activateClass.SetUpICardEffect("Reveal 3, Add 1 [DM] trait, and place 1 [Ver.2] trait under a [DM] digimon", CanUseCondition, card);
  40. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  41. cardEffects.Add(activateClass);
  42. string EffectDiscription()
  43. => "[On Play] Reveal the top 3 cards of your deck. Among them, add 1 card with the [DM] trait to the hand and place 1 card with the [Ver.2] trait face down as the bottom digivolution card of any of your Digimon with the [DM] trait . Return the rest to the bottom of the deck.";
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  47. {
  48. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  49. {
  50. return true;
  51. }
  52. }
  53. return false;
  54. }
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  58. {
  59. if (card.Owner.LibraryCards.Count > 0)
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. bool HadDMTrait(CardSource source)
  67. {
  68. return source.EqualsTraits("DM");
  69. }
  70. bool HasVer2Trait(CardSource source)
  71. {
  72. return source.EqualsTraits("Ver.2");
  73. }
  74. bool CanSelectPermanentCondition(Permanent permanent)
  75. {
  76. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  77. {
  78. if (permanent.TopCard.EqualsTraits("DM"))
  79. {
  80. return true;
  81. }
  82. }
  83. return false;
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable hashtable)
  86. {
  87. CardSource selectedCard = null;
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  89. revealCount: 3,
  90. simplifiedSelectCardConditions:
  91. new SimplifiedSelectCardConditionClass[]
  92. {
  93. new SimplifiedSelectCardConditionClass(
  94. canTargetCondition:HadDMTrait,
  95. message: "Select 1 [DM] card.",
  96. mode: SelectCardEffect.Mode.AddHand,
  97. maxCount: 1,
  98. selectCardCoroutine: null),
  99. new SimplifiedSelectCardConditionClass(
  100. canTargetCondition:HasVer2Trait,
  101. message: "Select 1 [Ver.2] card.",
  102. mode: SelectCardEffect.Mode.Custom,
  103. maxCount: 1,
  104. selectCardCoroutine: SelectCardCoroutine),
  105. },
  106. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  107. activateClass: activateClass
  108. ));
  109. IEnumerator SelectCardCoroutine(CardSource cardSource)
  110. {
  111. selectedCard = cardSource;
  112. yield return null;
  113. }
  114. if (selectedCard != null && CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  115. {
  116. Permanent selectedPermanent = null;
  117. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  118. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  119. selectPermanentEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: CanSelectPermanentCondition,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: maxCount,
  125. canNoSelect: false,
  126. canEndNotMax: false,
  127. selectPermanentCoroutine: SelectPermanentCoroutine,
  128. afterSelectPermanentCoroutine: null,
  129. mode: SelectPermanentEffect.Mode.Custom,
  130. cardEffect: activateClass);
  131. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  132. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  133. {
  134. selectedPermanent = permanent;
  135. yield return null;
  136. }
  137. if (selectedPermanent != null)
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddExecutingCard(selectedCard));
  140. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass, isFacedown: true));
  141. }
  142. }
  143. }
  144. }
  145. #endregion
  146. #region ESS
  147. if (timing == EffectTiming.None)
  148. {
  149. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: true, card: card, condition: null));
  150. }
  151. #endregion
  152. return cardEffects;
  153. }
  154. }
  155. }