BT11_062.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_062 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.CardNames.Contains("Agumon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[On Play] Reveal the top 3 cards of your deck. Add 1 card with [Greymon] or [X Antibody] in its name and 1 black Tamer card among them to your hand. Place the rest at the bottom of your deck in any order.";
  28. }
  29. bool CanSelectCardCondition(CardSource cardSource)
  30. {
  31. if (cardSource.HasGreymonName)
  32. {
  33. return true;
  34. }
  35. if (cardSource.ContainsCardName("X Antibody"))
  36. {
  37. return true;
  38. }
  39. return false;
  40. }
  41. bool CanSelectCardCondition1(CardSource cardSource)
  42. {
  43. if (cardSource.HasCardColor(CardColor.Black))
  44. {
  45. if (cardSource.IsTamer)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleArea(card))
  59. {
  60. if (card.Owner.LibraryCards.Count >= 1)
  61. {
  62. return true;
  63. }
  64. }
  65. return false;
  66. }
  67. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  68. {
  69. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  70. revealCount: 3,
  71. simplifiedSelectCardConditions:
  72. new SimplifiedSelectCardConditionClass[]
  73. {
  74. new SimplifiedSelectCardConditionClass(
  75. canTargetCondition:CanSelectCardCondition,
  76. message: "Select 1 card with [Greymon] or [X Antibody] in its name.",
  77. mode: SelectCardEffect.Mode.AddHand,
  78. maxCount: 1,
  79. selectCardCoroutine: null),
  80. new SimplifiedSelectCardConditionClass(
  81. canTargetCondition:CanSelectCardCondition1,
  82. message: "Select 1 black Tamer card.",
  83. mode: SelectCardEffect.Mode.AddHand,
  84. maxCount: 1,
  85. selectCardCoroutine: null),
  86. },
  87. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  88. activateClass: activateClass,
  89. mutualConditions: true
  90. ));
  91. }
  92. }
  93. if (timing == EffectTiming.OnEnterFieldAnyone)
  94. {
  95. ActivateClass activateClass = new ActivateClass();
  96. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  97. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  98. cardEffects.Add(activateClass);
  99. string EffectDiscription()
  100. {
  101. return "[When Digivolving] Reveal the top 3 cards of your deck. Add 1 card with [Greymon] or [X Antibody] in its name and 1 black Tamer card among them to your hand. Place the rest at the bottom of your deck in any order.";
  102. }
  103. bool CanSelectCardCondition(CardSource cardSource)
  104. {
  105. if (cardSource.HasGreymonName)
  106. {
  107. return true;
  108. }
  109. if (cardSource.ContainsCardName("X Antibody"))
  110. {
  111. return true;
  112. }
  113. return false;
  114. }
  115. bool CanSelectCardCondition1(CardSource cardSource)
  116. {
  117. if (cardSource.HasCardColor(CardColor.Black))
  118. {
  119. if (cardSource.IsTamer)
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. bool CanUseCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  129. }
  130. bool CanActivateCondition(Hashtable hashtable)
  131. {
  132. if (CardEffectCommons.IsExistOnBattleArea(card))
  133. {
  134. if (card.Owner.LibraryCards.Count >= 1)
  135. {
  136. return true;
  137. }
  138. }
  139. return false;
  140. }
  141. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  142. {
  143. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  144. revealCount: 3,
  145. simplifiedSelectCardConditions:
  146. new SimplifiedSelectCardConditionClass[]
  147. {
  148. new SimplifiedSelectCardConditionClass(
  149. canTargetCondition:CanSelectCardCondition,
  150. message: "Select 1 card with [Greymon] or [X Antibody] in its name.",
  151. mode: SelectCardEffect.Mode.AddHand,
  152. maxCount: 1,
  153. selectCardCoroutine: null),
  154. new SimplifiedSelectCardConditionClass(
  155. canTargetCondition:CanSelectCardCondition1,
  156. message: "Select 1 black Tamer card.",
  157. mode: SelectCardEffect.Mode.AddHand,
  158. maxCount: 1,
  159. selectCardCoroutine: null),
  160. },
  161. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  162. activateClass: activateClass
  163. ));
  164. }
  165. }
  166. if (timing == EffectTiming.WhenPermanentWouldBeDeleted || timing == EffectTiming.WhenReturntoHandAnyone || timing == EffectTiming.WhenReturntoLibraryAnyone)
  167. {
  168. ActivateClass activateClass = new ActivateClass();
  169. activateClass.SetUpICardEffect("Prevent this Digimon from being deleted or returned to hand or deck by effects", CanUseCondition, card);
  170. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  171. activateClass.SetIsInheritedEffect(true);
  172. activateClass.SetHashString("Substitute_BT11_062");
  173. cardEffects.Add(activateClass);
  174. string EffectDiscription()
  175. {
  176. return "[All Turns] When this Digimon with [Greymon] or [Omnimon] in its name would be deleted or returned to your hand or deck by an effect, by placing 1 [X Antibody] from this Digimon's digivolution cards at the bottom of its owner's deck, prevent this Digimon from leaving play.";
  177. }
  178. bool CanSelectCardCondition(CardSource cardSource)
  179. {
  180. if (cardSource.CardNames.Contains("X Antibody"))
  181. {
  182. return true;
  183. }
  184. if (cardSource.CardNames.Contains("XAntibody"))
  185. {
  186. return true;
  187. }
  188. return false;
  189. }
  190. bool CanUseCondition(Hashtable hashtable)
  191. {
  192. if (CardEffectCommons.IsExistOnBattleArea(card))
  193. {
  194. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  195. {
  196. if (CardEffectCommons.IsByEffect(hashtable, null))
  197. {
  198. if (card.PermanentOfThisCard().TopCard.HasGreymonName)
  199. {
  200. return true;
  201. }
  202. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Omnimon"))
  203. {
  204. return true;
  205. }
  206. }
  207. }
  208. }
  209. return false;
  210. }
  211. bool CanActivateCondition(Hashtable hashtable)
  212. {
  213. if (CardEffectCommons.IsExistOnBattleArea(card))
  214. {
  215. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  216. {
  217. return true;
  218. }
  219. }
  220. return false;
  221. }
  222. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  223. {
  224. if (CardEffectCommons.IsExistOnBattleArea(card))
  225. {
  226. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  227. {
  228. bool returnedToLibrary = false;
  229. List<CardSource> selectedCards = new List<CardSource>();
  230. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  231. selectCardEffect.SetUp(
  232. canTargetCondition: CanSelectCardCondition,
  233. canTargetCondition_ByPreSelecetedList: null,
  234. canEndSelectCondition: null,
  235. canNoSelect: () => true,
  236. selectCardCoroutine: SelectCardCoroutine,
  237. afterSelectCardCoroutine: null,
  238. message: "Select 1 digivolution card to return to the bottom of deck.",
  239. maxCount: 1,
  240. canEndNotMax: false,
  241. isShowOpponent: true,
  242. mode: SelectCardEffect.Mode.Custom,
  243. root: SelectCardEffect.Root.Custom,
  244. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  245. canLookReverseCard: true,
  246. selectPlayer: card.Owner,
  247. cardEffect: null);
  248. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to return to the bottom of deck.", "The opponent is selecting 1 digivolution card to return to the bottom of deck.");
  249. selectCardEffect.SetNotShowCard();
  250. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  251. IEnumerator SelectCardCoroutine(CardSource cardSource)
  252. {
  253. selectedCards.Add(cardSource);
  254. yield return null;
  255. }
  256. if (selectedCards.Count >= 1)
  257. {
  258. yield return ContinuousController.instance.StartCoroutine(new ReturnToLibraryBottomDigivolutionCardsClass(
  259. card.PermanentOfThisCard(),
  260. selectedCards, CardEffectCommons.CardEffectHashtable(activateClass)).ReturnToLibraryBottomDigivolutionCards());
  261. returnedToLibrary = true;
  262. }
  263. if (returnedToLibrary)
  264. {
  265. if (CardEffectCommons.IsExistOnBattleArea(card))
  266. {
  267. Permanent selectedPermanent = card.PermanentOfThisCard();
  268. selectedPermanent.willBeRemoveField = false;
  269. selectedPermanent.HideDeleteEffect();
  270. selectedPermanent.HideHandBounceEffect();
  271. selectedPermanent.HideDeckBounceEffect();
  272. }
  273. }
  274. }
  275. }
  276. }
  277. }
  278. return cardEffects;
  279. }
  280. }
  281. }