LM_022.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.LM
  5. {
  6. public class LM_022 : 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 DigivolutionCondition()
  15. {
  16. return card.Owner.SecurityCards.Count <= 2;
  17. }
  18. bool PermanentCondition(Permanent targetPermanent)
  19. {
  20. return targetPermanent.TopCard.EqualsCardName("Gabumon");
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  23. digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: DigivolutionCondition));
  24. }
  25. #endregion
  26. #region Ace - Blast Digivolve
  27. if (timing == EffectTiming.OnCounterTiming)
  28. {
  29. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  30. }
  31. #endregion
  32. #region On Play/ When Digivolving Shared
  33. bool CanSelectPermanentConditionShared(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  36. permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count;
  37. }
  38. bool CanActivateConditionShared(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  41. CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentConditionShared);
  42. }
  43. #endregion
  44. #region On Play
  45. if (timing == EffectTiming.OnEnterFieldAnyone)
  46. {
  47. ActivateClass activateClass = new ActivateClass();
  48. activateClass.SetUpICardEffect("Bottom deck 2 of your opponent's Digimon", CanUseCondition, card);
  49. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  50. cardEffects.Add(activateClass);
  51. string EffectDescription()
  52. {
  53. return
  54. "[On Play] Return 2 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the bottom of the deck.";
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable hashtable)
  61. {
  62. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared));
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canTargetCondition: CanSelectPermanentConditionShared,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: null,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon to bottom deck.",
  77. "The opponent is selecting 2 Digimon to bottom deck.");
  78. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  79. }
  80. }
  81. #endregion
  82. #region When Digivolving
  83. if (timing == EffectTiming.OnEnterFieldAnyone)
  84. {
  85. ActivateClass activateClass = new ActivateClass();
  86. activateClass.SetUpICardEffect("Bottom deck 2 of your opponent's Digimon", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  88. cardEffects.Add(activateClass);
  89. string EffectDescription()
  90. {
  91. return
  92. "[When Digivolving] Return 2 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the bottom of the deck.";
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable hashtable)
  99. {
  100. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared));
  101. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition_ByPreSelecetedList: null,
  105. canTargetCondition: CanSelectPermanentConditionShared,
  106. canEndSelectCondition: null,
  107. maxCount: maxCount,
  108. canNoSelect: false,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: null,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  113. cardEffect: activateClass);
  114. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon to bottom deck.",
  115. "The opponent is selecting 2 Digimon to bottom deck.");
  116. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  117. }
  118. }
  119. #endregion
  120. #region When Attacking
  121. if (timing == EffectTiming.OnAllyAttack)
  122. {
  123. ActivateClass activateClass = new ActivateClass();
  124. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  125. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  126. activateClass.SetHashString("Unsuspend_LM_022");
  127. cardEffects.Add(activateClass);
  128. string EffectDescription()
  129. {
  130. return "[When Attacking] (Once Per Turn) If you have a Tamer, unsuspend this Digimon.";
  131. }
  132. bool CanUseCondition(Hashtable hashtable)
  133. {
  134. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  135. }
  136. bool CanActivateCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  139. CardEffectCommons.HasMatchConditionOwnersPermanent(card, permanent => permanent.IsTamer) &&
  140. CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard());
  141. }
  142. IEnumerator ActivateCoroutine(Hashtable hashtable)
  143. {
  144. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
  145. new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  146. }
  147. }
  148. #endregion
  149. return cardEffects;
  150. }
  151. }
  152. }