BT18_101.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_101 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. if (targetPermanent.TopCard.EqualsCardName("Lucemon: Chaos Mode"))
  16. {
  17. return true;
  18. }
  19. return false;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  22. digivolutionCost: 6, ignoreDigivolutionRequirement: true, card: card, condition: null));
  23. }
  24. #endregion
  25. #region Shared
  26. bool CanSelectPermanentConditionShared(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  29. (permanent.IsDigimon || permanent.IsTamer);
  30. }
  31. bool CanSelectPermanentDigimon(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  34. }
  35. bool CanSelectPermanentTamer(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  38. permanent.IsTamer;
  39. }
  40. #endregion
  41. #region When Digivolving
  42. if (timing == EffectTiming.OnEnterFieldAnyone)
  43. {
  44. ActivateClass activateClass = new ActivateClass();
  45. activateClass.SetUpICardEffect("Play 1 [Lucemon: Larva] to your breeding area to delete 1 opponents' Digimon or Tamer",
  46. CanUseCondition, card);
  47. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  48. cardEffects.Add(activateClass);
  49. string EffectDescription()
  50. {
  51. return
  52. "[When Digivolving] By playing 1 [Lucemon: Larva] from your trash to your empty breeding area without paying the cost, delete 1 of your opponent's Digimon or Tamers.";
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  57. }
  58. bool CanSelectCardCondition(CardSource cardSource)
  59. {
  60. return cardSource.IsDigimon && cardSource.ContainsCardName("Lucemon: Larva");
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  65. card.Owner.GetBreedingAreaPermanents().Count == 0 &&
  66. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable hashtable)
  69. {
  70. bool played = false;
  71. List<CardSource> selectedCards = new List<CardSource>();
  72. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  73. selectCardEffect.SetUp(
  74. canTargetCondition: CanSelectCardCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. canNoSelect: () => true,
  78. selectCardCoroutine: SelectCardCoroutine,
  79. afterSelectCardCoroutine: null,
  80. message: "Select 1 card to play.",
  81. maxCount: 1,
  82. canEndNotMax: false,
  83. isShowOpponent: true,
  84. mode: SelectCardEffect.Mode.Custom,
  85. root: SelectCardEffect.Root.Trash,
  86. customRootCardList: null,
  87. canLookReverseCard: true,
  88. selectPlayer: card.Owner,
  89. cardEffect: activateClass);
  90. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  91. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  92. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  93. IEnumerator SelectCardCoroutine(CardSource cardSource)
  94. {
  95. selectedCards.Add(cardSource);
  96. if(CardEffectCommons.CanPlayAsNewPermanent(cardSource,false,activateClass,SelectCardEffect.Root.Trash,true))
  97. played = true;
  98. yield return null;
  99. }
  100. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  101. cardSources: selectedCards,
  102. activateClass: activateClass,
  103. payCost: false,
  104. isTapped: false,
  105. root: SelectCardEffect.Root.Trash,
  106. activateETB: true,
  107. isBreedingArea: true));
  108. if (played && CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  109. {
  110. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  111. selectPermanentEffect.SetUp(
  112. selectPlayer: card.Owner,
  113. canTargetCondition: CanSelectPermanentConditionShared,
  114. canTargetCondition_ByPreSelecetedList: null,
  115. canEndSelectCondition: null,
  116. maxCount: 1,
  117. canNoSelect: false,
  118. canEndNotMax: false,
  119. selectPermanentCoroutine: null,
  120. afterSelectPermanentCoroutine: null,
  121. mode: SelectPermanentEffect.Mode.Destroy,
  122. cardEffect: activateClass);
  123. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer to delete.",
  124. "The opponent is selecting 1 Digimon or Tamer to delete.");
  125. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  126. }
  127. }
  128. }
  129. #endregion
  130. #region End of All Turns
  131. if (timing == EffectTiming.OnEndTurn)
  132. {
  133. ActivateClass activateClass = new ActivateClass();
  134. activateClass.SetUpICardEffect("Trash opponent's top security card", CanUseCondition, card);
  135. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  136. activateClass.SetHashString("Trash_BT18-101");
  137. cardEffects.Add(activateClass);
  138. string EffectDescription()
  139. {
  140. return
  141. "[End of All Turns] (Once per Turn) Trash your opponent's top security card. If this effect didn't trash, delete 1 of your opponent's Digimon and 1 of their Tamers.";
  142. }
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  146. }
  147. bool CanActivateCondition(Hashtable hashtable)
  148. {
  149. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  150. }
  151. IEnumerator ActivateCoroutine(Hashtable hashtable)
  152. {
  153. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  154. {
  155. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  156. player: card.Owner.Enemy,
  157. destroySecurityCount: 1,
  158. cardEffect: activateClass,
  159. fromTop: true).DestroySecurity());
  160. }
  161. else
  162. {
  163. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  164. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  165. {
  166. selectPermanentEffect.SetUp(
  167. selectPlayer: card.Owner,
  168. canTargetCondition: CanSelectPermanentDigimon,
  169. canTargetCondition_ByPreSelecetedList: null,
  170. canEndSelectCondition: null,
  171. maxCount: 1,
  172. canNoSelect: false,
  173. canEndNotMax: false,
  174. selectPermanentCoroutine: null,
  175. afterSelectPermanentCoroutine: null,
  176. mode: SelectPermanentEffect.Mode.Destroy,
  177. cardEffect: activateClass);
  178. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  179. "The opponent is selecting 1 Digimon to delete.");
  180. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  181. }
  182. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  183. {
  184. selectPermanentEffect.SetUp(
  185. selectPlayer: card.Owner,
  186. canTargetCondition: CanSelectPermanentTamer,
  187. canTargetCondition_ByPreSelecetedList: null,
  188. canEndSelectCondition: null,
  189. maxCount: 1,
  190. canNoSelect: false,
  191. canEndNotMax: false,
  192. selectPermanentCoroutine: null,
  193. afterSelectPermanentCoroutine: null,
  194. mode: SelectPermanentEffect.Mode.Destroy,
  195. cardEffect: activateClass);
  196. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to delete.",
  197. "The opponent is selecting 1 Tamer to delete.");
  198. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  199. }
  200. }
  201. }
  202. }
  203. #endregion
  204. return cardEffects;
  205. }
  206. }
  207. }