EX9_023.cs 7.4 KB

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