EX12_047.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Amaterasumon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_047 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution Requirement
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("Shambala");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null, level: 5));
  19. }
  20. #endregion
  21. #region Static Keywords
  22. #region Piercing
  23. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  24. {
  25. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region Security A. +1
  29. if (timing == EffectTiming.None)
  30. {
  31. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  32. }
  33. #endregion
  34. #region Ascension
  35. if (timing == EffectTiming.OnDestroyedAnyone)
  36. {
  37. cardEffects.Add(CardEffectFactory.AscensionSelfEffect(isInheritedEffect: false, card: card, condition: null));
  38. }
  39. #endregion
  40. #endregion
  41. #region Shared OP/WD
  42. string SharedEffectName = "Delete enemy lowest DP, then by returning 2 of their trash cards to bottom of deck, this gets 6K DP and they get -5K DP per color";
  43. CardEffectFactory.ActivateClassesForSharedEffects
  44. (ref cardEffects, timing, card,
  45. SharedEffectName,
  46. SharedActivateCoroutine,
  47. SharedEffectDescription,
  48. optional: false,
  49. onPlay: true,
  50. whenDigivolving: true);
  51. string SharedEffectDescription(string tag)
  52. {
  53. return $"[{tag}] Delete 1 of your opponent's lowest DP Digimon. Then, by returning 2 cards from their trash to the bottom of the deck, for the turn, this Digimon gets +6000 DP and, to 1 of their Digimon, give -5000 DP for each of those returned cards' colors.";
  54. }
  55. bool CanSelectDeletePermanentCondition(Permanent permanent)
  56. {
  57. return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
  58. }
  59. bool CanSelectDPMinusPermanentCondition(Permanent permanent)
  60. {
  61. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  62. }
  63. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  64. {
  65. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeletePermanentCondition))
  66. {
  67. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectDeletePermanentCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: 1,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: null,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Destroy,
  79. cardEffect: activateClass);
  80. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  81. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  82. }
  83. if (card.Owner.Enemy.TrashCards.Count >= 2)
  84. {
  85. List<CardSource> selectedCards = new List<CardSource>();
  86. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  87. selectCardEffect.SetUp(
  88. canTargetCondition: (card) => true,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. canNoSelect: () => true,
  92. selectCardCoroutine: SelectCardCoroutine,
  93. afterSelectCardCoroutine: null,
  94. message: "Select 2 cards to bottom deck",
  95. maxCount: 2,
  96. canEndNotMax: false,
  97. isShowOpponent: true,
  98. mode: SelectCardEffect.Mode.Custom,
  99. root: SelectCardEffect.Root.Custom,
  100. customRootCardList: card.Owner.Enemy.TrashCards,
  101. canLookReverseCard: true,
  102. selectPlayer: card.Owner,
  103. cardEffect: activateClass);
  104. IEnumerator SelectCardCoroutine(CardSource cardSource)
  105. {
  106. selectedCards.Add(cardSource);
  107. yield return null;
  108. }
  109. selectCardEffect.SetUpCustomMessage("Select 2 cards to bottom deck", "Your opponent is selecting 2 cards to bottom deck");
  110. selectCardEffect.SetUpCustomMessage_ShowCard("Selected Cards");
  111. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  112. if (selectedCards.Count == 2)
  113. {
  114. int DPMinus = Combinations.GetDifferenetColorCardCount(selectedCards) * -5000;
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ReturnRevealedCardsToLibraryBottom(
  116. remainingCards: selectedCards,
  117. activateClass: activateClass));
  118. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  119. targetPermanent: card.PermanentOfThisCard(),
  120. changeValue: 6000,
  121. effectDuration: EffectDuration.UntilEachTurnEnd,
  122. activateClass: activateClass));
  123. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDPMinusPermanentCondition))
  124. {
  125. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  126. selectPermanentEffect.SetUp(
  127. selectPlayer: card.Owner,
  128. canTargetCondition: CanSelectDPMinusPermanentCondition,
  129. canTargetCondition_ByPreSelecetedList: null,
  130. canEndSelectCondition: null,
  131. maxCount: 1,
  132. canNoSelect: false,
  133. canEndNotMax: false,
  134. selectPermanentCoroutine: SelectPermanentCoroutine2,
  135. afterSelectPermanentCoroutine: null,
  136. mode: SelectPermanentEffect.Mode.Custom,
  137. cardEffect: activateClass);
  138. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon that will get {DPMinus} DP.", $"The opponent is selecting 1 Digimon that will get {DPMinus} DP.");
  139. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  140. IEnumerator SelectPermanentCoroutine2(Permanent permanent)
  141. {
  142. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  143. targetPermanent: permanent,
  144. changeValue: DPMinus,
  145. effectDuration: EffectDuration.UntilEachTurnEnd,
  146. activateClass: activateClass));
  147. }
  148. }
  149. }
  150. }
  151. }
  152. #endregion
  153. #region On Deletion
  154. if (timing == EffectTiming.OnDestroyedAnyone)
  155. {
  156. ActivateClass activateClass = new ActivateClass();
  157. activateClass.SetUpICardEffect("May return 1 [TB] card from trash to hand, then may play 1 lvl 5- [TB] Digimon from hand for free", CanUseCondition, card);
  158. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  159. activateClass.SetIsSkippable(true);
  160. cardEffects.Add(activateClass);
  161. string EffectDescription()
  162. {
  163. return "[On Deletion] You may return 1 [TB] trait card from your trash to the hand. Then, you may play 1 level 5 or lower [TB] trait Digimon card from your hand without paying the cost.";
  164. }
  165. bool CanUseCondition(Hashtable hashtable)
  166. {
  167. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  168. }
  169. bool CanActivateCondition(Hashtable hashtable)
  170. {
  171. return CardEffectCommons.CanActivateOnDeletion(card, activateClass)
  172. && (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectReturnCardCondition)
  173. || CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectPlayCardCondition));
  174. }
  175. bool CanSelectReturnCardCondition(CardSource cardSource)
  176. {
  177. return cardSource.EqualsTraits("TB");
  178. }
  179. bool CanSelectPlayCardCondition(CardSource cardSource)
  180. {
  181. return cardSource.IsDigimon
  182. && cardSource.HasLevel
  183. && cardSource.Level <= 5
  184. && cardSource.EqualsTraits("TB")
  185. && CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  186. }
  187. IEnumerator ActivateCoroutine(Hashtable hashtable)
  188. {
  189. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectReturnCardCondition))
  190. {
  191. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  192. selectCardEffect.SetUp(
  193. canTargetCondition: CanSelectReturnCardCondition,
  194. canTargetCondition_ByPreSelecetedList: null,
  195. canEndSelectCondition: null,
  196. canNoSelect: () => true,
  197. selectCardCoroutine: null,
  198. afterSelectCardCoroutine: null,
  199. message: "Select 1 [TB] card to return to hand",
  200. maxCount: 1,
  201. canEndNotMax: false,
  202. isShowOpponent: true,
  203. mode: SelectCardEffect.Mode.AddHand,
  204. root: SelectCardEffect.Root.Trash,
  205. customRootCardList: null,
  206. canLookReverseCard: true,
  207. selectPlayer: card.Owner,
  208. cardEffect: activateClass);
  209. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  210. }
  211. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectPlayCardCondition))
  212. {
  213. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  214. canTargetCondition: CanSelectPlayCardCondition,
  215. SelectCardEffect.Root.Hand,
  216. activateClass,
  217. payCost: false
  218. ));
  219. }
  220. }
  221. }
  222. #endregion
  223. return cardEffects;
  224. }
  225. }
  226. }