BT19_035.cs 19 KB

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