EX12_033.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Amphimon // Frozen Crystal
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_033 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Digimon Effects
  12. #region Alt Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent permanent)
  16. {
  17. return permanent.TopCard.HasText("Jellymon")
  18. || permanent.TopCard.EqualsTraits("DS");
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 5));
  21. }
  22. #endregion
  23. #region Shared WD / WA / Counter
  24. string SharedEffectName = "May trash up to 3 cards from hand to give 1 enemy Digimon -4K DP per card for turn";
  25. string SharedEffectDescription(string tag)
  26. => $"[{tag}] You may trash up to 3 cards in your hand. Then, to 1 of your opponent's Digimon, give -4000 DP until your turn ends for each card this effect trashed.";
  27. CardEffectFactory.ActivateClassesForSharedEffects
  28. (ref cardEffects, timing, card,
  29. SharedEffectName,
  30. SharedActivateCoroutine,
  31. SharedEffectDescription,
  32. optional: false,
  33. isSkippable: true,
  34. whenDigivolving: true,
  35. whenAttacking: true,
  36. counter: true);
  37. bool CanSelectEnemyDigimonCondition(Permanent permanent)
  38. {
  39. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  40. }
  41. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  42. {
  43. int cardSourcesCount = 0;
  44. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  45. selectHandEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: _ => true,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. maxCount: 3,
  51. canNoSelect: true,
  52. canEndNotMax: true,
  53. isShowOpponent: true,
  54. selectCardCoroutine: null,
  55. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  56. mode: SelectHandEffect.Mode.Discard,
  57. cardEffect: activateClass);
  58. selectHandEffect.SetUpCustomMessage("Select up to 3 cards to trash.", "The opponent is selecting up to 3 cards to trash from their hand.");
  59. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  60. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  61. {
  62. if (cardSources.Count >= 1)
  63. {
  64. cardSourcesCount = cardSources.Count;
  65. yield return null;
  66. }
  67. }
  68. if (cardSourcesCount >= 1
  69. && CardEffectCommons.HasMatchConditionPermanent(CanSelectEnemyDigimonCondition))
  70. {
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectEnemyDigimonCondition,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: 1,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: SelectPermanentCoroutine,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Custom,
  83. cardEffect: activateClass);
  84. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon that will get DP -{cardSourcesCount*4000}.", $"The opponent is selecting 1 Digimon that will get DP -{cardSourcesCount*4000}.");
  85. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  86. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  87. {
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -cardSourcesCount * 4000, effectDuration: EffectDuration.UntilOwnerTurnEnd, activateClass: activateClass));
  89. }
  90. }
  91. }
  92. #endregion
  93. #region All Turns
  94. if (timing == EffectTiming.WhenRemoveField)
  95. {
  96. ActivateClass activateClass = new ActivateClass();
  97. activateClass.SetUpICardEffect("Bot deck 3 cards from trash to prevent", CanUseCondition, card);
  98. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  99. activateClass.SetIsSkippable(true);
  100. activateClass.SetHashString("EX12_033_AT");
  101. cardEffects.Add(activateClass);
  102. string EffectDescription()
  103. {
  104. return "[All Turns] [Once Per Turn] When any of your Digimon with [Jellymon] in their texts or the [DS] trait would leave the battle area, by returning 3 cards from your trash to the bottom of the deck, they don't leave.";
  105. }
  106. bool CanUseCondition(Hashtable hashtable)
  107. {
  108. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  109. && CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, PermanentCondition);
  110. }
  111. bool CanActivateCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass);
  114. }
  115. bool PermanentCondition(Permanent permanent)
  116. {
  117. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  118. && (permanent.TopCard.HasText("Jellymon")
  119. || permanent.TopCard.EqualsTraits("DS"));
  120. }
  121. IEnumerator ActivateCoroutine(Hashtable hashtable)
  122. {
  123. bool isUsed = false;
  124. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  125. selectCardEffect.SetUp(
  126. canTargetCondition: _ => true,
  127. canTargetCondition_ByPreSelecetedList: null,
  128. canEndSelectCondition: null,
  129. canNoSelect: () => true,
  130. selectCardCoroutine: null,
  131. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  132. message: "Select 3 cards",
  133. maxCount: 3,
  134. canEndNotMax: false,
  135. isShowOpponent: true,
  136. mode: SelectCardEffect.Mode.Custom,
  137. root: SelectCardEffect.Root.Trash,
  138. customRootCardList: null,
  139. canLookReverseCard: true,
  140. selectPlayer: card.Owner,
  141. cardEffect: activateClass);
  142. selectCardEffect.SetUpCustomMessage(
  143. "Select 3 cards to return to the bottom of the deck.",
  144. "The opponent is selecting 3 cards to return to the bottom of the deck.");
  145. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  146. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  147. {
  148. if (cardSources.Count == 3)
  149. {
  150. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ReturnRevealedCardsToLibraryBottom(
  151. remainingCards: cardSources,
  152. activateClass: activateClass
  153. ));
  154. List<Permanent> removedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(PermanentCondition);
  155. foreach (Permanent permanent in removedPermanents)
  156. {
  157. permanent.willBeRemoveField = false;
  158. permanent.HideDeleteEffect();
  159. permanent.HideHandBounceEffect();
  160. permanent.HideDeckBounceEffect();
  161. permanent.HideWillRemoveFieldEffect();
  162. }
  163. isUsed = true;
  164. yield return null;
  165. }
  166. }
  167. if (!isUsed) activateClass.RemoveUse();
  168. }
  169. }
  170. #endregion
  171. #endregion
  172. #region Option Effects
  173. #region Use Req.
  174. if (timing == EffectTiming.None)
  175. {
  176. cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
  177. bool CardCondition(CardSource cardSource)
  178. {
  179. return cardSource.HasText("DS");
  180. }
  181. }
  182. #endregion
  183. #region Main
  184. if (timing == EffectTiming.OptionSkill)
  185. {
  186. ActivateClass activateClass = new ActivateClass();
  187. activateClass.SetUpICardEffect("Trash 4 enemy Digimon/Tamer sources, then may bounce 1 enemy sourceless Digimon/Tamer", CanUseCondition, card);
  188. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  189. cardEffects.Add(activateClass);
  190. string EffectDescription()
  191. => "[Main] Trash any 4 cards under your opponent's Digimon or Tamers. Then, you may return 1 of your opponent's Digimon or Tamers without cards under it to the hand.";
  192. bool CanUseCondition(Hashtable hashtable)
  193. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  194. bool CanSelectEnemyDigiTamerPermanentCondition(Permanent permanent)
  195. {
  196. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  197. && (permanent.IsDigimon
  198. || permanent.IsTamer);
  199. }
  200. bool CanSelectEnemySourcelessPermanentCondition(Permanent permanent)
  201. {
  202. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  203. && (permanent.IsDigimon
  204. || permanent.IsTamer)
  205. && permanent.DigivolutionCards.Count == 0;
  206. }
  207. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  208. {
  209. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectEnemyDigiTamerPermanentCondition))
  210. {
  211. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  212. permanentCondition: CanSelectEnemyDigiTamerPermanentCondition,
  213. cardCondition: _ => true,
  214. maxCount: 4,
  215. canNoTrash: false,
  216. isFromOnly1Permanent: false,
  217. activateClass: activateClass,
  218. afterSelectionCoroutine: null,
  219. selectString: "Digimon or Tamer"
  220. ));
  221. }
  222. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectEnemySourcelessPermanentCondition))
  223. {
  224. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  225. selectPermanentEffect.SetUp(
  226. selectPlayer: card.Owner,
  227. canTargetCondition: CanSelectEnemySourcelessPermanentCondition,
  228. canTargetCondition_ByPreSelecetedList: null,
  229. canEndSelectCondition: null,
  230. maxCount: 1,
  231. canNoSelect: true,
  232. canEndNotMax: false,
  233. selectPermanentCoroutine: null,
  234. afterSelectPermanentCoroutine: null,
  235. mode: SelectPermanentEffect.Mode.Bounce,
  236. cardEffect: activateClass);
  237. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer without cards under it to return to the hand.", "The opponent is selecting 1 Digimon or Tamer without cards under it to return to the hand.");
  238. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  239. }
  240. }
  241. }
  242. #endregion
  243. #region Arts Digivolution
  244. if (timing == EffectTiming.None)
  245. {
  246. cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
  247. }
  248. #endregion
  249. #endregion
  250. return cardEffects;
  251. }
  252. }
  253. }