BT21_066.cs 19 KB

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