BT18_028.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_028 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region DigiXros
  11. if (timing == EffectTiming.None)
  12. {
  13. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  14. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros -2", CanUseCondition, card);
  15. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  16. addDigiXrosConditionClass.SetNotShowUI(true);
  17. cardEffects.Add(addDigiXrosConditionClass);
  18. bool CanUseCondition(Hashtable hashtable)
  19. {
  20. return true;
  21. }
  22. DigiXrosCondition GetDigiXros(CardSource cardSource)
  23. {
  24. if (cardSource == card)
  25. {
  26. DigiXrosConditionElement elementHuman =
  27. new DigiXrosConditionElement(CanSelectCardCondition, "Kumamon");
  28. bool CanSelectCardCondition(CardSource conditionCardSource)
  29. {
  30. if (conditionCardSource != null)
  31. {
  32. if (conditionCardSource.Owner == card.Owner)
  33. {
  34. if (conditionCardSource.IsDigimon)
  35. {
  36. if (conditionCardSource.CardNames_DigiXros.Contains("Kumamon"))
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45. DigiXrosConditionElement elementBeast =
  46. new DigiXrosConditionElement(CanSelectCardCondition1, "Korikakumon");
  47. bool CanSelectCardCondition1(CardSource conditionCardSource)
  48. {
  49. if (conditionCardSource != null)
  50. {
  51. if (conditionCardSource.Owner == card.Owner)
  52. {
  53. if (conditionCardSource.IsDigimon)
  54. {
  55. if (conditionCardSource.CardNames_DigiXros.Contains("Korikakumon"))
  56. {
  57. return true;
  58. }
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>()
  65. { elementHuman, elementBeast };
  66. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  67. return digiXrosCondition;
  68. }
  69. return null;
  70. }
  71. }
  72. #endregion
  73. #region On Play/ When Digivolving Shared
  74. bool CanActivateConditionShared(Hashtable hashtable)
  75. {
  76. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  77. }
  78. #endregion
  79. #region On Play
  80. if (timing == EffectTiming.OnEnterFieldAnyone)
  81. {
  82. ActivateClass activateClass = new ActivateClass();
  83. activateClass.SetUpICardEffect("Trash 2 bottom sources from all opponent's Digimon. Their sourceless digimon can't suspend", CanUseCondition, card);
  84. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  85. cardEffects.Add(activateClass);
  86. string EffectDescription()
  87. {
  88. return
  89. "[On Play] Trash the bottom 2 digivolution cards of all of your opponent's Digimon. None of their Digimon with no digivolution cards can suspend until the end of their turn.";
  90. }
  91. bool CanUseCondition(Hashtable hashtable)
  92. {
  93. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  94. }
  95. IEnumerator ActivateCoroutine(Hashtable hashtable)
  96. {
  97. foreach (Permanent selectedPermanent in card.Owner.Enemy.GetBattleAreaDigimons())
  98. {
  99. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  100. targetPermanent: selectedPermanent,
  101. trashCount: 2,
  102. isFromTop: false,
  103. activateClass: activateClass));
  104. }
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotSuspendPlayerEffect(
  106. permanentCondition: PermanentCanNotSuspendCondition,
  107. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  108. activateClass: activateClass,
  109. isOnlyActivePhase: false,
  110. effectName: "Can't Suspend"));
  111. bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
  112. {
  113. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanentCanNotSuspend,card) &&
  114. permanentCanNotSuspend.HasNoDigivolutionCards;
  115. }
  116. }
  117. }
  118. #endregion
  119. #region When Digivolving
  120. if (timing == EffectTiming.OnEnterFieldAnyone)
  121. {
  122. ActivateClass activateClass = new ActivateClass();
  123. activateClass.SetUpICardEffect("Trash 2 bottom digivolution cards of all your opponent's Digimon", CanUseCondition, card);
  124. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  125. cardEffects.Add(activateClass);
  126. string EffectDescription()
  127. {
  128. return
  129. "[When Digivolving] Trash the bottom 2 digivolution cards of all of your opponent's Digimon. None of their Digimon with no digivolution cards can suspend until the end of their turn.";
  130. }
  131. bool CanUseCondition(Hashtable hashtable)
  132. {
  133. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  134. }
  135. IEnumerator ActivateCoroutine(Hashtable hashtable)
  136. {
  137. foreach (Permanent selectedPermanent in card.Owner.Enemy.GetBattleAreaDigimons())
  138. {
  139. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  140. targetPermanent: selectedPermanent,
  141. trashCount: 2,
  142. isFromTop: false,
  143. activateClass: activateClass));
  144. }
  145. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotSuspendPlayerEffect(
  146. permanentCondition: PermanentCanNotSuspendCondition,
  147. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  148. activateClass: activateClass,
  149. isOnlyActivePhase: false,
  150. effectName: "Can't Suspend"));
  151. bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
  152. {
  153. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanentCanNotSuspend, card) &&
  154. !permanentCanNotSuspend.HasNoDigivolutionCards;
  155. }
  156. }
  157. }
  158. #endregion
  159. #region All Turns
  160. if (timing == EffectTiming.WhenRemoveField)
  161. {
  162. ActivateClass activateClass = new ActivateClass();
  163. activateClass.SetUpICardEffect("Play a Digimon from digivolution cards.", CanUseCondition, card);
  164. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  165. cardEffects.Add(activateClass);
  166. string EffectDescription()
  167. {
  168. return
  169. "[All Turns] When this Digimon would leave the battle area, you may play 1 level 4 or lower Digimon card with the [Mammal]/[Ice-Snow]/[Hybrid] trait from this Digimon's digivolution cards without paying the cost.";
  170. }
  171. bool CanUseCondition(Hashtable hashtable)
  172. {
  173. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  174. CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card);
  175. }
  176. bool CanSelectCardCondition(CardSource cardSource)
  177. {
  178. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 4 &&
  179. (cardSource.ContainsTraits("Mammal") || cardSource.ContainsTraits("Ice-Snow") ||
  180. cardSource.ContainsTraits("Hybrid")) &&
  181. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  182. }
  183. bool CanActivateCondition(Hashtable hashtable)
  184. {
  185. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  186. card.PermanentOfThisCard().DigivolutionCards.Some(CanSelectCardCondition);
  187. }
  188. IEnumerator ActivateCoroutine(Hashtable hashtable)
  189. {
  190. List<CardSource> selectedCards = new List<CardSource>();
  191. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  192. selectCardEffect.SetUp(
  193. canTargetCondition: CanSelectCardCondition,
  194. canTargetCondition_ByPreSelecetedList: null,
  195. canEndSelectCondition: null,
  196. canNoSelect: () => true,
  197. selectCardCoroutine: SelectCardCoroutine,
  198. afterSelectCardCoroutine: null,
  199. message: "Select 1 digivolution card to play.",
  200. maxCount: 1,
  201. canEndNotMax: false,
  202. isShowOpponent: true,
  203. mode: SelectCardEffect.Mode.Custom,
  204. root: SelectCardEffect.Root.Custom,
  205. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  206. canLookReverseCard: true,
  207. selectPlayer: card.Owner,
  208. cardEffect: activateClass);
  209. selectCardEffect.SetUpCustomMessage(
  210. "Select 1 digivolution card to play.",
  211. "The opponent is selecting 1 digivolution card to play.");
  212. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  213. yield return StartCoroutine(selectCardEffect.Activate());
  214. IEnumerator SelectCardCoroutine(CardSource cardSource)
  215. {
  216. selectedCards.Add(cardSource);
  217. yield return null;
  218. }
  219. yield return ContinuousController.instance.StartCoroutine(
  220. CardEffectCommons.PlayPermanentCards(
  221. cardSources: selectedCards,
  222. activateClass: activateClass,
  223. payCost: false,
  224. isTapped: false,
  225. root: SelectCardEffect.Root.DigivolutionCards,
  226. activateETB: true));
  227. }
  228. }
  229. #endregion
  230. return cardEffects;
  231. }
  232. }
  233. }