BT18_065.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Snatchmon
  6. namespace DCGO.CardEffects.BT18
  7. {
  8. public class BT18_065 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region When Digivolving
  14. if (timing == EffectTiming.OnEnterFieldAnyone)
  15. {
  16. ActivateClass activateClass = new ActivateClass();
  17. activateClass.SetUpICardEffect("Place up to 2 [Vemmon] from trash to digivolution cards.", CanUseCondition, card);
  18. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[When Digivolving] You may place up to 2 [Vemmon] from your trash under this Digimon as its bottom digivolution cards.";
  23. }
  24. bool CanSelectCardCondition(CardSource cardSource)
  25. {
  26. if (cardSource.CardNames.Contains("Vemmon"))
  27. {
  28. return true;
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. return true;
  41. }
  42. return false;
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. if (CardEffectCommons.IsExistOnBattleArea(card))
  47. {
  48. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  49. {
  50. List<CardSource> selectedCards = new List<CardSource>();
  51. int maxCount = Math.Min(2, card.Owner.TrashCards.Count(CanSelectCardCondition));
  52. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  53. selectCardEffect.SetUp(
  54. canTargetCondition: CanSelectCardCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: CanEndSelectCondition,
  57. canNoSelect: () => true,
  58. selectCardCoroutine: SelectCardCoroutine,
  59. afterSelectCardCoroutine: null,
  60. message: "Select [Vemmon] to place on bottom of digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  61. maxCount: maxCount,
  62. canEndNotMax: true,
  63. isShowOpponent: true,
  64. mode: SelectCardEffect.Mode.Custom,
  65. root: SelectCardEffect.Root.Trash,
  66. customRootCardList: null,
  67. canLookReverseCard: true,
  68. selectPlayer: card.Owner,
  69. cardEffect: activateClass);
  70. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  71. selectCardEffect.SetUpCustomMessage("Select [Vemmon] to place on bottom of digivolution cards.", "The opponent is selecting [Vemmon] to place on bottom of digivolution cards.");
  72. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  73. bool CanEndSelectCondition(List<CardSource> cardSources)
  74. {
  75. if (CardEffectCommons.HasNoElement(cardSources))
  76. {
  77. return false;
  78. }
  79. return true;
  80. }
  81. IEnumerator SelectCardCoroutine(CardSource cardSource)
  82. {
  83. selectedCards.Add(cardSource);
  84. yield return null;
  85. }
  86. if (selectedCards.Count >= 1)
  87. {
  88. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  89. }
  90. }
  91. }
  92. }
  93. }
  94. #endregion
  95. #region End of Turn
  96. if (timing == EffectTiming.OnEndTurn)
  97. {
  98. ActivateClass activateClass = new ActivateClass();
  99. activateClass.SetUpICardEffect("Digivolve into a Digimon with Vemmon in text.", CanUseCondition, card);
  100. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  101. cardEffects.Add(activateClass);
  102. string EffectDiscription()
  103. {
  104. return "[End of Your Turn] If this Digimon has 4 or more digivolution cards, this Digimon may Digivolve into a Digimon card with [Vemmon] in its text in your hand.";
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. if (CardEffectCommons.IsExistOnBattleArea(card))
  109. {
  110. if (CardEffectCommons.IsOwnerTurn(card))
  111. {
  112. return true;
  113. }
  114. }
  115. return false;
  116. }
  117. bool CanActivateCondition(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleArea(card))
  120. {
  121. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 4)
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. bool CanSelectCardCondition(CardSource cardSource)
  129. {
  130. return (cardSource.IsDigimon && cardSource.HasText("Vemmon"));
  131. }
  132. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  135. targetPermanent: card.PermanentOfThisCard(),
  136. cardCondition: CanSelectCardCondition,
  137. payCost: true,
  138. reduceCostTuple: (reduceCost: 0, reduceCostCardCondition: null),
  139. fixedCostTuple: null,
  140. ignoreDigivolutionRequirementFixedCost: -1,
  141. isHand: true,
  142. activateClass: activateClass,
  143. successProcess: null));
  144. }
  145. }
  146. #endregion
  147. #region DigiXros from trash
  148. if (timing == EffectTiming.None)
  149. {
  150. AddMaxTrashCountDigiXrosClass addMaxTrashCountDigiXrosClass = new AddMaxTrashCountDigiXrosClass();
  151. addMaxTrashCountDigiXrosClass.SetUpICardEffect($"Trash cards can be selected for DigiXros", CanUseCondition, card);
  152. addMaxTrashCountDigiXrosClass.SetUpAddMaxTrashCountDigiXrosClass(getMaxTrashCount: GetCount);
  153. addMaxTrashCountDigiXrosClass.SetNotShowUI(true);
  154. cardEffects.Add(addMaxTrashCountDigiXrosClass);
  155. bool CanSelectPermanentCondition1(Permanent permanent)
  156. {
  157. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  158. {
  159. if (!permanent.TopCard.EqualsCardName("Vemmon"))
  160. {
  161. return true;
  162. }
  163. }
  164. return false;
  165. }
  166. bool CanUseCondition(Hashtable hashtable)
  167. {
  168. return CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1) == 0;
  169. }
  170. int GetCount(CardSource cardSource)
  171. {
  172. if (cardSource == card)
  173. {
  174. return 4;
  175. }
  176. return 0;
  177. }
  178. }
  179. #endregion
  180. #region DigiXros
  181. if (timing == EffectTiming.None)
  182. {
  183. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  184. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  185. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  186. addDigiXrosConditionClass.SetNotShowUI(true);
  187. cardEffects.Add(addDigiXrosConditionClass);
  188. bool CanUseCondition(Hashtable hashtable)
  189. {
  190. return true;
  191. }
  192. DigiXrosCondition GetDigiXros(CardSource cardSource)
  193. {
  194. if (cardSource == card)
  195. {
  196. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>();
  197. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "Vemmon");
  198. bool CanSelectCardCondition1(CardSource cardSource)
  199. {
  200. return cardSource != null
  201. && cardSource.Owner == card.Owner
  202. && cardSource.IsDigimon
  203. && cardSource.CardNames_DigiXros.Contains("Vemmon");
  204. }
  205. for (int i = 0; i < 4; i++)
  206. {
  207. elements.Add(element1);
  208. }
  209. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 1);
  210. return digiXrosCondition;
  211. }
  212. return null;
  213. }
  214. }
  215. #endregion
  216. #region ESS - All Turns
  217. if (timing == EffectTiming.OnDigivolutionCardReturnToDeckBottom)
  218. {
  219. ActivateClass activateClass = new ActivateClass();
  220. activateClass.SetUpICardEffect("Unsuspend this Digimon and it gain Blocker", CanUseCondition, card);
  221. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  222. activateClass.SetIsInheritedEffect(true);
  223. activateClass.SetHashString("Unsuspend_BT11_065");
  224. cardEffects.Add(activateClass);
  225. string EffectDiscription()
  226. {
  227. return "[All Turns][Once Per Turn] When [Vemmon] is returned from this Digimon's digivolution cards at the bottom of its owner's deck, unsuspend this Digimon, and it gains <Blocker> until the end of your opponent's turn.";
  228. }
  229. bool CanUseCondition(Hashtable hashtable)
  230. {
  231. return CardEffectCommons.CanTriggerOnReturnToLibraryBottomDigivolutionCard(hashtable, cardSource => cardSource.CardNames.Contains("Vemmon"), card);
  232. }
  233. bool CanActivateCondition(Hashtable hashtable)
  234. {
  235. if (CardEffectCommons.IsExistOnBattleArea(card))
  236. {
  237. return true;
  238. }
  239. return false;
  240. }
  241. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  242. {
  243. Permanent selectedPermanent = card.PermanentOfThisCard();
  244. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  245. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: card.PermanentOfThisCard(), effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  246. }
  247. }
  248. #endregion
  249. return cardEffects;
  250. }
  251. }
  252. }