BT22_023.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // AeroVeedramon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_023 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel4
  18. && targetPermanent.TopCard.HasCSTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region On Play
  24. if (timing == EffectTiming.OnEnterFieldAnyone)
  25. {
  26. ActivateClass activateClass = new ActivateClass();
  27. activateClass.SetUpICardEffect("Bottom deck 1 level 4 or lower digimon", CanUseCondition, card);
  28. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  29. cardEffects.Add(activateClass);
  30. string EffectDiscription()
  31. {
  32. return "[On Play] Return 1 of your opponent's level 4 or lower Digimon to the bottom of the deck.";
  33. }
  34. bool CanUseCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  37. }
  38. bool CanActivateCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  41. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition);
  42. }
  43. bool CanSelectPermanentCondition(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  46. && permanent.TopCard.HasLevel && permanent.TopCard.Level <= 4;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  51. {
  52. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  53. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  54. selectPermanentEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: CanSelectPermanentCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount1,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. selectPermanentCoroutine: null,
  63. afterSelectPermanentCoroutine: null,
  64. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  65. cardEffect: activateClass);
  66. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.", "The opponent is selecting 1 Digimon to bottom deck.");
  67. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  68. }
  69. }
  70. }
  71. #endregion
  72. #region When Digivolving
  73. if (timing == EffectTiming.OnEnterFieldAnyone)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Bottom deck 1 level 4 or lower digimon", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  78. cardEffects.Add(activateClass);
  79. string EffectDiscription()
  80. {
  81. return "[When Digivolving] Return 1 of your opponent's level 4 or lower Digimon to the bottom of the deck.";
  82. }
  83. bool CanUseCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  86. }
  87. bool CanActivateCondition(Hashtable hashtable)
  88. {
  89. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  90. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition);
  91. }
  92. bool CanSelectPermanentCondition(Permanent permanent)
  93. {
  94. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  95. && permanent.TopCard.HasLevel && permanent.TopCard.Level <= 4;
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable hashtable)
  98. {
  99. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermanentCondition))
  100. {
  101. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition));
  102. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  103. selectPermanentEffect.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectPermanentCondition,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: maxCount,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: null,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  114. cardEffect: activateClass);
  115. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.", "The opponent is selecting 1 Digimon to bottom deck.");
  116. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  117. }
  118. }
  119. }
  120. #endregion
  121. #region End of Turn
  122. if (timing == EffectTiming.OnEndTurn)
  123. {
  124. ActivateClass activateClass = new ActivateClass();
  125. activateClass.SetUpICardEffect("Unsuspend 1 blue tamer or digimon", CanUseCondition, card);
  126. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  127. activateClass.SetHashString("BT22_023_OnEndTurn");
  128. cardEffects.Add(activateClass);
  129. string EffectDiscription()
  130. {
  131. return "[End of Your Turn] [Once Per Turn] 1 of your blue Digimon or Tamers may unsuspend.";
  132. }
  133. bool CanUseCondition(Hashtable hashtable)
  134. {
  135. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  136. && CardEffectCommons.IsOwnerTurn(card);
  137. }
  138. bool CanActivateCondition(Hashtable hashtable)
  139. {
  140. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  141. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition);
  142. }
  143. bool CanSelectPermanentCondition(Permanent permanent)
  144. {
  145. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  146. && permanent.TopCard.CardColors.Contains(CardColor.Blue)
  147. && (permanent.IsDigimon || permanent.IsTamer);
  148. }
  149. IEnumerator ActivateCoroutine(Hashtable hashtable)
  150. {
  151. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanSelectPermanentCondition))
  152. {
  153. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, CanSelectPermanentCondition));
  154. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  155. selectPermanentEffect.SetUp(
  156. selectPlayer: card.Owner,
  157. canTargetCondition: CanSelectPermanentCondition,
  158. canTargetCondition_ByPreSelecetedList: null,
  159. canEndSelectCondition: null,
  160. maxCount: maxCount,
  161. canNoSelect: false,
  162. canEndNotMax: false,
  163. selectPermanentCoroutine: null,
  164. afterSelectPermanentCoroutine: null,
  165. mode: SelectPermanentEffect.Mode.UnTap,
  166. cardEffect: activateClass);
  167. selectPermanentEffect.SetUpCustomMessage("Select 1 card to unsuspend.", "The opponent is selecting 1 card to unsuspend.");
  168. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  169. }
  170. }
  171. }
  172. #endregion
  173. #region ESS
  174. if (timing == EffectTiming.OnTappedAnyone)
  175. {
  176. ActivateClass activateClass = new ActivateClass();
  177. activateClass.SetUpICardEffect("Unsuspend this digimon", CanUseCondition, card);
  178. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  179. activateClass.SetHashString("BT22_023_ESS");
  180. activateClass.SetIsInheritedEffect(true);
  181. cardEffects.Add(activateClass);
  182. string EffectDiscription()
  183. {
  184. return "[All Turns] [Once Per Turn] When this Digimon with [Veedramon] in its name suspends, if you have a blue Tamer, this Digimon may unsuspend.";
  185. }
  186. bool CanUseCondition(Hashtable hashtable)
  187. {
  188. return CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, IsVeedramon);
  189. }
  190. bool CanActivateCondition(Hashtable hashtable)
  191. {
  192. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  193. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsBlueTamer);
  194. }
  195. bool IsVeedramon(Permanent permanent)
  196. {
  197. return permanent.TopCard.ContainsCardName("Veedramon")
  198. && card.PermanentOfThisCard() == permanent;
  199. }
  200. bool IsBlueTamer(Permanent permanent)
  201. {
  202. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  203. && permanent.IsTamer
  204. && permanent.TopCard.CardColors.Contains(CardColor.Blue);
  205. }
  206. IEnumerator ActivateCoroutine(Hashtable hashtable)
  207. {
  208. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  209. }
  210. }
  211. #endregion
  212. return cardEffects;
  213. }
  214. }
  215. }