BT16_027.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_027 : 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, Blast Digivolve
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Imperialdramon: Dragon Mode");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 2,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null)
  24. );
  25. }
  26. if (timing == EffectTiming.OnCounterTiming)
  27. {
  28. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  29. }
  30. #endregion
  31. #region On Play
  32. if (timing == EffectTiming.OnEnterFieldAnyone)
  33. {
  34. ActivateClass activateClass = new ActivateClass();
  35. activateClass.SetUpICardEffect("Bottom Deck 1 of your opponent's Digimon", CanUseCondition, card);
  36. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  37. cardEffects.Add(activateClass);
  38. string EffectDiscription()
  39. {
  40. return "[On Play] Return 1 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the bottom of the deck.";
  41. }
  42. bool CanSelectPermanentCondition(Permanent permanent)
  43. {
  44. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  45. {
  46. return permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count;
  47. }
  48. return false;
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. }
  54. bool CanActivateCondition(Hashtable hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  57. {
  58. return CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition);
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable hashtable)
  63. {
  64. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  65. selectPermanentEffect.SetUp(
  66. selectPlayer: card.Owner,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canTargetCondition: CanSelectPermanentCondition,
  69. canEndSelectCondition: null,
  70. maxCount: 1,
  71. canNoSelect: false,
  72. canEndNotMax: false,
  73. selectPermanentCoroutine: null,
  74. afterSelectPermanentCoroutine: null,
  75. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  76. cardEffect: activateClass);
  77. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.", "The opponent is selecting 1 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 1 of your opponent's Digimon", CanUseCondition, card);
  87. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  88. cardEffects.Add(activateClass);
  89. string EffectDiscription()
  90. {
  91. return "[When Digivolving] Return 1 of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the bottom of the deck.";
  92. }
  93. bool CanSelectPermanentCondition(Permanent permanent)
  94. {
  95. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  96. {
  97. return permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count;
  98. }
  99. return false;
  100. }
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  108. {
  109. return CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition);
  110. }
  111. return false;
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable hashtable)
  114. {
  115. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  116. selectPermanentEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canTargetCondition: CanSelectPermanentCondition,
  120. canEndSelectCondition: null,
  121. maxCount: 1,
  122. canNoSelect: false,
  123. canEndNotMax: false,
  124. selectPermanentCoroutine: null,
  125. afterSelectPermanentCoroutine: null,
  126. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  127. cardEffect: activateClass);
  128. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.", "The opponent is selecting 1 Digimon to bottom deck.");
  129. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  130. }
  131. }
  132. #endregion
  133. #region End of Attack
  134. if (timing == EffectTiming.OnEndAttack)
  135. {
  136. ActivateClass activateClass = new ActivateClass();
  137. activateClass.SetUpICardEffect("Unsuspend this Digimon/Return a suspended Digimon to the bottom of the deck.", CanUseCondition, card);
  138. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  139. activateClass.SetHashString("EndofAttack_BT16_027");
  140. cardEffects.Add(activateClass);
  141. string EffectDiscription()
  142. {
  143. return "[End of Attack] [Once Per Turn] Unsuspend this Digimon. Then, if [Imperialdramon: Dragon Mode] is in this Digimon's digivolution cards, return 1 of your opponent's suspended Digimon to the bottom of the deck.";
  144. }
  145. bool HasSourceCondition(CardSource cardSource)
  146. {
  147. return cardSource.EqualsCardName("Imperialdramon: Dragon Mode") || cardSource.EqualsCardName("Imperialdramon Dragon Mode");
  148. }
  149. bool CanSelectPermanentCondition(Permanent permanent)
  150. {
  151. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  152. {
  153. return permanent.IsSuspended;
  154. }
  155. return false;
  156. }
  157. bool CanUseCondition(Hashtable hashtable)
  158. {
  159. return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
  160. }
  161. bool CanActivateCondition(Hashtable hashtable)
  162. {
  163. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  164. }
  165. IEnumerator ActivateCoroutine(Hashtable hashtable)
  166. {
  167. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  168. if (card.PermanentOfThisCard().DigivolutionCards.Count(HasSourceCondition) >= 1)
  169. {
  170. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  171. selectPermanentEffect.SetUp(
  172. selectPlayer: card.Owner,
  173. canTargetCondition_ByPreSelecetedList: null,
  174. canTargetCondition: CanSelectPermanentCondition,
  175. canEndSelectCondition: null,
  176. maxCount: 1,
  177. canNoSelect: false,
  178. canEndNotMax: false,
  179. selectPermanentCoroutine: null,
  180. afterSelectPermanentCoroutine: null,
  181. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  182. cardEffect: activateClass);
  183. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.", "The opponent is selecting 1 Digimon to bottom deck.");
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. }
  186. }
  187. }
  188. #endregion
  189. return cardEffects;
  190. }
  191. }
  192. }