BT21_027.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. //Shoutmon DX
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_027 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Static Effects
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. if (targetPermanent.TopCard.EqualsCardName("ZeigGreymon"))
  19. {
  20. return true;
  21. }
  22. return false;
  23. }
  24. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  25. permanentCondition: PermanentCondition,
  26. digivolutionCost: 2,
  27. ignoreDigivolutionRequirement: false,
  28. card: card,
  29. condition: null)
  30. );
  31. }
  32. if (timing == EffectTiming.None)
  33. {
  34. bool PermanentCondition(Permanent targetPermanent)
  35. {
  36. if (targetPermanent.TopCard.Level == 5 && targetPermanent.TopCard.EqualsTraits("Xros Heart"))
  37. {
  38. return true;
  39. }
  40. return false;
  41. }
  42. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  43. permanentCondition: PermanentCondition,
  44. digivolutionCost: 3,
  45. ignoreDigivolutionRequirement: false,
  46. card: card,
  47. condition: null)
  48. );
  49. }
  50. #endregion
  51. #region DigiXros
  52. if (timing == EffectTiming.None)
  53. {
  54. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  55. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros -3", CanUseCondition, card);
  56. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  57. addDigiXrosConditionClass.SetNotShowUI(true);
  58. cardEffects.Add(addDigiXrosConditionClass);
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return true;
  62. }
  63. DigiXrosCondition GetDigiXros(CardSource cardSource)
  64. {
  65. if (cardSource == card)
  66. {
  67. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition1, "[OmniShoutmon]");
  68. bool CanSelectCardCondition1(CardSource cardSource)
  69. {
  70. if (cardSource != null)
  71. {
  72. if (cardSource.Owner == card.Owner)
  73. {
  74. if (cardSource.IsDigimon)
  75. {
  76. if (cardSource.EqualsCardName("OmniShoutmon"))
  77. {
  78. return true;
  79. }
  80. }
  81. }
  82. }
  83. return false;
  84. }
  85. DigiXrosConditionElement element2 = new DigiXrosConditionElement(CanSelectCardCondition2, "[ZeigGreymon]");
  86. bool CanSelectCardCondition2(CardSource cardSource)
  87. {
  88. if (cardSource != null)
  89. {
  90. if (cardSource.Owner == card.Owner)
  91. {
  92. if (cardSource.IsDigimon)
  93. {
  94. if (cardSource.EqualsCardName("ZeigGreymon"))
  95. {
  96. return true;
  97. }
  98. }
  99. }
  100. }
  101. return false;
  102. }
  103. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element, element2 };
  104. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 3);
  105. return digiXrosCondition;
  106. }
  107. return null;
  108. }
  109. }
  110. #endregion
  111. #region DigiXros Name
  112. if (timing == EffectTiming.None)
  113. {
  114. ChangeCardNamesForDigiXrosClass changeCardNamesForDigiXrosClass = new ChangeCardNamesForDigiXrosClass();
  115. changeCardNamesForDigiXrosClass.SetUpICardEffect("Also treated as [Shoutmon]/[ZeigGreymon] for a DigiXros", CanUseCondition, card);
  116. changeCardNamesForDigiXrosClass.SetUpChangeCardNamesForDigiXrosClass(changeCardNames: ChangeCardNames);
  117. cardEffects.Add(changeCardNamesForDigiXrosClass);
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. return true;
  121. }
  122. List<string> ChangeCardNames(CardSource cardSource, List<string> cardNames)
  123. {
  124. if (cardSource == card)
  125. {
  126. cardNames.Add("Shoutmon");
  127. cardNames.Add("ZeigGreymon");
  128. }
  129. return cardNames;
  130. }
  131. }
  132. #endregion
  133. #region Sec +1
  134. if (timing == EffectTiming.None)
  135. {
  136. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(
  137. changeValue: 1,
  138. isInheritedEffect: false,
  139. card: card,
  140. condition: null));
  141. }
  142. #endregion
  143. #endregion
  144. #region On Play / When Digivolving Shared
  145. bool SharedPermanentCondition(Permanent permanent)
  146. {
  147. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  148. {
  149. if (CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy))
  150. {
  151. return true;
  152. }
  153. }
  154. return false;
  155. }
  156. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  157. {
  158. if (CardEffectCommons.HasMatchConditionPermanent(SharedPermanentCondition))
  159. {
  160. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(SharedPermanentCondition));
  161. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  162. selectPermanentEffect.SetUp(
  163. selectPlayer: card.Owner,
  164. canTargetCondition: SharedPermanentCondition,
  165. canTargetCondition_ByPreSelecetedList: null,
  166. canEndSelectCondition: null,
  167. maxCount: maxCount,
  168. canNoSelect: false,
  169. canEndNotMax: false,
  170. selectPermanentCoroutine: null,
  171. afterSelectPermanentCoroutine: null,
  172. mode: SelectPermanentEffect.Mode.Destroy,
  173. cardEffect: activateClass);
  174. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  175. }
  176. }
  177. #endregion
  178. #region On Play
  179. if (timing == EffectTiming.OnEnterFieldAnyone)
  180. {
  181. ActivateClass activateClass = new ActivateClass();
  182. activateClass.SetUpICardEffect("Destroy lowest DP digimon", CanUseCondition, card);
  183. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  184. cardEffects.Add(activateClass);
  185. string EffectDiscription()
  186. {
  187. return "[On Play] Delete 1 of your opponent's lowest DP Digimon.";
  188. }
  189. bool CanUseCondition(Hashtable hashtable)
  190. {
  191. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  192. {
  193. if (CardEffectCommons.CanTriggerOnPlay(hashtable, card))
  194. {
  195. return true;
  196. }
  197. }
  198. return false;
  199. }
  200. bool CanActivateCondition(Hashtable hashtable)
  201. {
  202. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  203. {
  204. if (CardEffectCommons.HasMatchConditionPermanent(SharedPermanentCondition))
  205. {
  206. return true;
  207. }
  208. }
  209. return false;
  210. }
  211. }
  212. #endregion
  213. #region When Digivolving
  214. if (timing == EffectTiming.OnEnterFieldAnyone)
  215. {
  216. ActivateClass activateClass = new ActivateClass();
  217. activateClass.SetUpICardEffect("Destroy lowest DP digimon", CanUseCondition, card);
  218. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, EffectDiscription());
  219. cardEffects.Add(activateClass);
  220. string EffectDiscription()
  221. {
  222. return "[When Digivolving] Delete 1 of your opponent's lowest DP Digimon.";
  223. }
  224. bool CanUseCondition(Hashtable hashtable)
  225. {
  226. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  227. {
  228. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  229. {
  230. return true;
  231. }
  232. }
  233. return false;
  234. }
  235. bool CanActivateCondition(Hashtable hashtable)
  236. {
  237. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  238. {
  239. if (CardEffectCommons.HasMatchConditionPermanent(SharedPermanentCondition))
  240. {
  241. return true;
  242. }
  243. }
  244. return false;
  245. }
  246. }
  247. #endregion
  248. #region All Turns
  249. if (timing == EffectTiming.WhenRemoveField)
  250. {
  251. ActivateClass activateClass = new ActivateClass();
  252. activateClass.SetUpICardEffect("Place up to 4 [Xros Heart]/[Blue Flare] under tamer", CanUseCondition, card);
  253. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  254. cardEffects.Add(activateClass);
  255. string EffectDiscription()
  256. {
  257. return "[All Turns] When this Digimon would leave the battle area, you may place up to 4 [Xros Heart]/[Blue Flare] trait Digimon cards from its digivolution cards under 1 of your Tamers.";
  258. }
  259. bool CanUseCondition(Hashtable hashtable)
  260. {
  261. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  262. {
  263. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  264. {
  265. return true;
  266. }
  267. }
  268. return false;
  269. }
  270. bool CanActivateCondition(Hashtable hashtable)
  271. {
  272. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  273. {
  274. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamer))
  275. {
  276. if (card.PermanentOfThisCard().DigivolutionCards.Filter(x => CanSelectSources(x)) != null)
  277. {
  278. return true;
  279. }
  280. }
  281. }
  282. return false;
  283. }
  284. bool CanSelectTamer(Permanent permanent)
  285. {
  286. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  287. {
  288. if (permanent.IsTamer)
  289. {
  290. return true;
  291. }
  292. }
  293. return false;
  294. }
  295. bool CanSelectSources(CardSource source)
  296. {
  297. if (source.IsDigimon)
  298. {
  299. if (source.EqualsTraits("Xros Heart") || source.EqualsTraits("Blue Flare"))
  300. {
  301. return true;
  302. }
  303. }
  304. return false;
  305. }
  306. IEnumerator ActivateCoroutine(Hashtable hashtable)
  307. {
  308. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTamer) && card.PermanentOfThisCard().DigivolutionCards.Filter(x => CanSelectSources(x)) != null)
  309. {
  310. List<CardSource> selectedCards = new List<CardSource>();
  311. int maxCount = Math.Min(4, card.PermanentOfThisCard().DigivolutionCards.Filter(x => CanSelectSources(x)).Count);
  312. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  313. selectCardEffect.SetUp(
  314. canTargetCondition: CanSelectSources,
  315. canTargetCondition_ByPreSelecetedList: null,
  316. canEndSelectCondition: null,
  317. canNoSelect: () => true,
  318. selectCardCoroutine: SelectCardCoroutine,
  319. afterSelectCardCoroutine: null,
  320. message: "Select up to 4 sources to save.",
  321. maxCount: maxCount,
  322. canEndNotMax: true,
  323. isShowOpponent: true,
  324. mode: SelectCardEffect.Mode.Custom,
  325. root: SelectCardEffect.Root.Custom,
  326. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  327. canLookReverseCard: true,
  328. selectPlayer: card.Owner,
  329. cardEffect: activateClass
  330. );
  331. selectCardEffect.SetUpCustomMessage("Select sources to save.", "The opponent is selecting sources to save.");
  332. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Card/Cards");
  333. yield return StartCoroutine(selectCardEffect.Activate());
  334. IEnumerator SelectCardCoroutine(CardSource source)
  335. {
  336. selectedCards.Add(source);
  337. yield return null;
  338. }
  339. if (selectedCards.Count > 0)
  340. {
  341. Permanent permanent = null;
  342. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, CanSelectTamer));
  343. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  344. selectPermanentEffect.SetUp(
  345. selectPlayer: card.Owner,
  346. canTargetCondition: CanSelectTamer,
  347. canTargetCondition_ByPreSelecetedList: null,
  348. canEndSelectCondition: null,
  349. maxCount: maxCount1,
  350. canNoSelect: false,
  351. canEndNotMax: false,
  352. selectPermanentCoroutine: SekectPermanentCoroutine,
  353. afterSelectPermanentCoroutine: null,
  354. mode: SelectPermanentEffect.Mode.Custom,
  355. cardEffect: activateClass);
  356. selectPermanentEffect.SetUpCustomMessage("Select 1 tamer to place the selected sources under.", "The opponent is selecting 1 tamer to place the selected sources under.");
  357. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  358. IEnumerator SekectPermanentCoroutine(Permanent selectedPermanent)
  359. {
  360. permanent = selectedPermanent;
  361. yield return null;
  362. }
  363. if (permanent != null)
  364. {
  365. yield return ContinuousController.instance.StartCoroutine(permanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  366. }
  367. }
  368. }
  369. yield return null;
  370. }
  371. }
  372. #endregion
  373. return cardEffects;
  374. }
  375. }
  376. }