BT25_035.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Cougarmon
  6. namespace DCGO.CardEffects.BT25
  7. {
  8. public class BT25_035 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alt Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasGlowingDawnTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(level: 3, permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region Shared OP / WD
  24. string SharedEffectName = "- 3K DP to 1 enemy Digimon for turn, by trashing 2 bottom face-down cards from your Tamers, may digivolve into a [Glowing Dawn] Digimon for free";
  25. CardEffectFactory.ActivateClassesForSharedEffects
  26. (ref cardEffects, timing, card,
  27. SharedEffectName,
  28. SharedActivateCoroutine,
  29. SharedEffectDescription,
  30. optional: false,
  31. onPlay: true,
  32. whenDigivolving: true);
  33. string SharedEffectDescription(string tag)
  34. => $"[{tag}] 1 of your opponent's Digimon gets -3000 DP for the turn. Then, by trashing 2 bottom face-down cards from under any of your Tamers, this Digimon may digivolve into a [Glowing Dawn] trait Digimon card in the hand without paying the cost.";
  35. bool IsEnemyDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  36. bool TamerWithOneFaceDownSource(Permanent permanent)
  37. {
  38. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card)
  39. && permanent.DigivolutionCards.Any(CanSelectTrashSourceCardCondition);
  40. }
  41. bool TamerWith2OrMoreFaceDownSources(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaTamer(permanent, card)
  44. && permanent.DigivolutionCards.Count(CanSelectTrashSourceCardCondition) > 1;
  45. }
  46. bool CanSelectTrashSourceCardCondition(CardSource cardSource)
  47. {
  48. return cardSource.IsFaceDown;
  49. }
  50. bool CanDigivolveCardCondition(CardSource cardSource) => cardSource.HasGlowingDawnTraits;
  51. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(IsEnemyDigimon))
  54. {
  55. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  56. selectPermanentEffect.SetUp(
  57. selectPlayer: card.Owner,
  58. canTargetCondition: IsEnemyDigimon,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. maxCount: 1,
  62. canNoSelect: false,
  63. canEndNotMax: false,
  64. selectPermanentCoroutine: SelectPermanentCoroutine,
  65. afterSelectPermanentCoroutine: null,
  66. mode: SelectPermanentEffect.Mode.Custom,
  67. cardEffect: activateClass);
  68. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get -3000 DP", "The opponent is selecting 1 Digimon that will get -3000 DP");
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  73. }
  74. }
  75. if (CardEffectCommons.HasMatchConditionPermanent(TamerWith2OrMoreFaceDownSources) || CardEffectCommons.MatchConditionPermanentCount(TamerWithOneFaceDownSource) > 1)
  76. {
  77. bool trashed = false;
  78. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. int maxCount1 = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(TamerWithOneFaceDownSource));
  80. selectPermanentEffect1.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition: TamerWithOneFaceDownSource,
  83. canTargetCondition_ByPreSelecetedList: null,
  84. canEndSelectCondition: CanEndSelectCondition,
  85. maxCount: maxCount1,
  86. canNoSelect: true,
  87. canEndNotMax: true,
  88. selectPermanentCoroutine: null,
  89. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  90. mode: SelectPermanentEffect.Mode.Custom,
  91. cardEffect: activateClass);
  92. selectPermanentEffect1.SetUpCustomMessage("Select all Tamer(s) to trash bottom face-down cards from", "The opponent is selecting Tamer(s) to trash bottom face-down cards from");
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  94. bool CanEndSelectCondition(List<Permanent> permanents)
  95. {
  96. return permanents.Count == 2 || (permanents.Count > 0 && permanents[0].DigivolutionCards.Count(CanSelectTrashSourceCardCondition) >= 2);
  97. }
  98. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  99. {
  100. if (permanents.Count == 1)
  101. {
  102. trashed = true;
  103. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: permanents[0], trashCount: 2, isFromTop: false, activateClass: activateClass, CanSelectTrashSourceCardCondition));
  104. }
  105. else if (permanents.Count == 2)
  106. {
  107. trashed = true;
  108. foreach (Permanent selectedPermanent in permanents)
  109. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 1, isFromTop: false, activateClass: activateClass, CanSelectTrashSourceCardCondition));
  110. }
  111. }
  112. if (trashed)
  113. {
  114. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  115. targetPermanent: card.PermanentOfThisCard(),
  116. cardCondition: CanDigivolveCardCondition,
  117. payCost: false,
  118. reduceCostTuple: null,
  119. fixedCostTuple: null,
  120. ignoreDigivolutionRequirementFixedCost: -1,
  121. isHand: true,
  122. activateClass: activateClass,
  123. successProcess: null));
  124. }
  125. }
  126. }
  127. #endregion
  128. #region Barrier - ESS
  129. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  130. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: true, card: card, condition: null));
  131. #endregion
  132. return cardEffects;
  133. }
  134. }
  135. }