BT24_064.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. // Ouryumon
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_064 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alt Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5
  18. && (targetPermanent.TopCard.HasDigiPoliceTraits
  19. || targetPermanent.TopCard.HasSeekersTraits);
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. #endregion
  24. #region Piercing
  25. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  26. {
  27. cardEffects.Add(CardEffectFactory.PierceSelfEffect(false, card, null));
  28. }
  29. #endregion
  30. #region Blocker
  31. if (timing == EffectTiming.None)
  32. {
  33. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(false, card, null));
  34. }
  35. #endregion
  36. #region When Digivolving
  37. if (timing == EffectTiming.OnEnterFieldAnyone)
  38. {
  39. ActivateClass activateClass = new ActivateClass();
  40. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck, play 1", CanUseCondition, card);
  41. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. {
  45. return "[When Digivolving] Reveal the top 3 cards of your deck. You may play 1 play cost 7 or lower [Digi] or [SEEKERS] trait card among them without paying the cost. Return the rest to the top or bottom of the deck.";
  46. }
  47. bool CanSelectCardCondition(CardSource cardSource)
  48. {
  49. return cardSource.HasPlayCost
  50. && cardSource.GetCostItself <= 7
  51. && (cardSource.HasDigiPoliceTraits
  52. || cardSource.HasSeekersTraits)
  53. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.IsExistOnBattleArea(card)
  58. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  59. }
  60. bool CanActivateCondition(Hashtable hashtable)
  61. {
  62. return CardEffectCommons.IsExistOnBattleArea(card)
  63. && card.Owner.LibraryCards.Count >= 1;
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  66. {
  67. CardSource selectedCard = null;
  68. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  69. revealCount: 3,
  70. simplifiedSelectCardConditions:
  71. new SimplifiedSelectCardConditionClass[]
  72. {
  73. new SimplifiedSelectCardConditionClass(
  74. canTargetCondition:CanSelectCardCondition,
  75. message: "Select 1 Digimon card to Play.",
  76. mode: SelectCardEffect.Mode.Custom,
  77. maxCount: 1,
  78. selectCardCoroutine: SelectCardCoroutine),
  79. },
  80. remainingCardsPlace: RemainingCardsPlace.DeckTopOrBottom,
  81. activateClass: activateClass,
  82. canNoSelect: true
  83. ));
  84. IEnumerator SelectCardCoroutine(CardSource cardSource)
  85. {
  86. selectedCard = cardSource;
  87. yield return null;
  88. }
  89. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  90. new List<CardSource>() { selectedCard },
  91. activateClass: activateClass,
  92. payCost: false,
  93. isTapped: false,
  94. root: SelectCardEffect.Root.Library,
  95. activateETB: true));
  96. }
  97. }
  98. #endregion
  99. #region All Turns OPT
  100. if (timing == EffectTiming.OnTappedAnyone)
  101. {
  102. ActivateClass activateClass = new ActivateClass();
  103. activateClass.SetUpICardEffect("De-Digivolve 2", CanUseCondition, card);
  104. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  105. activateClass.SetHashString("BT24_064_DeDigivolve");
  106. cardEffects.Add(activateClass);
  107. string EffectDiscription()
  108. {
  109. return "[All Turns] [Once Per Turn] When any Digimon or Tamers suspend, <De-Digivolve 2> 1 of your opponent's Digimon.";
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  114. && CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition);
  115. }
  116. bool CanActivateCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  119. }
  120. bool PermanentCondition(Permanent permanent)
  121. {
  122. return CardEffectCommons.IsPermanentExistsOnBattleArea(permanent)
  123. && (permanent.IsTamer || permanent.IsDigimon);
  124. }
  125. bool IsOpponentDigimon(Permanent permanent)
  126. {
  127. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable hashtable)
  130. {
  131. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentDigimon))
  132. {
  133. Permanent selectedPermanent = null;
  134. #region Select Permanent
  135. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, IsOpponentDigimon));
  136. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  137. selectPermanentEffect.SetUp(
  138. selectPlayer: card.Owner,
  139. canTargetCondition: IsOpponentDigimon,
  140. canTargetCondition_ByPreSelecetedList: null,
  141. canEndSelectCondition: null,
  142. maxCount: maxCount,
  143. canNoSelect: false,
  144. canEndNotMax: false,
  145. selectPermanentCoroutine: SelectPermanentCoroutine,
  146. afterSelectPermanentCoroutine: null,
  147. mode: SelectPermanentEffect.Mode.Custom,
  148. cardEffect: activateClass);
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. selectedPermanent = permanent;
  152. yield return null;
  153. }
  154. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to De-Digivolve", "The opponent is selecting 1 Digimon to De-Digivolve");
  155. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  156. #endregion
  157. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(
  158. new IDegeneration(selectedPermanent, 2, activateClass).Degeneration());
  159. }
  160. }
  161. }
  162. #endregion
  163. return cardEffects;
  164. }
  165. }
  166. }