EX12_033.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  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 CanSelectPermanentCondition(Permanent permanent)
  38. {
  39. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(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(CanSelectPermanentCondition))
  70. {
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectPermanentCondition,
  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.UntilEachTurnEnd, 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. List<Permanent> removedPermanents = CardEffectCommons.GetPermanentsFromHashtable(hashtable).Filter(PermanentCondition);
  151. foreach (Permanent permanent in removedPermanents)
  152. {
  153. permanent.willBeRemoveField = false;
  154. permanent.HideDeleteEffect();
  155. permanent.HideHandBounceEffect();
  156. permanent.HideDeckBounceEffect();
  157. permanent.HideWillRemoveFieldEffect();
  158. }
  159. isUsed = true;
  160. yield return null;
  161. }
  162. }
  163. if (!isUsed) activateClass.RemoveUse();
  164. }
  165. }
  166. #endregion
  167. #endregion
  168. #region Option Effects
  169. #region Use Req.
  170. if (timing == EffectTiming.None)
  171. {
  172. cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
  173. bool CardCondition(CardSource cardSource)
  174. {
  175. return cardSource.HasText("DS");
  176. }
  177. }
  178. #endregion
  179. #region Main
  180. if (timing == EffectTiming.OptionSkill)
  181. {
  182. ActivateClass activateClass = new ActivateClass();
  183. activateClass.SetUpICardEffect("Trash 4 enemy Digimon/Tamer sources, then may bounce 1 enemy sourceless Digimon/Tamer", CanUseCondition, card);
  184. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  185. cardEffects.Add(activateClass);
  186. string EffectDescription()
  187. => "[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.";
  188. bool CanUseCondition(Hashtable hashtable)
  189. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  190. bool CanSelectPermanentCondition1(Permanent permanent)
  191. {
  192. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  193. && (permanent.IsDigimon
  194. || permanent.IsTamer);
  195. }
  196. bool CanSelectPermanentCondition2(Permanent permanent)
  197. {
  198. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  199. && (permanent.IsDigimon
  200. || permanent.IsTamer)
  201. && permanent.DigivolutionCards.Count == 0;
  202. }
  203. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  204. {
  205. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  206. {
  207. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SelectTrashDigivolutionCards(
  208. permanentCondition: CanSelectPermanentCondition1,
  209. cardCondition: _ => true,
  210. maxCount: 4,
  211. canNoTrash: false,
  212. isFromOnly1Permanent: false,
  213. activateClass: activateClass,
  214. afterSelectionCoroutine: null
  215. ));
  216. }
  217. if(CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition2))
  218. {
  219. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  220. selectPermanentEffect.SetUp(
  221. selectPlayer: card.Owner,
  222. canTargetCondition: CanSelectPermanentCondition2,
  223. canTargetCondition_ByPreSelecetedList: null,
  224. canEndSelectCondition: null,
  225. maxCount: 1,
  226. canNoSelect: true,
  227. canEndNotMax: false,
  228. selectPermanentCoroutine: null,
  229. afterSelectPermanentCoroutine: null,
  230. mode: SelectPermanentEffect.Mode.Bounce,
  231. cardEffect: activateClass);
  232. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  233. }
  234. }
  235. }
  236. #endregion
  237. #region Arts Digivolution
  238. if (timing == EffectTiming.None)
  239. {
  240. cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
  241. }
  242. #endregion
  243. #endregion
  244. return cardEffects;
  245. }
  246. }
  247. }