BT19_102.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT19
  5. {
  6. public class BT19_102 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsCardName("Luminamon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: true, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.None)
  21. {
  22. bool PermanentCondition(Permanent targetPermanent)
  23. {
  24. return targetPermanent.TopCard.EqualsCardName("Nene Amano") &&
  25. targetPermanent.DigivolutionCards.Count(source => source.EqualsCardName("Shademon")) > 0;
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: true, card: card, condition: null));
  28. }
  29. #endregion
  30. #region DigiXros
  31. if (timing == EffectTiming.None)
  32. {
  33. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  34. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros", CanUseCondition, card);
  35. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  36. addDigiXrosConditionClass.SetNotShowUI(true);
  37. cardEffects.Add(addDigiXrosConditionClass);
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return true;
  41. }
  42. DigiXrosCondition GetDigiXros(CardSource cardSource)
  43. {
  44. if (cardSource == card)
  45. {
  46. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition, "Nene Amano");
  47. DigiXrosConditionElement element1 = new DigiXrosConditionElement(CanSelectCardCondition1, "Luminamon/Shademon");
  48. bool CanSelectCardCondition(CardSource cardSource)
  49. {
  50. if (cardSource != null)
  51. {
  52. if (cardSource.Owner == card.Owner)
  53. {
  54. if (cardSource.EqualsCardNameDigiXros("Nene Amano"))
  55. {
  56. return true;
  57. }
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanSelectCardCondition1(CardSource cardSource)
  63. {
  64. if (cardSource != null)
  65. {
  66. if (cardSource.Owner == card.Owner)
  67. {
  68. if (cardSource.EqualsCardNameDigiXros("Luminamon") || cardSource.EqualsCardNameDigiXros("Shademon"))
  69. {
  70. return true;
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element1 };
  77. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 1);
  78. return digiXrosCondition;
  79. }
  80. return null;
  81. }
  82. }
  83. #endregion
  84. #region On Play
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect("Play level 4 from source, delete target Digimon", CanUseCondition, card);
  89. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  90. cardEffects.Add(activateClass);
  91. string EffectDescription()
  92. {
  93. return "[On Play] Choose 1 other Digimon. By playing level 4 or lower Digimon card from it's digivolution cards, delete the chosen Digimon.";
  94. }
  95. bool CanSelectDigimon(Permanent permanent)
  96. {
  97. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) &&
  98. permanent != card.PermanentOfThisCard() &&
  99. permanent.DigivolutionCards.Count(CanSelectDigimonToPlay) > 0;
  100. }
  101. bool CanSelectDigimonToPlay(CardSource cardSource)
  102. {
  103. if (cardSource.IsDigimon)
  104. {
  105. if (cardSource.HasLevel && cardSource.Level <= 4)
  106. {
  107. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  108. {
  109. return true;
  110. }
  111. }
  112. }
  113. return false;
  114. }
  115. bool CanUseCondition(Hashtable hashtable)
  116. {
  117. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  118. }
  119. bool CanActivateCondition(Hashtable hashtable)
  120. {
  121. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  122. CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimon);
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. Permanent selectedPermanent = null;
  127. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  128. selectPermanentEffect.SetUp(
  129. selectPlayer: card.Owner,
  130. canTargetCondition: CanSelectDigimon,
  131. canTargetCondition_ByPreSelecetedList: null,
  132. canEndSelectCondition: null,
  133. maxCount: 1,
  134. canNoSelect: true,
  135. canEndNotMax: false,
  136. selectPermanentCoroutine: SelectPermanentCoroutine,
  137. afterSelectPermanentCoroutine: null,
  138. mode: SelectPermanentEffect.Mode.Custom,
  139. cardEffect: activateClass);
  140. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon to play source from.", "The opponent is selecting 1 Digimon to play source from.");
  141. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  142. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  143. {
  144. selectedPermanent = permanent;
  145. yield return null;
  146. }
  147. if (selectedPermanent != null)
  148. {
  149. List<CardSource> selectedCards = new List<CardSource>();
  150. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  151. selectCardEffect.SetUp(
  152. canTargetCondition: CanSelectDigimonToPlay,
  153. canTargetCondition_ByPreSelecetedList: null,
  154. canEndSelectCondition: null,
  155. canNoSelect: () => true,
  156. selectCardCoroutine: SelectCardCoroutine,
  157. afterSelectCardCoroutine: null,
  158. message: "Select 1 digivolution card to play.",
  159. maxCount: 1,
  160. canEndNotMax: false,
  161. isShowOpponent: true,
  162. mode: SelectCardEffect.Mode.Custom,
  163. root: SelectCardEffect.Root.Custom,
  164. customRootCardList: selectedPermanent.DigivolutionCards,
  165. canLookReverseCard: true,
  166. selectPlayer: card.Owner,
  167. cardEffect: activateClass);
  168. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  169. yield return StartCoroutine(selectCardEffect.Activate());
  170. IEnumerator SelectCardCoroutine(CardSource cardSource)
  171. {
  172. selectedCards.Add(cardSource);
  173. yield return null;
  174. }
  175. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  176. Hashtable hash = new Hashtable();
  177. hashtable.Add("CardEffect", activateClass);
  178. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent> { selectedPermanent }, hash).Destroy());
  179. }
  180. }
  181. }
  182. #endregion
  183. #region When Digivolving
  184. if (timing == EffectTiming.OnEnterFieldAnyone)
  185. {
  186. ActivateClass activateClass = new ActivateClass();
  187. activateClass.SetUpICardEffect("Play level 4 from source, delete target Digimon", CanUseCondition, card);
  188. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  189. cardEffects.Add(activateClass);
  190. string EffectDescription()
  191. {
  192. return "[When Digivolving] Choose 1 other Digimon. By playing level 4 or lower Digimon card from it's digivolution cards, delete the chosen Digimon.";
  193. }
  194. bool CanSelectDigimon(Permanent permanent)
  195. {
  196. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent) &&
  197. permanent != card.PermanentOfThisCard() &&
  198. permanent.DigivolutionCards.Count(CanSelectDigimonToPlay) > 0;
  199. }
  200. bool CanSelectDigimonToPlay(CardSource cardSource)
  201. {
  202. if (cardSource.IsDigimon)
  203. {
  204. if (cardSource.HasLevel && cardSource.Level <= 4)
  205. {
  206. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  207. {
  208. return true;
  209. }
  210. }
  211. }
  212. return false;
  213. }
  214. bool CanUseCondition(Hashtable hashtable)
  215. {
  216. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  217. }
  218. bool CanActivateCondition(Hashtable hashtable)
  219. {
  220. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  221. CardEffectCommons.HasMatchConditionPermanent(CanSelectDigimon);
  222. }
  223. IEnumerator ActivateCoroutine(Hashtable hashtable)
  224. {
  225. Permanent selectedPermanent = null;
  226. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  227. selectPermanentEffect.SetUp(
  228. selectPlayer: card.Owner,
  229. canTargetCondition: CanSelectDigimon,
  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 Digimon to play source from.", "The opponent is selecting 1 Digimon to play source from.");
  240. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  241. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  242. {
  243. selectedPermanent = permanent;
  244. yield return null;
  245. }
  246. if (selectedPermanent != null)
  247. {
  248. List<CardSource> selectedCards = new List<CardSource>();
  249. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  250. selectCardEffect.SetUp(
  251. canTargetCondition: CanSelectDigimonToPlay,
  252. canTargetCondition_ByPreSelecetedList: null,
  253. canEndSelectCondition: null,
  254. canNoSelect: () => true,
  255. selectCardCoroutine: SelectCardCoroutine,
  256. afterSelectCardCoroutine: null,
  257. message: "Select 1 digivolution card to play.",
  258. maxCount: 1,
  259. canEndNotMax: false,
  260. isShowOpponent: true,
  261. mode: SelectCardEffect.Mode.Custom,
  262. root: SelectCardEffect.Root.Custom,
  263. customRootCardList: selectedPermanent.DigivolutionCards,
  264. canLookReverseCard: true,
  265. selectPlayer: card.Owner,
  266. cardEffect: activateClass);
  267. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  268. yield return StartCoroutine(selectCardEffect.Activate());
  269. IEnumerator SelectCardCoroutine(CardSource cardSource)
  270. {
  271. selectedCards.Add(cardSource);
  272. yield return null;
  273. }
  274. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  275. Hashtable hash = new Hashtable();
  276. hashtable.Add("CardEffect", activateClass);
  277. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(new List<Permanent> { selectedPermanent }, hash).Destroy());
  278. }
  279. }
  280. }
  281. #endregion
  282. #region On Deletion
  283. if (timing == EffectTiming.OnDestroyedAnyone)
  284. {
  285. ActivateClass activateClass = new ActivateClass();
  286. activateClass.SetUpICardEffect($"Play 1 card from under Tamer.", CanUseCondition, card);
  287. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  288. cardEffects.Add(activateClass);
  289. string EffectDiscription()
  290. {
  291. return "[On Deletion] You may play 1 card with a play cost of 5 or less from under any of your Tamers without paying the cost.";
  292. }
  293. bool CanSelectCardCondition(CardSource cardSource)
  294. {
  295. if (cardSource != null)
  296. {
  297. if (cardSource.Owner == card.Owner)
  298. {
  299. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  300. {
  301. if (cardSource.GetCostItself <= 5)
  302. {
  303. return true;
  304. }
  305. }
  306. }
  307. }
  308. return false;
  309. }
  310. bool CanSelectTamerCondition(Permanent permanent)
  311. {
  312. return permanent.TopCard.Owner == card.Owner &&
  313. permanent.IsTamer &&
  314. permanent.DigivolutionCards.Count(CanSelectCardCondition) > 0;
  315. }
  316. bool CanUseCondition(Hashtable hashtable)
  317. {
  318. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card);
  319. }
  320. bool CanActivateCondition(Hashtable hashtable)
  321. {
  322. return CardEffectCommons.CanActivateOnDeletion(card) &&
  323. CardEffectCommons.HasMatchConditionPermanent(CanSelectTamerCondition);
  324. }
  325. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  326. {
  327. Permanent selectedPermanent = null;
  328. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  329. selectPermanentEffect.SetUp(
  330. selectPlayer: card.Owner,
  331. canTargetCondition: CanSelectTamerCondition,
  332. canTargetCondition_ByPreSelecetedList: null,
  333. canEndSelectCondition: null,
  334. maxCount: 1,
  335. canNoSelect: true,
  336. canEndNotMax: false,
  337. selectPermanentCoroutine: SelectPermanentCoroutine,
  338. afterSelectPermanentCoroutine: null,
  339. mode: SelectPermanentEffect.Mode.Custom,
  340. cardEffect: activateClass);
  341. selectPermanentEffect.SetUpCustomMessage($"Select 1 tamer to play source from.", "The opponent is selecting 1 tamer to play source from.");
  342. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  343. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  344. {
  345. selectedPermanent = permanent;
  346. yield return null;
  347. }
  348. if (selectedPermanent != null)
  349. {
  350. List<CardSource> selectedCards = new List<CardSource>();
  351. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  352. selectCardEffect.SetUp(
  353. canTargetCondition: CanSelectCardCondition,
  354. canTargetCondition_ByPreSelecetedList: null,
  355. canEndSelectCondition: null,
  356. canNoSelect: () => true,
  357. selectCardCoroutine: SelectCardCoroutine,
  358. afterSelectCardCoroutine: null,
  359. message: "Select 1 digivolution card to play.",
  360. maxCount: 1,
  361. canEndNotMax: false,
  362. isShowOpponent: true,
  363. mode: SelectCardEffect.Mode.Custom,
  364. root: SelectCardEffect.Root.Custom,
  365. customRootCardList: selectedPermanent.DigivolutionCards,
  366. canLookReverseCard: true,
  367. selectPlayer: card.Owner,
  368. cardEffect: activateClass);
  369. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  370. yield return StartCoroutine(selectCardEffect.Activate());
  371. IEnumerator SelectCardCoroutine(CardSource cardSource)
  372. {
  373. selectedCards.Add(cardSource);
  374. yield return null;
  375. }
  376. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  377. }
  378. }
  379. }
  380. #endregion
  381. return cardEffects;
  382. }
  383. }
  384. }