EX2_070.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_070 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  14. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  15. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  16. cardEffects.Add(ignoreColorConditionClass);
  17. bool CanUseCondition(Hashtable hashtable)
  18. {
  19. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  20. {
  21. return true;
  22. }
  23. return false;
  24. }
  25. bool CardCondition(CardSource cardSource)
  26. {
  27. if (cardSource == card)
  28. {
  29. return true;
  30. }
  31. return false;
  32. }
  33. }
  34. if (timing == EffectTiming.OptionSkill)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  38. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  39. cardEffects.Add(activateClass);
  40. string EffectDiscription()
  41. {
  42. return "[Main] <Draw 1>. (Draw 1 card from your deck.) Then, you may digivolve 1 of your Digimon into a Digimon card in your hand that can digivolve for a digivolution cost of 3 or less without paying its digivolution cost.";
  43. }
  44. bool CanSelectPermanentCondition(Permanent permanent)
  45. {
  46. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  47. {
  48. foreach (CardSource cardSource in card.Owner.HandCards)
  49. {
  50. if (CanSelectCardCondition(cardSource, permanent))
  51. {
  52. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  53. {
  54. return true;
  55. }
  56. }
  57. }
  58. }
  59. return false;
  60. }
  61. bool CanSelectCardCondition(CardSource cardSource, Permanent permanent)
  62. {
  63. return cardSource.IsDigimon && cardSource.PayingCost(SelectCardEffect.Root.Hand, new List<Permanent>() { permanent }, checkAvailability: false) <= 3;
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  73. {
  74. Permanent selectedPermanent = null;
  75. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  76. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  77. selectPermanentEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectPermanentCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: maxCount,
  83. canNoSelect: true,
  84. canEndNotMax: false,
  85. selectPermanentCoroutine: SelectPermanentCoroutine,
  86. afterSelectPermanentCoroutine: null,
  87. mode: SelectPermanentEffect.Mode.Custom,
  88. cardEffect: activateClass);
  89. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve.", "The opponent is selecting 1 Digimon to digivolve.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  92. {
  93. selectedPermanent = permanent;
  94. yield return null;
  95. }
  96. if (selectedPermanent != null)
  97. {
  98. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  99. targetPermanent: selectedPermanent,
  100. cardCondition: (cardSource) => CanSelectCardCondition(cardSource, selectedPermanent),
  101. payCost: false,
  102. reduceCostTuple: null,
  103. fixedCostTuple: null,
  104. ignoreDigivolutionRequirementFixedCost: -1,
  105. isHand: true,
  106. activateClass: activateClass,
  107. successProcess: null));
  108. }
  109. }
  110. }
  111. }
  112. if (timing == EffectTiming.SecuritySkill)
  113. {
  114. ActivateClass activateClass = new ActivateClass();
  115. activateClass.SetUpICardEffect($"Reveal the top 3 cards of deck and add this card to hand", CanUseCondition, card);
  116. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  117. activateClass.SetIsSecurityEffect(true);
  118. cardEffects.Add(activateClass);
  119. string EffectDiscription()
  120. {
  121. return "[Security] Reveal the top 3 cards of your deck. Add 1 Digimon card among them to your hand. Place the remaining cards at the bottom of your deck in any order. Then, add this card to your hand.";
  122. }
  123. bool CanSelectCardCondition(CardSource cardSource)
  124. {
  125. return cardSource.IsDigimon;
  126. }
  127. bool CanUseCondition(Hashtable hashtable)
  128. {
  129. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  132. {
  133. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  134. revealCount: 3,
  135. simplifiedSelectCardConditions:
  136. new SimplifiedSelectCardConditionClass[]
  137. {
  138. new SimplifiedSelectCardConditionClass(
  139. canTargetCondition:CanSelectCardCondition,
  140. message: "Select 1 Digimon card.",
  141. mode: SelectCardEffect.Mode.AddHand,
  142. maxCount: 1,
  143. selectCardCoroutine: null),
  144. },
  145. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  146. activateClass: activateClass
  147. ));
  148. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  149. }
  150. }
  151. return cardEffects;
  152. }
  153. }
  154. }