BT19_012.cs 20 KB

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