BT18_084.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT18
  4. {
  5. public class BT18_084 : 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, "Loweemon or Duskmon");
  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("Loweemon") ||
  37. conditionCardSource.CardNames_DigiXros.Contains("Duskmon"))
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. DigiXrosConditionElement elementBeast =
  47. new DigiXrosConditionElement(CanSelectCardCondition1, "KaiserLeomon or Velgrmon");
  48. bool CanSelectCardCondition1(CardSource conditionCardSource)
  49. {
  50. if (conditionCardSource != null)
  51. {
  52. if (conditionCardSource.Owner == card.Owner)
  53. {
  54. if (conditionCardSource.IsDigimon)
  55. {
  56. if (conditionCardSource.CardNames_DigiXros.Contains("KaiserLeomon") ||
  57. conditionCardSource.CardNames_DigiXros.Contains("Velgrmon"))
  58. {
  59. return true;
  60. }
  61. }
  62. }
  63. }
  64. return false;
  65. }
  66. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>()
  67. { elementHuman, elementBeast };
  68. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  69. return digiXrosCondition;
  70. }
  71. return null;
  72. }
  73. }
  74. #endregion
  75. #region On Play/ When Digivolving Shared
  76. bool CanSelectPermanentConditionShared(Permanent permanent)
  77. {
  78. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  79. permanent.IsDigimon &&
  80. !permanent.IsSuspended;
  81. }
  82. bool CanActivateConditionShared(Hashtable hashtable)
  83. {
  84. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  85. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared);
  86. }
  87. #endregion
  88. #region On Play
  89. if (timing == EffectTiming.OnEnterFieldAnyone)
  90. {
  91. ActivateClass activateClass = new ActivateClass();
  92. activateClass.SetUpICardEffect("Delete 1 of your opponent's unsuspended Digimon", CanUseCondition, card);
  93. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  94. cardEffects.Add(activateClass);
  95. string EffectDescription()
  96. {
  97. return
  98. "[On Play] Delete 1 of your opponent's unsuspended Digimon.";
  99. }
  100. bool CanUseCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable hashtable)
  105. {
  106. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  107. selectPermanentEffect.SetUp(
  108. selectPlayer: card.Owner,
  109. canTargetCondition: CanSelectPermanentConditionShared,
  110. canTargetCondition_ByPreSelecetedList: null,
  111. canEndSelectCondition: null,
  112. maxCount: 1,
  113. canNoSelect: false,
  114. canEndNotMax: false,
  115. selectPermanentCoroutine: null,
  116. afterSelectPermanentCoroutine: null,
  117. mode: SelectPermanentEffect.Mode.Destroy,
  118. cardEffect: activateClass);
  119. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  120. "The opponent is selecting 1 Digimon to delete.");
  121. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  122. }
  123. }
  124. #endregion
  125. #region When Digivolving
  126. if (timing == EffectTiming.OnEnterFieldAnyone)
  127. {
  128. ActivateClass activateClass = new ActivateClass();
  129. activateClass.SetUpICardEffect("Delete 1 of your opponent's unsuspended Digimon", CanUseCondition, card);
  130. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  131. cardEffects.Add(activateClass);
  132. string EffectDescription()
  133. {
  134. return
  135. "[When Digivolving] Delete 1 of your opponent's unsuspended Digimon.";
  136. }
  137. bool CanUseCondition(Hashtable hashtable)
  138. {
  139. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  140. }
  141. IEnumerator ActivateCoroutine(Hashtable hashtable)
  142. {
  143. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  144. selectPermanentEffect.SetUp(
  145. selectPlayer: card.Owner,
  146. canTargetCondition: CanSelectPermanentConditionShared,
  147. canTargetCondition_ByPreSelecetedList: null,
  148. canEndSelectCondition: null,
  149. maxCount: 1,
  150. canNoSelect: false,
  151. canEndNotMax: false,
  152. selectPermanentCoroutine: null,
  153. afterSelectPermanentCoroutine: null,
  154. mode: SelectPermanentEffect.Mode.Destroy,
  155. cardEffect: activateClass);
  156. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.",
  157. "The opponent is selecting 1 Digimon to delete.");
  158. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  159. }
  160. }
  161. #endregion
  162. #region All Turns
  163. if (timing == EffectTiming.WhenRemoveField)
  164. {
  165. ActivateClass activateClass = new ActivateClass();
  166. activateClass.SetUpICardEffect("Play a Digimon from digivolution cards.", CanUseCondition, card);
  167. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  168. cardEffects.Add(activateClass);
  169. string EffectDescription()
  170. {
  171. return
  172. "[All Turns] When this Digimon would leave the battle area, you may play 1 level 4 or lower Digimon card with the [Dark Animal]/[Mythical Beast]/[Hybrid] trait from this Digimon's digivolution cards without paying the cost.";
  173. }
  174. bool CanUseCondition(Hashtable hashtable)
  175. {
  176. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  177. CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card);
  178. }
  179. bool CanSelectCardCondition(CardSource cardSource)
  180. {
  181. return cardSource.IsDigimon && cardSource.HasLevel && cardSource.Level <= 4 &&
  182. (cardSource.ContainsTraits("Dark Animal") || cardSource.ContainsTraits("Mythical Beast") ||
  183. cardSource.ContainsTraits("Hybrid")) &&
  184. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  185. }
  186. bool CanActivateCondition(Hashtable hashtable)
  187. {
  188. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  189. card.PermanentOfThisCard().DigivolutionCards.Some(CanSelectCardCondition);
  190. }
  191. IEnumerator ActivateCoroutine(Hashtable hashtable)
  192. {
  193. List<CardSource> selectedCards = new List<CardSource>();
  194. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  195. selectCardEffect.SetUp(
  196. canTargetCondition: CanSelectCardCondition,
  197. canTargetCondition_ByPreSelecetedList: null,
  198. canEndSelectCondition: null,
  199. canNoSelect: () => true,
  200. selectCardCoroutine: SelectCardCoroutine,
  201. afterSelectCardCoroutine: null,
  202. message: "Select 1 digivolution card to play.",
  203. maxCount: 1,
  204. canEndNotMax: false,
  205. isShowOpponent: true,
  206. mode: SelectCardEffect.Mode.Custom,
  207. root: SelectCardEffect.Root.Custom,
  208. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  209. canLookReverseCard: true,
  210. selectPlayer: card.Owner,
  211. cardEffect: activateClass);
  212. selectCardEffect.SetUpCustomMessage(
  213. "Select 1 digivolution card to play.",
  214. "The opponent is selecting 1 digivolution card to play.");
  215. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  216. yield return StartCoroutine(selectCardEffect.Activate());
  217. IEnumerator SelectCardCoroutine(CardSource cardSource)
  218. {
  219. selectedCards.Add(cardSource);
  220. yield return null;
  221. }
  222. yield return ContinuousController.instance.StartCoroutine(
  223. CardEffectCommons.PlayPermanentCards(
  224. cardSources: selectedCards,
  225. activateClass: activateClass,
  226. payCost: false,
  227. isTapped: false,
  228. root: SelectCardEffect.Root.DigivolutionCards,
  229. activateETB: true));
  230. }
  231. }
  232. #endregion
  233. return cardEffects;
  234. }
  235. }
  236. }