BT19_061.cs 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_061 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3 &&
  16. targetPermanent.TopCard.EqualsTraits("Xros Heart");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  19. digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region DigiXros name
  23. if (timing == EffectTiming.None)
  24. {
  25. ChangeCardNamesForDigiXrosClass changeCardNamesForDigiXrosClass = new ChangeCardNamesForDigiXrosClass();
  26. changeCardNamesForDigiXrosClass.SetUpICardEffect("Also treated as [Sparrowmon] for a DigiXros", CanUseCondition, card);
  27. changeCardNamesForDigiXrosClass.SetUpChangeCardNamesForDigiXrosClass(changeCardNames: ChangeCardNames);
  28. cardEffects.Add(changeCardNamesForDigiXrosClass);
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return true;
  32. }
  33. List<string> ChangeCardNames(CardSource cardSource, List<string> cardNames)
  34. {
  35. if (cardSource == card)
  36. {
  37. cardNames.Add("Sparrowmon");
  38. }
  39. return cardNames;
  40. }
  41. }
  42. #endregion
  43. #region On Play/ When Digivolving Shared
  44. bool CanSelectCardConditionShared(CardSource cardSource)
  45. {
  46. return cardSource.EqualsTraits("Xros Heart") || cardSource.EqualsTraits("Blue Flare");
  47. }
  48. bool CanActivateConditionShared(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  51. card.Owner.LibraryCards.Count >= 1;
  52. }
  53. #endregion
  54. #region On Play
  55. if (timing == EffectTiming.OnEnterFieldAnyone)
  56. {
  57. ActivateClass activateClass = new ActivateClass();
  58. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  59. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  60. cardEffects.Add(activateClass);
  61. string EffectDescription()
  62. {
  63. return
  64. "[On Play] Reveal the top 3 cards of your deck. Add 1 card with the [Xros Heart]/[Blue Flare] trait among them to the hand. Trash the rest.";
  65. }
  66. bool CanUseCondition(Hashtable hashtable)
  67. {
  68. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable hashtable)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(
  73. CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  74. revealCount: 3,
  75. simplifiedSelectCardConditions:
  76. new SimplifiedSelectCardConditionClass[]
  77. {
  78. new(
  79. canTargetCondition: CanSelectCardConditionShared,
  80. message: "Select 1 Digimon card with the [Xros Heart]/[Blue Flare] in one of its traits.",
  81. mode: SelectCardEffect.Mode.AddHand,
  82. maxCount: 1,
  83. selectCardCoroutine: null)
  84. },
  85. remainingCardsPlace: RemainingCardsPlace.Trash,
  86. activateClass: activateClass
  87. ));
  88. }
  89. }
  90. #endregion
  91. #region When Digivolving
  92. if (timing == EffectTiming.OnEnterFieldAnyone)
  93. {
  94. ActivateClass activateClass = new ActivateClass();
  95. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  96. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  97. cardEffects.Add(activateClass);
  98. string EffectDescription()
  99. {
  100. return
  101. "[When Digivolving] Reveal the top 3 cards of your deck. Add 1 card with the [Xros Heart]/[Blue Flare] trait among them to the hand. Trash the rest.";
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  106. }
  107. IEnumerator ActivateCoroutine(Hashtable hashtable)
  108. {
  109. yield return ContinuousController.instance.StartCoroutine(
  110. CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  111. revealCount: 3,
  112. simplifiedSelectCardConditions:
  113. new SimplifiedSelectCardConditionClass[]
  114. {
  115. new(
  116. canTargetCondition: CanSelectCardConditionShared,
  117. message: "Select 1 Digimon card with the [Xros Heart]/[Blue Flare] in one of its traits.",
  118. mode: SelectCardEffect.Mode.AddHand,
  119. maxCount: 1,
  120. selectCardCoroutine: null)
  121. },
  122. remainingCardsPlace: RemainingCardsPlace.Trash,
  123. activateClass: activateClass
  124. ));
  125. }
  126. }
  127. #endregion
  128. #region On Deletion
  129. if (timing == EffectTiming.OnDestroyedAnyone)
  130. {
  131. ActivateClass activateClass = new ActivateClass();
  132. activateClass.SetUpICardEffect("Place 1 [Xros Heart]/[Blue Flare] card from trash under 1 of your Tamers, then <Save>",
  133. CanUseCondition,
  134. card);
  135. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  136. cardEffects.Add(activateClass);
  137. string EffectDescription()
  138. {
  139. return
  140. "[On Deletion] Place 1 Digimon card with the [Xros Heart]/[Blue Flare] trait from your hand or trash under your Tamers.";
  141. }
  142. bool CanUseCondition(Hashtable hashtable)
  143. {
  144. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  145. }
  146. bool IsOwnTamerCondition(Permanent permanent)
  147. {
  148. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  149. && permanent.IsTamer;
  150. }
  151. bool HasTraitCondition(CardSource cardSource)
  152. {
  153. return cardSource.IsDigimon && (cardSource.EqualsTraits("Xros Heart") || cardSource.EqualsTraits("Blue Flare"));
  154. }
  155. bool CanActivateCondition(Hashtable hashtable)
  156. {
  157. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  158. CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwnTamerCondition) &&
  159. (CardEffectCommons.HasMatchConditionOwnersHand(card, HasTraitCondition) ||
  160. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, HasTraitCondition));
  161. }
  162. IEnumerator ActivateCoroutine(Hashtable hashtable)
  163. {
  164. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, HasTraitCondition);
  165. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, HasTraitCondition);
  166. if (canSelectHand || canSelectTrash)
  167. {
  168. if (canSelectHand && canSelectTrash)
  169. {
  170. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>
  171. {
  172. new(message: "From hand", value: true, spriteIndex: 0),
  173. new(message: "From trash", value: false, spriteIndex: 1),
  174. };
  175. string selectPlayerMessage = "From which area do you play a card?";
  176. string notSelectPlayerMessage = "The opponent is choosing from which area to play a card.";
  177. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
  178. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  179. notSelectPlayerMessage: notSelectPlayerMessage);
  180. }
  181. else
  182. {
  183. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  184. }
  185. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  186. .WaitForEndSelect());
  187. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  188. List<CardSource> selectedCards = new List<CardSource>();
  189. IEnumerator SelectCardCoroutine(CardSource cardSource)
  190. {
  191. selectedCards.Add(cardSource);
  192. yield return null;
  193. }
  194. if (fromHand)
  195. {
  196. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  197. selectHandEffect.SetUp(
  198. selectPlayer: card.Owner,
  199. canTargetCondition: HasTraitCondition,
  200. canTargetCondition_ByPreSelecetedList: null,
  201. canEndSelectCondition: null,
  202. maxCount: 1,
  203. canNoSelect: false,
  204. canEndNotMax: false,
  205. isShowOpponent: true,
  206. selectCardCoroutine: SelectCardCoroutine,
  207. afterSelectCardCoroutine: null,
  208. mode: SelectHandEffect.Mode.Custom,
  209. cardEffect: activateClass);
  210. selectHandEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  211. "The opponent is selecting 1 card to play.");
  212. selectHandEffect.SetUpCustomMessage_ShowCard("Placed card");
  213. yield return StartCoroutine(selectHandEffect.Activate());
  214. }
  215. else
  216. {
  217. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  218. selectCardEffect.SetUp(
  219. canTargetCondition: HasTraitCondition,
  220. canTargetCondition_ByPreSelecetedList: null,
  221. canEndSelectCondition: null,
  222. canNoSelect: () => false,
  223. selectCardCoroutine: SelectCardCoroutine,
  224. afterSelectCardCoroutine: null,
  225. message: "Select 1 card to place under a tamer.",
  226. maxCount: 1,
  227. canEndNotMax: false,
  228. isShowOpponent: true,
  229. mode: SelectCardEffect.Mode.Custom,
  230. root: SelectCardEffect.Root.Trash,
  231. customRootCardList: null,
  232. canLookReverseCard: true,
  233. selectPlayer: card.Owner,
  234. cardEffect: activateClass);
  235. selectCardEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  236. "The opponent is selecting 1 card to place under a tamer.");
  237. yield return StartCoroutine(selectCardEffect.Activate());
  238. }
  239. if (selectedCards.Count >= 1)
  240. {
  241. Permanent selectedPermanent = null;
  242. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  243. selectPermanentEffect.SetUp(
  244. selectPlayer: card.Owner,
  245. canTargetCondition: IsOwnTamerCondition,
  246. canTargetCondition_ByPreSelecetedList: null,
  247. canEndSelectCondition: null,
  248. maxCount: 1,
  249. canNoSelect: true,
  250. canEndNotMax: false,
  251. selectPermanentCoroutine: SelectPermanentCoroutine,
  252. afterSelectPermanentCoroutine: null,
  253. mode: SelectPermanentEffect.Mode.Custom,
  254. cardEffect: activateClass);
  255. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen card under.",
  256. "The opponent is selecting 1 Tamer to place the chosen card under.");
  257. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  258. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  259. {
  260. selectedPermanent = permanent;
  261. yield return null;
  262. }
  263. if (selectedPermanent != null)
  264. {
  265. yield return ContinuousController.instance.StartCoroutine(
  266. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  267. }
  268. }
  269. }
  270. }
  271. }
  272. #endregion
  273. #region Your Turn - ESS
  274. if (timing == EffectTiming.OnCounterTiming)
  275. {
  276. bool Condition()
  277. {
  278. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.IsOwnerTurn(card) &&
  279. card.PermanentOfThisCard().TopCard.EqualsTraits("Xros Heart");
  280. }
  281. cardEffects.Add(CardEffectFactory.CollisionSelfStaticEffect(isInheritedEffect: true, card: card, condition: Condition));
  282. }
  283. #endregion
  284. return cardEffects;
  285. }
  286. }
  287. }