BT15_067.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_067 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  15. }
  16. if (timing == EffectTiming.None)
  17. {
  18. static bool PermanentCondition(Permanent targetPermanent)
  19. {
  20. if (targetPermanent.TopCard.CardTraits.Contains("DigiPolice") || targetPermanent.TopCard.HasXAntibodyTraits)
  21. {
  22. if (targetPermanent.TopCard.HasLevel)
  23. {
  24. if (targetPermanent.Level == 5)
  25. {
  26. return true;
  27. }
  28. }
  29. }
  30. return false;
  31. }
  32. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 4, ignoreDigivolutionRequirement: false, card: card, condition: null));
  33. }
  34. if (timing == EffectTiming.OnTappedAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Play 1 Digimon card with the [Beast Dragon] or [DigiPolice] trait with 5000DP or less from your hand.", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  39. activateClass.SetHashString("PlayDigimon_BT15_067");
  40. cardEffects.Add(activateClass);
  41. string EffectDiscription()
  42. {
  43. return "[All Turns][Once per turn] When this Digimon becomes suspended, you may play 1 Digimon card with the [Beast Dragon] or [DigiPolice] trait and 5000DP or less from your hand without paying the cost";
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => permanent == card.PermanentOfThisCard()))
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleArea(card))
  59. {
  60. if (card.Owner.HandCards.Count >= 1)
  61. {
  62. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  63. {
  64. return true;
  65. }
  66. }
  67. }
  68. return false;
  69. }
  70. bool CanSelectCardCondition(CardSource cardSource)
  71. {
  72. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  73. {
  74. if (cardSource.CardDP <= 5000)
  75. {
  76. if (cardSource.IsDigimon)
  77. {
  78. if (cardSource.HasBeastDragonTraits)
  79. {
  80. return true;
  81. }
  82. if (cardSource.HasDigiPoliceTraits)
  83. {
  84. return true;
  85. }
  86. }
  87. }
  88. }
  89. return false;
  90. }
  91. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  92. {
  93. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  94. {
  95. List<CardSource> selectedCards = new List<CardSource>();
  96. int maxCount = 1;
  97. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  98. selectHandEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: CanSelectCardCondition,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: maxCount,
  104. canNoSelect: true,
  105. canEndNotMax: false,
  106. isShowOpponent: true,
  107. selectCardCoroutine: SelectCardCoroutine,
  108. afterSelectCardCoroutine: null,
  109. mode: SelectHandEffect.Mode.Custom,
  110. cardEffect: activateClass);
  111. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  112. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  113. yield return StartCoroutine(selectHandEffect.Activate());
  114. IEnumerator SelectCardCoroutine(CardSource cardSource)
  115. {
  116. selectedCards.Add(cardSource);
  117. yield return null;
  118. }
  119. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  120. }
  121. }
  122. }
  123. if (timing == EffectTiming.OnEnterFieldAnyone)
  124. {
  125. ActivateClass activateClass = new ActivateClass();
  126. activateClass.SetUpICardEffect("Return 1 of your opponent's suspended Digimon or Tamers to the bottom of the deck.", CanUseCondition, card);
  127. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  128. cardEffects.Add(activateClass);
  129. string EffectDiscription()
  130. {
  131. return "[When Digivolving] If a Tamer card with the [DigiPolice] trait is in this Digimon's digivolution cards, return 1 of your opponent's suspended Digimon or Tamers to the bottom of the deck.";
  132. }
  133. bool CanUseCondition(Hashtable hashtable)
  134. {
  135. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  136. {
  137. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => (cardSource.CardTraits.Contains("DigiPolice") && cardSource.IsTamer)) >= 1)
  138. {
  139. return true;
  140. }
  141. }
  142. return false;
  143. }
  144. bool CanSelectPermanentCondition(Permanent permanent)
  145. {
  146. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  147. {
  148. if (permanent.IsSuspended)
  149. {
  150. return true;
  151. }
  152. }
  153. return false;
  154. }
  155. bool CanActivateCondition(Hashtable hashtable)
  156. {
  157. if (CardEffectCommons.IsExistOnBattleArea(card))
  158. {
  159. return true;
  160. }
  161. return false;
  162. }
  163. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  164. {
  165. if (card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  166. {
  167. int maxCount = Math.Min(1, card.Owner.Enemy.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  168. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  169. selectPermanentEffect.SetUp(
  170. selectPlayer: card.Owner,
  171. canTargetCondition: CanSelectPermanentCondition,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canEndSelectCondition: null,
  174. maxCount: maxCount,
  175. canNoSelect: false,
  176. canEndNotMax: false,
  177. selectPermanentCoroutine: null,
  178. afterSelectPermanentCoroutine: null,
  179. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  180. cardEffect: activateClass);
  181. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will return to the bottom of deck.", "The opponent is selecting 1 Digimon that will return to the bottom of deck.");
  182. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  183. }
  184. }
  185. }
  186. return cardEffects;
  187. }
  188. }
  189. }