LucemonSatanMode_BT18_101.cs 9.4 KB

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