BT18_086.cs 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_086 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Security
  11. if (timing == EffectTiming.SecuritySkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Play [Lucemon] card", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. activateClass.SetIsSecurityEffect(true);
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Security] You may play 1 [Lucemon] from your trash without paying the cost.";
  21. }
  22. bool LucemonCard(CardSource cardSource)
  23. {
  24. return cardSource.EqualsCardName("Lucemon") &&
  25. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (card.Owner.ExecutingCards.Contains(card))
  34. {
  35. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, LucemonCard))
  36. return true;
  37. }
  38. return false;
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. List<CardSource> selectedCards = new List<CardSource>();
  43. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  44. selectCardEffect.SetUp(
  45. canTargetCondition: LucemonCard,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. canNoSelect: () => false,
  49. selectCardCoroutine: SelectCardCoroutine,
  50. afterSelectCardCoroutine: null,
  51. message: "Select 1 card to play.",
  52. maxCount: 1,
  53. canEndNotMax: false,
  54. isShowOpponent: true,
  55. mode: SelectCardEffect.Mode.Custom,
  56. root: SelectCardEffect.Root.Trash,
  57. customRootCardList: null,
  58. canLookReverseCard: false,
  59. selectPlayer: card.Owner,
  60. cardEffect: activateClass);
  61. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  62. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  63. yield return StartCoroutine(selectCardEffect.Activate());
  64. IEnumerator SelectCardCoroutine(CardSource cardSource)
  65. {
  66. selectedCards.Add(cardSource);
  67. yield return null;
  68. }
  69. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  70. cardSources: selectedCards,
  71. activateClass: activateClass,
  72. payCost: false,
  73. isTapped: false,
  74. root: SelectCardEffect.Root.Trash,
  75. activateETB: true));
  76. }
  77. }
  78. #endregion
  79. #region Breeding
  80. if (timing == EffectTiming.WhenRemoveField)
  81. {
  82. ActivateClass activateClass = new ActivateClass();
  83. activateClass.SetUpICardEffect("Prevent Removal", CanUseCondition, card);
  84. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  85. cardEffects.Add(activateClass);
  86. string EffectDiscription()
  87. {
  88. return "[Breeding] [All Turns] When any of your [Lucemon: Satan Mode] would leave the battle area, by moving this Digimon to battle area, they don't leave.";
  89. }
  90. bool IsLucemonRemoved(Permanent permanent)
  91. {
  92. return permanent.TopCard.Owner == card.Owner &&
  93. permanent.TopCard.EqualsCardName("Lucemon: Satan Mode");
  94. }
  95. bool CanUseCondition(Hashtable hashtable)
  96. {
  97. return CardEffectCommons.IsExistOnBreedingArea(card) &&
  98. CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, IsLucemonRemoved);
  99. }
  100. bool CanActivateCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.IsExistOnBreedingArea(card);
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable hashtable)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(CardObjectController.MovePermanent(card.Owner.GetBreedingAreaPermanents()[0].PermanentFrame));
  107. foreach (Permanent removed in CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(IsLucemonRemoved))
  108. {
  109. removed.willBeRemoveField = false;
  110. removed.HideHandBounceEffect();
  111. removed.HideDeckBounceEffect();
  112. removed.HideWillRemoveFieldEffect();
  113. }
  114. }
  115. }
  116. #endregion
  117. #region All Turns
  118. if (timing == EffectTiming.None)
  119. {
  120. bool PermanentCondition(Permanent permanent)
  121. {
  122. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  123. (permanent.DP == 0);
  124. }
  125. bool NonWhiteDigimon(Permanent permanent)
  126. {
  127. return permanent.IsDigimon &&
  128. !permanent.TopCard.CardColors.Contains(CardColor.White) &&
  129. permanent.TopCard.ContainsCardName("Lucemon");
  130. }
  131. bool CanUseCondition()
  132. {
  133. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  134. CardEffectCommons.HasMatchConditionOwnersPermanent(card, NonWhiteDigimon);
  135. }
  136. string effectName = "[All Turns] While you have a non-white Digimon with [Lucemon] in its name, none of your 0 DP Digimon can be deleted.";
  137. cardEffects.Add(CardEffectFactory.CanNotBeDestroyedStaticEffect(
  138. permanentCondition: PermanentCondition,
  139. isInheritedEffect: false,
  140. card: card,
  141. condition: CanUseCondition,
  142. effectName: effectName
  143. ));
  144. }
  145. #endregion
  146. return cardEffects;
  147. }
  148. }
  149. }