BT22_025.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // UlforceVeedramon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_025 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel5
  18. && targetPermanent.TopCard.HasCSTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region Blast Digivolve
  24. if (timing == EffectTiming.OnCounterTiming)
  25. {
  26. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  27. }
  28. #endregion
  29. #region On Play
  30. if (timing == EffectTiming.OnEnterFieldAnyone)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("Bottom deck lowest level digimon or play 1 blue tamer from hand", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[On Play] Activate 1 of the effects below: Return 1 of your opponent's lowest level Digimon to the bottom of the deck or You may play 1 play cost 4 or lower blue Tamer card from your hand without paying the cost.";
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  43. }
  44. bool CanActivateCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  47. }
  48. bool CanSelectOpponentDigimon(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  51. && CardEffectCommons.IsMinLevel(permanent, card.Owner.Enemy);
  52. }
  53. bool CanSelectBlueTamer(CardSource cardSource)
  54. {
  55. return CardEffectCommons.IsExistOnHand(cardSource)
  56. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass)
  57. && cardSource.IsTamer
  58. && cardSource.HasCardColor(CardColor.Blue);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable hashtable)
  61. {
  62. bool CanBottomDeck = CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentDigimon);
  63. bool CanPlayBlueTamer = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectBlueTamer);
  64. #region Option Selection
  65. if (CanBottomDeck || CanPlayBlueTamer)
  66. {
  67. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>()
  68. {
  69. new(message: "Return 1 of your opponent's lowest level Digimon to the bottom of the deck.", value: 0, spriteIndex: 0),
  70. new(message: "You may play 1 play cost 4 or lower blue Tamer card from your hand without paying the cost", value: 1, spriteIndex: 0),
  71. };
  72. string selectPlayerMessage = "Which effect will you activate?";
  73. string notSelectPlayerMessage = "The opponent is choosing which effect to activate.";
  74. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements,
  75. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  76. notSelectPlayerMessage: notSelectPlayerMessage);
  77. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  78. int actionID = GManager.instance.userSelectionManager.SelectedIntValue;
  79. #region Bottom Deck
  80. if (actionID == 0 && CanBottomDeck)
  81. {
  82. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentDigimon));
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectOpponentDigimon,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: maxCount,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: null,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to bottom deck.", "The opponent is selecting a digimon to bottom deck.");
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. }
  99. #endregion
  100. #region Play Blue Tamer
  101. if (actionID == 1 && CanPlayBlueTamer)
  102. {
  103. CardSource blueTamer = null;
  104. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectBlueTamer));
  105. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  106. selectHandEffect.SetUp(
  107. selectPlayer: card.Owner,
  108. canTargetCondition: CanSelectBlueTamer,
  109. canTargetCondition_ByPreSelecetedList: null,
  110. canEndSelectCondition: null,
  111. maxCount: maxCount,
  112. canNoSelect: true,
  113. canEndNotMax: false,
  114. isShowOpponent: true,
  115. selectCardCoroutine: SelectCardCoroutine,
  116. afterSelectCardCoroutine: null,
  117. mode: SelectHandEffect.Mode.Custom,
  118. cardEffect: activateClass);
  119. IEnumerator SelectCardCoroutine(CardSource cardSource)
  120. {
  121. blueTamer = cardSource;
  122. yield return null;
  123. }
  124. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  125. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  126. yield return StartCoroutine(selectHandEffect.Activate());
  127. if (blueTamer != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  128. cardSources: new List<CardSource>() { blueTamer },
  129. activateClass: activateClass,
  130. payCost: false,
  131. isTapped: false,
  132. root: SelectCardEffect.Root.Hand,
  133. activateETB: true
  134. ));
  135. }
  136. #endregion
  137. }
  138. #endregion
  139. }
  140. }
  141. #endregion
  142. #region When Digivolving
  143. if (timing == EffectTiming.OnEnterFieldAnyone)
  144. {
  145. ActivateClass activateClass = new ActivateClass();
  146. activateClass.SetUpICardEffect("Bottom deck lowest level digimon or play 1 blue tamer from hand", CanUseCondition, card);
  147. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  148. cardEffects.Add(activateClass);
  149. string EffectDiscription()
  150. {
  151. return "[When Digivolving] Activate 1 of the effects below: Return 1 of your opponent's lowest level Digimon to the bottom of the deck or You may play 1 play cost 4 or lower blue Tamer card from your hand without paying the cost.";
  152. }
  153. bool CanUseCondition(Hashtable hashtable)
  154. {
  155. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  156. }
  157. bool CanActivateCondition(Hashtable hashtable)
  158. {
  159. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  160. }
  161. bool CanSelectOpponentDigimon(Permanent permanent)
  162. {
  163. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  164. && CardEffectCommons.IsMinLevel(permanent, card.Owner.Enemy);
  165. }
  166. bool CanSelectBlueTamer(CardSource cardSource)
  167. {
  168. return CardEffectCommons.IsExistOnHand(cardSource)
  169. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass)
  170. && cardSource.IsTamer
  171. && cardSource.HasCardColor(CardColor.Blue);
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable hashtable)
  174. {
  175. bool CanBottomDeck = CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentDigimon);
  176. bool CanPlayBlueTamer = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectBlueTamer);
  177. #region Option Selection
  178. if (CanBottomDeck || CanPlayBlueTamer)
  179. {
  180. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>()
  181. {
  182. new(message: "Return 1 of your opponent's lowest level Digimon to the bottom of the deck.", value: 0, spriteIndex: 0),
  183. new(message: "You may play 1 play cost 4 or lower blue Tamer card from your hand without paying the cost", value: 1, spriteIndex: 0),
  184. };
  185. string selectPlayerMessage = "Which effect will you activate?";
  186. string notSelectPlayerMessage = "The opponent is choosing which effect to activate.";
  187. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements,
  188. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  189. notSelectPlayerMessage: notSelectPlayerMessage);
  190. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  191. int actionID = GManager.instance.userSelectionManager.SelectedIntValue;
  192. #region Bottom Deck
  193. if (actionID == 0 && CanBottomDeck)
  194. {
  195. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentDigimon));
  196. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  197. selectPermanentEffect.SetUp(
  198. selectPlayer: card.Owner,
  199. canTargetCondition: CanSelectOpponentDigimon,
  200. canTargetCondition_ByPreSelecetedList: null,
  201. canEndSelectCondition: null,
  202. maxCount: maxCount,
  203. canNoSelect: false,
  204. canEndNotMax: false,
  205. selectPermanentCoroutine: null,
  206. afterSelectPermanentCoroutine: null,
  207. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  208. cardEffect: activateClass);
  209. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to bottom deck.", "The opponent is selecting a digimon to bottom deck.");
  210. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  211. }
  212. #endregion
  213. #region Play Blue Tamer
  214. if (actionID == 1 && CanPlayBlueTamer)
  215. {
  216. CardSource blueTamer = null;
  217. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectBlueTamer));
  218. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  219. selectHandEffect.SetUp(
  220. selectPlayer: card.Owner,
  221. canTargetCondition: CanSelectBlueTamer,
  222. canTargetCondition_ByPreSelecetedList: null,
  223. canEndSelectCondition: null,
  224. maxCount: maxCount,
  225. canNoSelect: true,
  226. canEndNotMax: false,
  227. isShowOpponent: true,
  228. selectCardCoroutine: SelectCardCoroutine,
  229. afterSelectCardCoroutine: null,
  230. mode: SelectHandEffect.Mode.Custom,
  231. cardEffect: activateClass);
  232. IEnumerator SelectCardCoroutine(CardSource cardSource)
  233. {
  234. blueTamer = cardSource;
  235. yield return null;
  236. }
  237. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  238. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  239. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  240. if (blueTamer != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  241. cardSources: new List<CardSource>() { blueTamer },
  242. activateClass: activateClass,
  243. payCost: false,
  244. isTapped: false,
  245. root: SelectCardEffect.Root.Hand,
  246. activateETB: true
  247. ));
  248. }
  249. #endregion
  250. }
  251. #endregion
  252. }
  253. }
  254. #endregion
  255. #region When Attacking
  256. if (timing == EffectTiming.OnAllyAttack)
  257. {
  258. ActivateClass activateClass = new ActivateClass();
  259. activateClass.SetUpICardEffect("Unsuspend this digimon", CanUseCondition, card);
  260. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  261. activateClass.SetHashString("BT22_025_Unsuspend");
  262. cardEffects.Add(activateClass);
  263. string EffectDiscription()
  264. {
  265. return "[When Attacking] [Once Per Turn] This Digimon may unsuspend.";
  266. }
  267. bool CanUseCondition(Hashtable hashtable)
  268. {
  269. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  270. }
  271. bool CanActivateCondition(Hashtable hashtable)
  272. {
  273. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  274. && CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard());
  275. }
  276. IEnumerator ActivateCoroutine(Hashtable hashtable)
  277. {
  278. if (CardEffectCommons.CanUnsuspend(card.PermanentOfThisCard())) yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  279. }
  280. }
  281. #endregion
  282. return cardEffects;
  283. }
  284. }
  285. }