EX10_060.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Lucemon: Satan Mode
  6. namespace DCGO.CardEffects.EX10
  7. {
  8. public class EX10_060 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Shared Methods
  14. bool IsOpponentDigimonOrTamer(Permanent permanent)
  15. {
  16. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  17. && (permanent.IsDigimon || permanent.IsTamer);
  18. }
  19. bool IsLucemonLarva(CardSource cardSource, ActivateClass activateClass)
  20. {
  21. return cardSource.IsDigimon
  22. && cardSource.EqualsCardName("Lucemon: Larva")
  23. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass, isBreedingArea: true);
  24. }
  25. #region WD/WA Once Per Turn Shared Activate Coroutine
  26. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  27. {
  28. bool hasOpponentDeleted = false;
  29. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentDigimonOrTamer))
  30. {
  31. Permanent selectedPermanent = null;
  32. #region Opponent Selects 1 Digimon or Tamer
  33. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentDigimonOrTamer));
  34. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  35. selectPermanentEffect.SetUp(
  36. selectPlayer: card.Owner.Enemy,
  37. canTargetCondition: IsOpponentDigimonOrTamer,
  38. canTargetCondition_ByPreSelecetedList: null,
  39. canEndSelectCondition: null,
  40. maxCount: maxCount,
  41. canNoSelect: true,
  42. canEndNotMax: false,
  43. selectPermanentCoroutine: SelectPermanentCoroutine,
  44. afterSelectPermanentCoroutine: null,
  45. mode: SelectPermanentEffect.Mode.Custom,
  46. cardEffect: activateClass);
  47. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  48. {
  49. selectedPermanent = permanent;
  50. yield return null;
  51. }
  52. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  53. #endregion
  54. #region Attempt to delete selected permanent
  55. if (selectedPermanent != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  56. targetPermanents: new List<Permanent> { selectedPermanent },
  57. activateClass: activateClass,
  58. successProcess: SuccessProcess,
  59. failureProcess: null));
  60. IEnumerator SuccessProcess(List<Permanent> deletedPermanents)
  61. {
  62. hasOpponentDeleted = true;
  63. yield return null;
  64. }
  65. #endregion
  66. }
  67. if (!hasOpponentDeleted)
  68. {
  69. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  70. player: card.Owner.Enemy,
  71. destroySecurityCount: 1,
  72. cardEffect: activateClass,
  73. fromTop: true).DestroySecurity());
  74. if (card.PermanentOfThisCard().CanUnsuspend) yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(
  75. permanents: new List<Permanent>() { card.PermanentOfThisCard() },
  76. cardEffect: activateClass).Unsuspend());
  77. }
  78. }
  79. #endregion
  80. #region OP/WD Shared Activate Coroutine
  81. IEnumerator SharedActivateCoroutine1(Hashtable hashtable, ActivateClass activateClass)
  82. {
  83. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, cardsource => IsLucemonLarva(cardsource, activateClass)))
  84. {
  85. CardSource selectedCard = null;
  86. #region Select 1 [Lucemon: Larva] from Trash
  87. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInTrash(card, cardsource => IsLucemonLarva(cardsource, activateClass)));
  88. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  89. selectCardEffect.SetUp(
  90. canTargetCondition: cardsource => IsLucemonLarva(cardsource, activateClass),
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. canNoSelect: () => true,
  94. selectCardCoroutine: SelectCardCoroutine,
  95. afterSelectCardCoroutine: null,
  96. message: "Select 1 [Lucemon: Larva] to play in breeding.",
  97. maxCount: maxCount,
  98. canEndNotMax: false,
  99. isShowOpponent: true,
  100. mode: SelectCardEffect.Mode.Custom,
  101. root: SelectCardEffect.Root.Trash,
  102. customRootCardList: null,
  103. canLookReverseCard: true,
  104. selectPlayer: card.Owner,
  105. cardEffect: activateClass);
  106. IEnumerator SelectCardCoroutine(CardSource cardSource)
  107. {
  108. selectedCard = cardSource;
  109. yield return null;
  110. }
  111. selectCardEffect.SetUpCustomMessage("Select 1 [Lucemon: Larva] to play in breeding.", "The opponent is selecting 1 [Lucemon: Larva] to play in breeding.");
  112. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  113. #endregion
  114. if (selectedCard != null)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  117. cardSources: new List<CardSource>() { selectedCard },
  118. activateClass: activateClass,
  119. payCost: false,
  120. isTapped: false,
  121. root: SelectCardEffect.Root.Trash,
  122. activateETB: true,
  123. isBreedingArea: true));
  124. if (CardEffectCommons.IsExistOnBreedingAreaDigimon(selectedCard))
  125. {
  126. List<Permanent> selectedPermanents = card.Owner.Enemy.GetBattleAreaDigimons()
  127. .Where(digimon => CardEffectCommons.IsMaxLevel(digimon, card.Owner.Enemy))
  128. .ToList();
  129. if (selectedPermanents.Any()) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(
  130. targetPermanents: selectedPermanents,
  131. activateClass: activateClass,
  132. successProcess: null,
  133. failureProcess: null));
  134. }
  135. }
  136. }
  137. }
  138. #endregion
  139. #endregion
  140. #region Alternate Digivolution Requirement
  141. if (timing == EffectTiming.None)
  142. {
  143. static bool PermanentCondition(Permanent targetPermanent)
  144. {
  145. return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.EqualsCardName("Lucemon: Chaos Mode");
  146. }
  147. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 6, ignoreDigivolutionRequirement: false, card: card, condition: null));
  148. }
  149. #endregion
  150. #region On Play
  151. if (timing == EffectTiming.OnEnterFieldAnyone)
  152. {
  153. ActivateClass activateClass = new ActivateClass();
  154. activateClass.SetUpICardEffect("By placing 1 [Lucemon: Larva] from trash in breeding, delete all opponents highest level digimon", CanUseCondition, card);
  155. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine1(hashtable, activateClass), -1, false, EffectDiscription());
  156. cardEffects.Add(activateClass);
  157. string EffectDiscription()
  158. {
  159. return "[On Play] By playing 1 [Lucemon: Larva] from your trash to your empty breeding area without paying the cost, delete all of your opponent's Digimon with the highest level.";
  160. }
  161. bool CanUseCondition(Hashtable hashtable)
  162. {
  163. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  164. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  165. }
  166. bool CanActivateCondition(Hashtable hashtable)
  167. {
  168. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  169. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, cardsource => IsLucemonLarva(cardsource, activateClass))
  170. && !card.Owner.GetBreedingAreaPermanents().Any();
  171. }
  172. }
  173. #endregion
  174. #region When Digivolving
  175. if (timing == EffectTiming.OnEnterFieldAnyone)
  176. {
  177. ActivateClass activateClass = new ActivateClass();
  178. activateClass.SetUpICardEffect("By placing 1 [Lucemon: Larva] from trash in breeding, delete all opponents highest level digimon", CanUseCondition, card);
  179. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine1(hashtable, activateClass), -1, false, EffectDiscription());
  180. cardEffects.Add(activateClass);
  181. string EffectDiscription()
  182. {
  183. return "[When Digivolving] By playing 1 [Lucemon: Larva] from your trash to your empty breeding area without paying the cost, delete all of your opponent's Digimon with the highest level.";
  184. }
  185. bool CanUseCondition(Hashtable hashtable)
  186. {
  187. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  188. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  189. }
  190. bool CanActivateCondition(Hashtable hashtable)
  191. {
  192. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  193. && CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, cardsource => IsLucemonLarva(cardsource, activateClass))
  194. && !card.Owner.GetBreedingAreaPermanents().Any();
  195. }
  196. }
  197. #endregion
  198. #region When Digivolving - Once Per Turn
  199. if (timing == EffectTiming.OnEnterFieldAnyone)
  200. {
  201. ActivateClass activateClass = new ActivateClass();
  202. activateClass.SetUpICardEffect("your opponent may delete a digimon or tamer. if they didn't trash their top security & unsuspend", CanUseCondition, card);
  203. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), 1, false, EffectDiscription());
  204. activateClass.SetHashString("EX10_060_WDWA");
  205. cardEffects.Add(activateClass);
  206. string EffectDiscription()
  207. {
  208. return "[When Digivolving] [Once Per Turn] Your opponent may delete 1 of their Digimon or Tamers. If this effect didn't delete, trash their top security card and this Digimon unsuspends.";
  209. }
  210. bool CanUseCondition(Hashtable hashtable)
  211. {
  212. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  213. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  214. }
  215. bool CanActivateCondition(Hashtable hashtable)
  216. {
  217. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  218. }
  219. }
  220. #endregion
  221. #region When Attacking - Once Per Turn
  222. if (timing == EffectTiming.OnAllyAttack)
  223. {
  224. ActivateClass activateClass = new ActivateClass();
  225. activateClass.SetUpICardEffect("your opponent may delete a digimon or tamer. if they didn't trash their top security & unsuspend", CanUseCondition, card);
  226. activateClass.SetUpActivateClass(CanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), 1, false, EffectDiscription());
  227. activateClass.SetHashString("EX10_060_WDWA");
  228. cardEffects.Add(activateClass);
  229. string EffectDiscription()
  230. {
  231. return "[When Attacking] [Once Per Turn] Your opponent may delete 1 of their Digimon or Tamers. If this effect didn't delete, trash their top security card and this Digimon unsuspends.";
  232. }
  233. bool CanUseCondition(Hashtable hashtable)
  234. {
  235. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  236. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  237. }
  238. bool CanActivateCondition(Hashtable hashtable)
  239. {
  240. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  241. }
  242. }
  243. #endregion
  244. return cardEffects;
  245. }
  246. }
  247. }