BT11_111.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT11
  6. {
  7. public class BT11_111 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Snatchmon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 9,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null));
  24. }
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Place up to 4 [Vemmon] from trash to digivolution cards and delete 1 Digimon", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[When Digivolving] You may place up to 4 [Vemmon] from your trash under this Digimon as its bottom digivolution cards. Then, if there are 8 or more [Vemmon] in this Digimon's digivolution cards, delete 1 of your opponent's Digimon.";
  34. }
  35. bool CanSelectCardCondition(CardSource cardSource)
  36. {
  37. if (cardSource.CardNames.Contains("Vemmon"))
  38. {
  39. return true;
  40. }
  41. return false;
  42. }
  43. bool CanSelectPermanentCondition(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. return true;
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. if (CardEffectCommons.IsExistOnBattleArea(card))
  62. {
  63. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  64. {
  65. List<CardSource> selectedCards = new List<CardSource>();
  66. int maxCount = Math.Min(4, card.Owner.TrashCards.Count(CanSelectCardCondition));
  67. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  68. selectCardEffect.SetUp(
  69. canTargetCondition: CanSelectCardCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: CanEndSelectCondition,
  72. canNoSelect: () => true,
  73. selectCardCoroutine: SelectCardCoroutine,
  74. afterSelectCardCoroutine: null,
  75. message: "Select [Vemmon] to place on bottom of digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  76. maxCount: maxCount,
  77. canEndNotMax: true,
  78. isShowOpponent: true,
  79. mode: SelectCardEffect.Mode.Custom,
  80. root: SelectCardEffect.Root.Trash,
  81. customRootCardList: null,
  82. canLookReverseCard: true,
  83. selectPlayer: card.Owner,
  84. cardEffect: activateClass);
  85. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  86. selectCardEffect.SetUpCustomMessage("Select [Vemmon] to place on bottom of digivolution cards.", "The opponent is selecting [Vemmon] to place on bottom of digivolution cards.");
  87. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  88. bool CanEndSelectCondition(List<CardSource> cardSources)
  89. {
  90. if (CardEffectCommons.HasNoElement(cardSources))
  91. {
  92. return false;
  93. }
  94. return true;
  95. }
  96. IEnumerator SelectCardCoroutine(CardSource cardSource)
  97. {
  98. selectedCards.Add(cardSource);
  99. yield return null;
  100. }
  101. if (selectedCards.Count >= 1)
  102. {
  103. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  104. }
  105. }
  106. }
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Vemmon")) >= 8)
  110. {
  111. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  112. {
  113. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  114. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  115. selectPermanentEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: CanSelectPermanentCondition,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: maxCount,
  121. canNoSelect: false,
  122. canEndNotMax: false,
  123. selectPermanentCoroutine: null,
  124. afterSelectPermanentCoroutine: null,
  125. mode: SelectPermanentEffect.Mode.Destroy,
  126. cardEffect: activateClass);
  127. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  128. }
  129. }
  130. }
  131. }
  132. }
  133. if (timing == EffectTiming.WhenRemoveField)
  134. {
  135. ActivateClass activateClass = new ActivateClass();
  136. activateClass.SetUpICardEffect("Prevent this Digimon from leaving play", CanUseCondition, card);
  137. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  138. cardEffects.Add(activateClass);
  139. string EffectDiscription()
  140. {
  141. return "[All Turns] When this Digimon would leave the battle area, by placing 4 [Vemmon] from this Digimon's digivolution cards at the bottom of their owners' decks, prevent it from leaving play.";
  142. }
  143. bool CanSelectCardCondition(CardSource cardSource)
  144. {
  145. return cardSource.CardNames.Contains("Vemmon");
  146. }
  147. bool CanUseCondition(Hashtable hashtable)
  148. {
  149. if (CardEffectCommons.IsExistOnBattleArea(card))
  150. {
  151. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  152. {
  153. return true;
  154. }
  155. }
  156. return false;
  157. }
  158. bool CanActivateCondition(Hashtable hashtable)
  159. {
  160. if (CardEffectCommons.IsExistOnBattleArea(card))
  161. {
  162. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 4)
  163. {
  164. return true;
  165. }
  166. }
  167. return false;
  168. }
  169. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  170. {
  171. if (CardEffectCommons.IsExistOnBattleArea(card))
  172. {
  173. Permanent selectedPermanent = card.PermanentOfThisCard();
  174. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 4)
  175. {
  176. List<CardSource> selectedCards = new List<CardSource>();
  177. int maxCount = 4;
  178. bool returnedToLibrary = false;
  179. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  180. selectCardEffect.SetUp(
  181. canTargetCondition: CanSelectCardCondition,
  182. canTargetCondition_ByPreSelecetedList: null,
  183. canEndSelectCondition: null,
  184. canNoSelect: () => true,
  185. selectCardCoroutine: SelectCardCoroutine,
  186. afterSelectCardCoroutine: null,
  187. message: "Select digivolution cards to return to the bottom of deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  188. maxCount: maxCount,
  189. canEndNotMax: false,
  190. isShowOpponent: true,
  191. mode: SelectCardEffect.Mode.Custom,
  192. root: SelectCardEffect.Root.Custom,
  193. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  194. canLookReverseCard: true,
  195. selectPlayer: card.Owner,
  196. cardEffect: null);
  197. selectCardEffect.SetUpCustomMessage("Select digivolution cards to return to the bottom of deck.", "The opponent is selecting digivolution cards to return to the bottom of deck.");
  198. selectCardEffect.SetNotShowCard();
  199. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  200. IEnumerator SelectCardCoroutine(CardSource cardSource)
  201. {
  202. selectedCards.Add(cardSource);
  203. yield return null;
  204. }
  205. if (selectedCards.Count >= 1)
  206. {
  207. yield return ContinuousController.instance.StartCoroutine(new ReturnToLibraryBottomDigivolutionCardsClass(
  208. card.PermanentOfThisCard(),
  209. selectedCards,
  210. CardEffectCommons.CardEffectHashtable(activateClass)).ReturnToLibraryBottomDigivolutionCards());
  211. if (selectedCards.Count == 4)
  212. {
  213. returnedToLibrary = true;
  214. }
  215. }
  216. if (returnedToLibrary)
  217. {
  218. selectedPermanent.willBeRemoveField = false;
  219. selectedPermanent.HideDeleteEffect();
  220. selectedPermanent.HideHandBounceEffect();
  221. selectedPermanent.HideDeckBounceEffect();
  222. selectedPermanent.HideWillRemoveFieldEffect();
  223. }
  224. }
  225. }
  226. }
  227. }
  228. if (timing == EffectTiming.OnStartMainPhase)
  229. {
  230. ActivateClass activateClass = new ActivateClass();
  231. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  232. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  233. cardEffects.Add(activateClass);
  234. string EffectDiscription()
  235. {
  236. return "[Start of Your Main Phase] Trash the top card of your opponent's security stack.";
  237. }
  238. bool CanUseCondition(Hashtable hashtable)
  239. {
  240. if (CardEffectCommons.IsExistOnBattleArea(card))
  241. {
  242. if (CardEffectCommons.IsOwnerTurn(card))
  243. {
  244. return true;
  245. }
  246. }
  247. return false;
  248. }
  249. bool CanActivateCondition(Hashtable hashtable)
  250. {
  251. if (CardEffectCommons.IsExistOnBattleArea(card))
  252. {
  253. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  254. {
  255. return true;
  256. }
  257. }
  258. return false;
  259. }
  260. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  261. {
  262. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  263. player: card.Owner.Enemy,
  264. destroySecurityCount: 1,
  265. cardEffect: activateClass,
  266. fromTop: true).DestroySecurity());
  267. }
  268. }
  269. return cardEffects;
  270. }
  271. }
  272. }