EX7_058.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX7
  6. {
  7. public class EX7_058 : 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 PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("LadyDevimon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Shared On Play/When Digivolving
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanActivateSecondEffectCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  30. {
  31. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("LadyDevimon") || cardSource.CardNames.Contains("X Antibody") || cardSource.CardNames.Contains("XAntibody")) >= 1)
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. #endregion
  39. #region On Play
  40. if (timing == EffectTiming.OnEnterFieldAnyone)
  41. {
  42. ActivateClass activateClass = new ActivateClass();
  43. activateClass.SetUpICardEffect("Give effects to opponent's Digimon and play a Token", CanUseCondition, card);
  44. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  45. cardEffects.Add(activateClass);
  46. string EffectDiscription()
  47. {
  48. return "[On Play] 1 of your opponent's Digimon gains \"[End of Attack] Delete this Digimon.\" until the end of their turn. Then, if this Digimon has [LadyDevimon]/[X Antibody] in its digivolution cards, you may play 1 [Volée & Zerdrücken] Token (Digimon/Lv.4/Purple/5000 DP/<Blocker>/<Retaliation>).";
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  53. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  54. return false;
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable hashtable)
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  65. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  66. selectPermanentEffect.SetUp(
  67. selectPlayer: card.Owner,
  68. canTargetCondition: CanSelectPermanentCondition,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. maxCount: maxCount,
  72. canNoSelect: false,
  73. canEndNotMax: false,
  74. selectPermanentCoroutine: SelectPermanentCoroutine,
  75. afterSelectPermanentCoroutine: null,
  76. mode: SelectPermanentEffect.Mode.Custom,
  77. cardEffect: activateClass);
  78. selectPermanentEffect.SetUpCustomMessage(
  79. "Select 1 Digimon that will get [End of Attack] Delete this Digimon.",
  80. "The opponent is selecting 1 Digimon that will get [End of Attack] Delete this Digimon.");
  81. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  82. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  83. {
  84. if (permanent != null)
  85. {
  86. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  87. ActivateClass activateClass1 = new ActivateClass();
  88. activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition1, permanent.TopCard);
  89. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  90. activateClass1.SetEffectSourcePermanent(permanent);
  91. permanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  92. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  95. }
  96. string EffectDiscription1()
  97. {
  98. return "[End of Attack] Delete this Digimon.";
  99. }
  100. bool CanUseCondition1(Hashtable hashtable1)
  101. {
  102. if (CardEffectCommons.IsOpponentTurn(card))
  103. {
  104. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, permanent.TopCard))
  105. {
  106. if (CardEffectCommons.CanTriggerOnEndAttack(hashtable1, permanent.TopCard))
  107. {
  108. return true;
  109. }
  110. }
  111. }
  112. return false;
  113. }
  114. bool CanActivateCondition1(Hashtable hashtable1)
  115. {
  116. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  117. {
  118. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  119. {
  120. return true;
  121. }
  122. }
  123. return false;
  124. }
  125. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  126. {
  127. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  128. {
  129. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  130. new List<Permanent>() { permanent },
  131. CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  132. }
  133. }
  134. ICardEffect GetCardEffect(EffectTiming _timing)
  135. {
  136. if (_timing == EffectTiming.OnEndAttack)
  137. {
  138. return activateClass1;
  139. }
  140. return null;
  141. }
  142. }
  143. }
  144. }
  145. if (CanActivateSecondEffectCondition(hashtable))
  146. {
  147. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  148. {
  149. new SelectionElement<bool>(message: $"Play Token", value : true, spriteIndex: 0),
  150. new SelectionElement<bool>(message: $"Not Play Token", value : false, spriteIndex: 1),
  151. };
  152. string selectPlayerMessage = "Will you play a token?";
  153. string notSelectPlayerMessage = "The opponent is choosing to play a token.";
  154. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  155. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  156. bool canPlay = GManager.instance.userSelectionManager.SelectedBoolValue;
  157. if (canPlay)
  158. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayVoleeZerdrucken(activateClass));
  159. }
  160. }
  161. }
  162. #endregion
  163. #region When Digivolving
  164. if (timing == EffectTiming.OnEnterFieldAnyone)
  165. {
  166. ActivateClass activateClass = new ActivateClass();
  167. activateClass.SetUpICardEffect("Give effects to opponent's Digimon and play a Token", CanUseCondition, card);
  168. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  169. cardEffects.Add(activateClass);
  170. string EffectDiscription()
  171. {
  172. return "[When Digivolving] 1 of your opponent's Digimon gains \" Delete this Digimon.\" until the end of their turn. Then, if this Digimon has [LadyDevimon]/[X Antibody] in its digivolution cards, you may play 1 [Volée & Zerdrücken] Token (Digimon/Lv.4/Purple/5000 DP/<Blocker>/<Retaliation>).";
  173. }
  174. bool CanUseCondition(Hashtable hashtable)
  175. {
  176. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  177. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  178. return false;
  179. }
  180. bool CanActivateCondition(Hashtable hashtable)
  181. {
  182. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  183. }
  184. IEnumerator ActivateCoroutine(Hashtable hashtable)
  185. {
  186. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  187. {
  188. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  189. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  190. selectPermanentEffect.SetUp(
  191. selectPlayer: card.Owner,
  192. canTargetCondition: CanSelectPermanentCondition,
  193. canTargetCondition_ByPreSelecetedList: null,
  194. canEndSelectCondition: null,
  195. maxCount: maxCount,
  196. canNoSelect: false,
  197. canEndNotMax: false,
  198. selectPermanentCoroutine: SelectPermanentCoroutine,
  199. afterSelectPermanentCoroutine: null,
  200. mode: SelectPermanentEffect.Mode.Custom,
  201. cardEffect: activateClass);
  202. selectPermanentEffect.SetUpCustomMessage(
  203. "Select 1 Digimon that will get [End of Attack] Delete this Digimon.",
  204. "The opponent is selecting 1 Digimon that will get [End of Attack] Delete this Digimon.");
  205. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  206. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  207. {
  208. if (permanent != null)
  209. {
  210. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  211. ActivateClass activateClass1 = new ActivateClass();
  212. activateClass1.SetUpICardEffect("Delete this Digimon", CanUseCondition1, permanent.TopCard);
  213. activateClass1.SetUpActivateClass(CanActivateCondition1, ActivateCoroutine1, -1, false, EffectDiscription1());
  214. activateClass1.SetEffectSourcePermanent(permanent);
  215. permanent.UntilOwnerTurnEndEffects.Add(GetCardEffect);
  216. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  217. {
  218. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  219. }
  220. string EffectDiscription1()
  221. {
  222. return "[End of Attack] Delete this Digimon.";
  223. }
  224. bool CanUseCondition1(Hashtable hashtable1)
  225. {
  226. if (CardEffectCommons.IsOpponentTurn(card))
  227. {
  228. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, permanent.TopCard))
  229. {
  230. if (CardEffectCommons.CanTriggerOnEndAttack(hashtable1, permanent.TopCard))
  231. {
  232. return true;
  233. }
  234. }
  235. }
  236. return false;
  237. }
  238. bool CanActivateCondition1(Hashtable hashtable1)
  239. {
  240. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  241. {
  242. if (!permanent.TopCard.CanNotBeAffected(activateClass))
  243. {
  244. return true;
  245. }
  246. }
  247. return false;
  248. }
  249. IEnumerator ActivateCoroutine1(Hashtable _hashtable1)
  250. {
  251. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  252. {
  253. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  254. new List<Permanent>() { permanent },
  255. CardEffectCommons.CardEffectHashtable(activateClass1)).Destroy());
  256. }
  257. }
  258. ICardEffect GetCardEffect(EffectTiming _timing)
  259. {
  260. if (_timing == EffectTiming.OnEndAttack)
  261. {
  262. return activateClass1;
  263. }
  264. return null;
  265. }
  266. }
  267. }
  268. }
  269. if (CanActivateSecondEffectCondition(hashtable))
  270. {
  271. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  272. {
  273. new SelectionElement<bool>(message: $"Play Token", value : true, spriteIndex: 0),
  274. new SelectionElement<bool>(message: $"Not Play Token", value : false, spriteIndex: 1),
  275. };
  276. string selectPlayerMessage = "Will you play a token?";
  277. string notSelectPlayerMessage = "The opponent is choosing to play a token.";
  278. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  279. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  280. bool canPlay = GManager.instance.userSelectionManager.SelectedBoolValue;
  281. if(canPlay)
  282. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayVoleeZerdrucken(activateClass));
  283. }
  284. }
  285. }
  286. #endregion
  287. #region Inherit
  288. if (timing == EffectTiming.OnDestroyedAnyone)
  289. {
  290. ActivateClass activateClass = new ActivateClass();
  291. activateClass.SetUpICardEffect("Play 1 level 4 or lower purple Digimon from your trash", CanUseCondition, card);
  292. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  293. activateClass.SetHashString("PlayLevel4_EX7_058");
  294. activateClass.SetIsInheritedEffect(true);
  295. cardEffects.Add(activateClass);
  296. string EffectDiscription()
  297. {
  298. return "[Opponent's Turn] [Once per turn] When an opponent's Digimon is deleted, you may play 1 purple level 4 or lower Digimon card from your trash without paying the cost.";
  299. }
  300. bool CanSelectCardInTrash(CardSource cardSource)
  301. {
  302. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  303. {
  304. if (cardSource.HasCardColor(CardColor.Purple))
  305. {
  306. if (cardSource.IsDigimon)
  307. {
  308. if (cardSource.Level <= 4)
  309. {
  310. if (cardSource.HasLevel)
  311. {
  312. return true;
  313. }
  314. }
  315. }
  316. }
  317. }
  318. return false;
  319. }
  320. bool CanUseCondition(Hashtable hashtable)
  321. {
  322. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  323. {
  324. if (CardEffectCommons.IsOpponentTurn(card))
  325. {
  326. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
  327. {
  328. return true;
  329. }
  330. }
  331. }
  332. return false;
  333. }
  334. bool PermanentCondition(Permanent permanent)
  335. {
  336. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  337. {
  338. if (permanent.IsDigimon)
  339. {
  340. return true;
  341. }
  342. }
  343. return false;
  344. }
  345. bool CanActivateCondition(Hashtable hashtable)
  346. {
  347. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  348. {
  349. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardInTrash(cardSource)))
  350. {
  351. return true;
  352. }
  353. }
  354. return false;
  355. }
  356. IEnumerator ActivateCoroutine(Hashtable hashtable)
  357. {
  358. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardInTrash))
  359. {
  360. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardInTrash));
  361. List<CardSource> selectedCards = new List<CardSource>();
  362. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  363. selectCardEffect.SetUp(
  364. canTargetCondition: CanSelectCardInTrash,
  365. canTargetCondition_ByPreSelecetedList: null,
  366. canEndSelectCondition: null,
  367. canNoSelect: () => true,
  368. selectCardCoroutine: SelectCardCoroutine,
  369. afterSelectCardCoroutine: null,
  370. message: "Select 1 card to play.",
  371. maxCount: maxCount,
  372. canEndNotMax: false,
  373. isShowOpponent: true,
  374. mode: SelectCardEffect.Mode.Custom,
  375. root: SelectCardEffect.Root.Trash,
  376. customRootCardList: null,
  377. canLookReverseCard: true,
  378. selectPlayer: card.Owner,
  379. cardEffect: activateClass);
  380. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  381. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  382. yield return StartCoroutine(selectCardEffect.Activate());
  383. IEnumerator SelectCardCoroutine(CardSource cardSource)
  384. {
  385. selectedCards.Add(cardSource);
  386. yield return null;
  387. }
  388. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  389. cardSources: selectedCards,
  390. activateClass: activateClass,
  391. payCost: false,
  392. isTapped: false,
  393. root: SelectCardEffect.Root.Trash,
  394. activateETB: true));
  395. }
  396. }
  397. }
  398. #endregion
  399. return cardEffects;
  400. }
  401. }
  402. }