BT19_051.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_051 : 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 == 4 &&
  16. targetPermanent.TopCard.EqualsTraits("Xros Heart");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  19. digivolutionCost: 3, 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 [Ballistamon] 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("Ballistamon");
  38. }
  39. return cardNames;
  40. }
  41. }
  42. #endregion
  43. #region On Play/ When Digivolving Shared
  44. bool CanSelectPermanentConditionShared(Permanent permanent)
  45. {
  46. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  47. }
  48. bool CanActivateConditionShared(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  51. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared);
  52. }
  53. #endregion
  54. #region On Play
  55. if (timing == EffectTiming.OnEnterFieldAnyone)
  56. {
  57. ActivateClass activateClass = new ActivateClass();
  58. activateClass.SetUpICardEffect("1 of your Digimon can't be returned to the hand or deck and gets +3000 DP",
  59. CanUseCondition, card);
  60. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, 1, false, EffectDescription());
  61. cardEffects.Add(activateClass);
  62. string EffectDescription()
  63. {
  64. return
  65. "[On Play] 1 of your Digimon can't be returned to the hand or deck and gets +3000 DP until the end of your opponent's turn.";
  66. }
  67. bool CanUseCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable hashtable)
  72. {
  73. Permanent selectedPermanent = null;
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectPermanentConditionShared,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: 1,
  81. canNoSelect: false,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: SelectPermanentCoroutine,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectPermanentEffect.SetUpCustomMessage(
  88. "Select 1 Digimon that will get DP +3000 and can't be returned to the hand or deck.",
  89. "The opponent is selecting 1 Digimon that will get DP +3000 and can't be returned to the hand or deck.");
  90. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  91. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  92. {
  93. selectedPermanent = permanent;
  94. yield return null;
  95. }
  96. if (selectedPermanent != null)
  97. {
  98. bool CardEffectCondition(ICardEffect cardEffect)
  99. {
  100. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  101. }
  102. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToHand(
  103. targetPermanent: selectedPermanent,
  104. cardEffectCondition: CardEffectCondition,
  105. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  106. activateClass: activateClass,
  107. effectName: "Can't return to hand by opponent's effects"));
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToDeck(
  109. targetPermanent: selectedPermanent,
  110. cardEffectCondition: CardEffectCondition,
  111. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  112. activateClass: activateClass,
  113. effectName: "Can't return to deck by opponent's effects"));
  114. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  115. targetPermanent: selectedPermanent,
  116. changeValue: 3000,
  117. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  118. activateClass: activateClass));
  119. }
  120. }
  121. }
  122. #endregion
  123. #region When Digivolving
  124. if (timing == EffectTiming.OnEnterFieldAnyone)
  125. {
  126. ActivateClass activateClass = new ActivateClass();
  127. activateClass.SetUpICardEffect("1 of your Digimon can't be returned to the hand or deck and gets +3000 DP",
  128. CanUseCondition, card);
  129. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, 1, false, EffectDescription());
  130. cardEffects.Add(activateClass);
  131. string EffectDescription()
  132. {
  133. return
  134. "[When Digivolving] 1 of your Digimon can't be returned to the hand or deck and gets +3000 DP until the end of your opponent's turn.";
  135. }
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable hashtable)
  141. {
  142. Permanent selectedPermanent = null;
  143. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  144. selectPermanentEffect.SetUp(
  145. selectPlayer: card.Owner,
  146. canTargetCondition: CanSelectPermanentConditionShared,
  147. canTargetCondition_ByPreSelecetedList: null,
  148. canEndSelectCondition: null,
  149. maxCount: 1,
  150. canNoSelect: false,
  151. canEndNotMax: false,
  152. selectPermanentCoroutine: SelectPermanentCoroutine,
  153. afterSelectPermanentCoroutine: null,
  154. mode: SelectPermanentEffect.Mode.Custom,
  155. cardEffect: activateClass);
  156. selectPermanentEffect.SetUpCustomMessage(
  157. "Select 1 Digimon that will get DP +3000 and can't be returned to the hand or deck.",
  158. "The opponent is selecting 1 Digimon that will get DP +3000 and can't be returned to the hand or deck.");
  159. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  160. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  161. {
  162. selectedPermanent = permanent;
  163. yield return null;
  164. }
  165. if (selectedPermanent != null)
  166. {
  167. bool CardEffectCondition(ICardEffect cardEffect)
  168. {
  169. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  170. }
  171. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToHand(
  172. targetPermanent: selectedPermanent,
  173. cardEffectCondition: CardEffectCondition,
  174. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  175. activateClass: activateClass,
  176. effectName: "Can't return to hand by opponent's effects"));
  177. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotReturnToDeck(
  178. targetPermanent: selectedPermanent,
  179. cardEffectCondition: CardEffectCondition,
  180. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  181. activateClass: activateClass,
  182. effectName: "Can't return to deck by opponent's effects"));
  183. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  184. targetPermanent: selectedPermanent,
  185. changeValue: 3000,
  186. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  187. activateClass: activateClass));
  188. }
  189. }
  190. }
  191. #endregion
  192. #region On Deletion
  193. if (timing == EffectTiming.OnDestroyedAnyone)
  194. {
  195. ActivateClass activateClass = new ActivateClass();
  196. activateClass.SetUpICardEffect("Place 1 [Xros Heart]/[Blue Flare] card from trash under 1 of your Tamers, then <Save>",
  197. CanUseCondition,
  198. card);
  199. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  200. cardEffects.Add(activateClass);
  201. string EffectDescription()
  202. {
  203. return
  204. "[On Deletion] Place 1 Digimon card with the [Xros Heart]/[Blue Flare] trait from your hand or trash under your Tamers.";
  205. }
  206. bool CanUseCondition(Hashtable hashtable)
  207. {
  208. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  209. }
  210. bool IsOwnTamerCondition(Permanent permanent)
  211. {
  212. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  213. && permanent.IsTamer;
  214. }
  215. bool HasTraitCondition(CardSource cardSource)
  216. {
  217. return cardSource.IsDigimon && (cardSource.EqualsTraits("Xros Heart") || cardSource.EqualsTraits("Blue Flare"));
  218. }
  219. bool CanActivateCondition(Hashtable hashtable)
  220. {
  221. return CardEffectCommons.CanActivateOnDeletion(card, activateClass) &&
  222. CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsOwnTamerCondition) &&
  223. (CardEffectCommons.HasMatchConditionOwnersHand(card, HasTraitCondition) ||
  224. CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, HasTraitCondition));
  225. }
  226. IEnumerator ActivateCoroutine(Hashtable hashtable)
  227. {
  228. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, HasTraitCondition);
  229. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, HasTraitCondition);
  230. if (canSelectHand || canSelectTrash)
  231. {
  232. if (canSelectHand && canSelectTrash)
  233. {
  234. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>
  235. {
  236. new(message: "From hand", value: true, spriteIndex: 0),
  237. new(message: "From trash", value: false, spriteIndex: 1),
  238. };
  239. string selectPlayerMessage = "From which area do you play a card?";
  240. string notSelectPlayerMessage = "The opponent is choosing from which area to play a card.";
  241. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
  242. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  243. notSelectPlayerMessage: notSelectPlayerMessage);
  244. }
  245. else
  246. {
  247. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  248. }
  249. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  250. .WaitForEndSelect());
  251. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  252. List<CardSource> selectedCards = new List<CardSource>();
  253. IEnumerator SelectCardCoroutine(CardSource cardSource)
  254. {
  255. selectedCards.Add(cardSource);
  256. yield return null;
  257. }
  258. if (fromHand)
  259. {
  260. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  261. selectHandEffect.SetUp(
  262. selectPlayer: card.Owner,
  263. canTargetCondition: HasTraitCondition,
  264. canTargetCondition_ByPreSelecetedList: null,
  265. canEndSelectCondition: null,
  266. maxCount: 1,
  267. canNoSelect: false,
  268. canEndNotMax: false,
  269. isShowOpponent: true,
  270. selectCardCoroutine: SelectCardCoroutine,
  271. afterSelectCardCoroutine: null,
  272. mode: SelectHandEffect.Mode.Custom,
  273. cardEffect: activateClass);
  274. selectHandEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  275. "The opponent is selecting 1 card to play.");
  276. selectHandEffect.SetUpCustomMessage_ShowCard("Placed card");
  277. yield return StartCoroutine(selectHandEffect.Activate());
  278. }
  279. else
  280. {
  281. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  282. selectCardEffect.SetUp(
  283. canTargetCondition: HasTraitCondition,
  284. canTargetCondition_ByPreSelecetedList: null,
  285. canEndSelectCondition: null,
  286. canNoSelect: () => false,
  287. selectCardCoroutine: SelectCardCoroutine,
  288. afterSelectCardCoroutine: null,
  289. message: "Select 1 card to place under a tamer.",
  290. maxCount: 1,
  291. canEndNotMax: false,
  292. isShowOpponent: true,
  293. mode: SelectCardEffect.Mode.Custom,
  294. root: SelectCardEffect.Root.Trash,
  295. customRootCardList: null,
  296. canLookReverseCard: true,
  297. selectPlayer: card.Owner,
  298. cardEffect: activateClass);
  299. selectCardEffect.SetUpCustomMessage("Select 1 card to place under a tamer.",
  300. "The opponent is selecting 1 card to place under a tamer.");
  301. yield return StartCoroutine(selectCardEffect.Activate());
  302. }
  303. if (selectedCards.Count >= 1)
  304. {
  305. Permanent selectedPermanent = null;
  306. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  307. selectPermanentEffect.SetUp(
  308. selectPlayer: card.Owner,
  309. canTargetCondition: IsOwnTamerCondition,
  310. canTargetCondition_ByPreSelecetedList: null,
  311. canEndSelectCondition: null,
  312. maxCount: 1,
  313. canNoSelect: true,
  314. canEndNotMax: false,
  315. selectPermanentCoroutine: SelectPermanentCoroutine,
  316. afterSelectPermanentCoroutine: null,
  317. mode: SelectPermanentEffect.Mode.Custom,
  318. cardEffect: activateClass);
  319. selectPermanentEffect.SetUpCustomMessage("Select 1 Tamer to place the chosen card under.",
  320. "The opponent is selecting 1 Tamer to place the chosen card under.");
  321. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  322. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  323. {
  324. selectedPermanent = permanent;
  325. yield return null;
  326. }
  327. if (selectedPermanent != null)
  328. {
  329. yield return ContinuousController.instance.StartCoroutine(
  330. selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  331. }
  332. }
  333. }
  334. }
  335. }
  336. #endregion
  337. #region Opponents Turn - ESS
  338. if (timing == EffectTiming.None)
  339. {
  340. bool Condition()
  341. {
  342. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  343. CardEffectCommons.IsOpponentTurn(card) &&
  344. card.PermanentOfThisCard().TopCard.EqualsTraits("Xros Heart");
  345. }
  346. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: true, card: card, condition: Condition));
  347. }
  348. #endregion
  349. return cardEffects;
  350. }
  351. }
  352. }