BT20_081.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT20
  6. {
  7. public class BT20_081 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region DNA Digivolution - [Fenriloogamon] + Yellow Lv.6 w/[Pulsemon] in text
  13. if (timing == EffectTiming.None)
  14. {
  15. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  16. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  17. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  18. addJogressConditionClass.SetNotShowUI(true);
  19. cardEffects.Add(addJogressConditionClass);
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return true;
  23. }
  24. JogressCondition GetJogress(CardSource cardSource)
  25. {
  26. if (cardSource == card)
  27. {
  28. bool PermanentCondition1(Permanent permanent)
  29. {
  30. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  31. {
  32. if (permanent.TopCard.EqualsCardName("Fenriloogamon"))
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. bool PermanentCondition2(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  42. {
  43. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  44. {
  45. if (permanent.Levels_ForJogress(card).Contains(6))
  46. {
  47. return permanent.TopCard.HasPulsemonText;
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. JogressConditionElement[] elements = new JogressConditionElement[]
  54. {
  55. new JogressConditionElement(PermanentCondition1, "a [Fenriloogamon]"),
  56. new JogressConditionElement(PermanentCondition2, "a Yellow Lv.6 w/[Pulsemon] in text"),
  57. };
  58. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  59. return jogressCondition;
  60. }
  61. return null;
  62. }
  63. }
  64. #endregion
  65. #region Blast DNA
  66. if (timing == EffectTiming.OnCounterTiming)
  67. {
  68. List<BlastDNACondition> blastDNAConditions = new List<BlastDNACondition>
  69. {
  70. new("Fenriloogamon"),
  71. new("Kazuchimon")
  72. };
  73. cardEffects.Add(CardEffectFactory.BlastDNADigivolveEffect(card: card,
  74. blastDNAConditions: blastDNAConditions, condition: null));
  75. }
  76. #endregion
  77. #region On Play/When Digivolving Shared
  78. bool IsOpponentsDigimon(Permanent permanent)
  79. {
  80. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  81. }
  82. bool IsTamerCard(CardSource source)
  83. {
  84. return source.IsTamer;
  85. }
  86. #endregion
  87. #region On Play
  88. if (timing == EffectTiming.OnEnterFieldAnyone)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect("2 Digimon get -10000DP, then delete 1 with 10000DP or less", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  93. cardEffects.Add(activateClass);
  94. string EffectDiscription()
  95. {
  96. return "[On Play] 2 of your opponent's Digimon get -10000 DP for the turn. then, if a Tamer card is in this Digimon's digivolution cards, delete 1 of your opponent's 10000 DP or lower Digimon.";
  97. }
  98. bool Is10KOrLess(Permanent permanent)
  99. {
  100. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  101. permanent.DP <= card.Owner.MaxDP_DeleteEffect(10000, activateClass);
  102. }
  103. bool CanUseCondition(Hashtable hashtable)
  104. {
  105. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  106. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  107. }
  108. bool CanActivateCondition(Hashtable hashtable)
  109. {
  110. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  111. CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon);
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable hashtable)
  114. {
  115. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  116. {
  117. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  118. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  119. selectPermanentEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: IsOpponentsDigimon,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: maxCount,
  125. canNoSelect: false,
  126. canEndNotMax: false,
  127. selectPermanentCoroutine: SelectPermanentCoroutine,
  128. afterSelectPermanentCoroutine: null,
  129. mode: SelectPermanentEffect.Mode.Custom,
  130. cardEffect: activateClass);
  131. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon that will get DP -10000.", "The opponent is selecting 2 Digimon that will get DP -10000.");
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  136. targetPermanent: permanent,
  137. changeValue: -10000,
  138. effectDuration: EffectDuration.UntilEachTurnEnd,
  139. activateClass: activateClass));
  140. }
  141. }
  142. if (card.PermanentOfThisCard().DigivolutionCards.Count(IsTamerCard) > 0)
  143. {
  144. if (CardEffectCommons.HasMatchConditionPermanent(Is10KOrLess))
  145. {
  146. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  147. selectPermanentEffect.SetUp(
  148. selectPlayer: card.Owner,
  149. canTargetCondition: Is10KOrLess,
  150. canTargetCondition_ByPreSelecetedList: null,
  151. canEndSelectCondition: null,
  152. maxCount: 1,
  153. canNoSelect: false,
  154. canEndNotMax: false,
  155. selectPermanentCoroutine: null,
  156. afterSelectPermanentCoroutine: null,
  157. mode: SelectPermanentEffect.Mode.Destroy,
  158. cardEffect: activateClass);
  159. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  160. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  161. }
  162. }
  163. }
  164. }
  165. #endregion
  166. #region When Digivolving
  167. if (timing == EffectTiming.OnEnterFieldAnyone)
  168. {
  169. ActivateClass activateClass = new ActivateClass();
  170. activateClass.SetUpICardEffect("2 Digimon get -10000DP, then delete 1 with 10000DP or less", CanUseCondition, card);
  171. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  172. cardEffects.Add(activateClass);
  173. string EffectDiscription()
  174. {
  175. return "[When Digivolving] 2 of your opponent's Digimon get -10000 DP for the turn. then, if a Tamer card is in this Digimon's digivolution cards, delete 1 of your opponent's 10000 DP or lower Digimon.";
  176. }
  177. bool Is10KOrLess(Permanent permanent)
  178. {
  179. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  180. permanent.DP <= card.Owner.MaxDP_DeleteEffect(10000, activateClass);
  181. }
  182. bool CanUseCondition(Hashtable hashtable)
  183. {
  184. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  185. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  186. }
  187. bool CanActivateCondition(Hashtable hashtable)
  188. {
  189. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  190. CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon);
  191. }
  192. IEnumerator ActivateCoroutine(Hashtable hashtable)
  193. {
  194. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  195. {
  196. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  197. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  198. selectPermanentEffect.SetUp(
  199. selectPlayer: card.Owner,
  200. canTargetCondition: IsOpponentsDigimon,
  201. canTargetCondition_ByPreSelecetedList: null,
  202. canEndSelectCondition: null,
  203. maxCount: maxCount,
  204. canNoSelect: false,
  205. canEndNotMax: false,
  206. selectPermanentCoroutine: SelectPermanentCoroutine,
  207. afterSelectPermanentCoroutine: null,
  208. mode: SelectPermanentEffect.Mode.Custom,
  209. cardEffect: activateClass);
  210. selectPermanentEffect.SetUpCustomMessage("Select 2 Digimon that will get DP -10000.", "The opponent is selecting 2 Digimon that will get DP -10000.");
  211. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  212. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  213. {
  214. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  215. targetPermanent: permanent,
  216. changeValue: -10000,
  217. effectDuration: EffectDuration.UntilEachTurnEnd,
  218. activateClass: activateClass));
  219. }
  220. }
  221. if (card.PermanentOfThisCard().DigivolutionCards.Count(IsTamerCard) > 0)
  222. {
  223. if (CardEffectCommons.HasMatchConditionPermanent(Is10KOrLess))
  224. {
  225. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  226. selectPermanentEffect.SetUp(
  227. selectPlayer: card.Owner,
  228. canTargetCondition: Is10KOrLess,
  229. canTargetCondition_ByPreSelecetedList: null,
  230. canEndSelectCondition: null,
  231. maxCount: 1,
  232. canNoSelect: false,
  233. canEndNotMax: false,
  234. selectPermanentCoroutine: null,
  235. afterSelectPermanentCoroutine: null,
  236. mode: SelectPermanentEffect.Mode.Destroy,
  237. cardEffect: activateClass);
  238. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  239. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  240. }
  241. }
  242. }
  243. }
  244. #endregion
  245. #region When Attacking
  246. if (timing == EffectTiming.OnAllyAttack)
  247. {
  248. ActivateClass activateClass = new ActivateClass();
  249. activateClass.SetUpICardEffect("Activate 1 of this Digimon's [When Digivolving] effects", CanUseCondition, card);
  250. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  251. cardEffects.Add(activateClass);
  252. string EffectDiscription()
  253. {
  254. return "[When Attacking] By trashing your top security card, activate 1 of this Digimon's [When Digivolving] effects.";
  255. }
  256. bool CanUseCondition(Hashtable hashtable)
  257. {
  258. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  259. }
  260. bool CanActivateCondition(Hashtable hashtable)
  261. {
  262. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  263. card.Owner.SecurityCards.Count > 0;
  264. }
  265. IEnumerator ActivateCoroutine(Hashtable hashtable)
  266. {
  267. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  268. player: card.Owner,
  269. destroySecurityCount: 1,
  270. cardEffect: activateClass,
  271. fromTop: true).DestroySecurity());
  272. List<ICardEffect> candidateEffects = card.PermanentOfThisCard().EffectList(EffectTiming.OnEnterFieldAnyone)
  273. .Clone()
  274. .Filter(cardEffect => cardEffect != null && cardEffect is ActivateICardEffect && !cardEffect.IsSecurityEffect && cardEffect.IsWhenDigivolving);
  275. if (candidateEffects.Count >= 1)
  276. {
  277. ICardEffect selectedEffect = null;
  278. if (candidateEffects.Count == 1)
  279. {
  280. selectedEffect = candidateEffects[0];
  281. }
  282. else
  283. {
  284. List<SkillInfo> skillInfos = candidateEffects
  285. .Map(cardEffect => new SkillInfo(cardEffect, null, EffectTiming.None));
  286. List<CardSource> cardSources = candidateEffects
  287. .Map(cardEffect => cardEffect.EffectSourceCard);
  288. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  289. selectCardEffect.SetUp(
  290. canTargetCondition: (cardSource) => true,
  291. canTargetCondition_ByPreSelecetedList: null,
  292. canEndSelectCondition: null,
  293. canNoSelect: () => false,
  294. selectCardCoroutine: null,
  295. afterSelectCardCoroutine: null,
  296. message: "Select 1 effect to activate.",
  297. maxCount: 1,
  298. canEndNotMax: false,
  299. isShowOpponent: false,
  300. mode: SelectCardEffect.Mode.Custom,
  301. root: SelectCardEffect.Root.Custom,
  302. customRootCardList: cardSources,
  303. canLookReverseCard: true,
  304. selectPlayer: card.Owner,
  305. cardEffect: activateClass);
  306. selectCardEffect.SetNotShowCard();
  307. selectCardEffect.SetUpSkillInfos(skillInfos);
  308. selectCardEffect.SetUpAfterSelectIndexCoroutine(AfterSelectIndexCoroutine);
  309. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  310. IEnumerator AfterSelectIndexCoroutine(List<int> selectedIndexes)
  311. {
  312. if (selectedIndexes.Count == 1)
  313. {
  314. selectedEffect = candidateEffects[selectedIndexes[0]];
  315. yield return null;
  316. }
  317. }
  318. }
  319. if (selectedEffect != null)
  320. {
  321. Hashtable effectHashtable = CardEffectCommons.WhenDigivolvingCheckHashtableOfCard(selectedEffect.EffectSourceCard);
  322. if (!selectedEffect.IsDisabled)
  323. {
  324. yield return ContinuousController.instance.StartCoroutine(
  325. ((ActivateICardEffect)selectedEffect).Activate_Optional_Effect_Execute(effectHashtable));
  326. }
  327. }
  328. }
  329. }
  330. }
  331. #endregion
  332. return cardEffects;
  333. }
  334. }
  335. }