BT21_025.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. // Lamiamon
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_025 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Progress
  13. if (timing == EffectTiming.None)
  14. {
  15. cardEffects.Add(CardEffectFactory.ProgressSelfStaticEffect(false, card, null));
  16. }
  17. #endregion
  18. #region Your Turn
  19. if (timing == EffectTiming.OnAttackTargetChanged)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("trash top security", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  24. activateClass.SetHashString("YT_BT21-025");
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. => "[Your Turn] [Once Per Turn] When any of your [Reptile]/[Dragonkin] trait Digimon's attack targets change, trash your opponent's top security card.";
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  31. {
  32. if (CardEffectCommons.CanTriggerOnPermanentAttackTargetSwitch(hashtable, PermanentCondition))
  33. {
  34. if (CardEffectCommons.IsOwnerTurn(card))
  35. {
  36. return true;
  37. }
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  45. {
  46. return true;
  47. }
  48. return false;
  49. }
  50. bool PermanentCondition(Permanent permanent)
  51. {
  52. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  53. {
  54. if (permanent.TopCard.EqualsTraits("Reptile") || permanent.TopCard.EqualsTraits("Dragonkin"))
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  64. player: card.Owner.Enemy,
  65. destroySecurityCount: 1,
  66. cardEffect: activateClass,
  67. fromTop: true).DestroySecurity());
  68. }
  69. }
  70. #endregion
  71. #region All Turns (ESS)
  72. if (timing == EffectTiming.OnLoseSecurity)
  73. {
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect("Play 1 [Reptile] or [Dragonkin] from hand", CanUseCondition, card);
  76. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  77. activateClass.SetIsInheritedEffect(true);
  78. activateClass.SetHashString("PlayDigimon_BT21_025");
  79. cardEffects.Add(activateClass);
  80. string EffectDiscription()
  81. => "[All Turns] [Once Per Turn] When your opponent's security is removed from, you may play 1 [Reptile]/[Dragonkin] trait Digimon card with 5000 DP or less from your hand without paying the cost.";
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  85. {
  86. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, PlayerCondition))
  87. {
  88. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  89. {
  90. return true;
  91. }
  92. }
  93. }
  94. return false;
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  99. {
  100. return true;
  101. }
  102. return false;
  103. }
  104. bool PlayerCondition(Player player)
  105. {
  106. if (player == card.Owner.Enemy)
  107. {
  108. return true;
  109. }
  110. return false;
  111. }
  112. bool CanSelectCardCondition(CardSource source)
  113. {
  114. if (source.IsDigimon)
  115. {
  116. if (source.EqualsTraits("Reptile") || source.EqualsTraits("Dragonkin"))
  117. {
  118. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: source, payCost: false, cardEffect: activateClass))
  119. {
  120. if (source.CardDP <= 5000)
  121. {
  122. return true;
  123. }
  124. }
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable hashtable)
  130. {
  131. CardSource selectedCard = null;
  132. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  133. selectHandEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectCardCondition,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: 1,
  139. canNoSelect: true,
  140. canEndNotMax: false,
  141. isShowOpponent: true,
  142. selectCardCoroutine: SelectCardCoroutine,
  143. afterSelectCardCoroutine: null,
  144. mode: SelectHandEffect.Mode.Custom,
  145. cardEffect: activateClass);
  146. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  147. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  148. yield return StartCoroutine(selectHandEffect.Activate());
  149. IEnumerator SelectCardCoroutine(CardSource cardSource)
  150. {
  151. selectedCard = cardSource;
  152. yield return null;
  153. }
  154. if (selectedCard != null)
  155. {
  156. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: new List<CardSource>() { selectedCard }, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  157. }
  158. }
  159. }
  160. #endregion
  161. return cardEffects;
  162. }
  163. }
  164. }