BT11_099.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_099 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.None)
  12. {
  13. ChangeCostClass changeCostClass = new ChangeCostClass();
  14. changeCostClass.SetUpICardEffect($"Play Cost -1", CanUseCondition, card);
  15. changeCostClass.SetUpChangeCostClass(
  16. changeCostFunc: ChangeCost,
  17. cardSourceCondition: CardSourceCondition,
  18. rootCondition: RootCondition,
  19. isUpDown: isUpDown,
  20. isCheckAvailability: () => false,
  21. isChangePayingCost: () => true);
  22. cardEffects.Add(changeCostClass);
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) =>
  26. permanent.TopCard.CardColors.Contains(CardColor.Blue) && permanent.IsTamer))
  27. {
  28. return true;
  29. }
  30. return false;
  31. }
  32. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  33. {
  34. if (CardSourceCondition(cardSource))
  35. {
  36. if (RootCondition(root))
  37. {
  38. if (PermanentsCondition(targetPermanents))
  39. {
  40. Cost -= 1;
  41. }
  42. }
  43. }
  44. return Cost;
  45. }
  46. bool PermanentsCondition(List<Permanent> targetPermanents)
  47. {
  48. return true;
  49. }
  50. bool CardSourceCondition(CardSource cardSource)
  51. {
  52. return cardSource == card;
  53. }
  54. bool RootCondition(SelectCardEffect.Root root)
  55. {
  56. return true;
  57. }
  58. bool isUpDown()
  59. {
  60. return true;
  61. }
  62. }
  63. if (timing == EffectTiming.OptionSkill)
  64. {
  65. ActivateClass activateClass = new ActivateClass();
  66. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  67. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  68. cardEffects.Add(activateClass);
  69. string EffectDiscription()
  70. {
  71. return "[Main] Trash the top 3 digivolution cards of 1 of your opponent's Digimon. Then, return 1 of your opponent's Digimon with no digivolution cards to its owner's hand.";
  72. }
  73. bool CanSelectPermanentCondition(Permanent permanent)
  74. {
  75. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  76. {
  77. return true;
  78. }
  79. return false;
  80. }
  81. bool CanSelectPermanentCondition1(Permanent permanent)
  82. {
  83. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  84. {
  85. if (permanent.HasNoDigivolutionCards)
  86. {
  87. return true;
  88. }
  89. }
  90. return false;
  91. }
  92. bool CanUseCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  95. }
  96. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  97. {
  98. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  99. {
  100. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  101. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectPermanentCondition,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: maxCount,
  108. canNoSelect: false,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: SelectPermanentCoroutine,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.Custom,
  113. cardEffect: activateClass);
  114. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  115. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  116. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  117. {
  118. Permanent selectedPermanent = permanent;
  119. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 3, isFromTop: true, activateClass: activateClass));
  120. }
  121. }
  122. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  123. {
  124. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  125. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  126. selectPermanentEffect.SetUp(
  127. selectPlayer: card.Owner,
  128. canTargetCondition: CanSelectPermanentCondition1,
  129. canTargetCondition_ByPreSelecetedList: null,
  130. canEndSelectCondition: null,
  131. maxCount: maxCount,
  132. canNoSelect: false,
  133. canEndNotMax: false,
  134. selectPermanentCoroutine: null,
  135. afterSelectPermanentCoroutine: null,
  136. mode: SelectPermanentEffect.Mode.Bounce,
  137. cardEffect: activateClass);
  138. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  139. }
  140. }
  141. }
  142. if (timing == EffectTiming.SecuritySkill)
  143. {
  144. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  145. card: card,
  146. cardEffects: ref cardEffects,
  147. effectName: $"Trash digivolution cards and return 1 Digimon with no digivolution cards to hand");
  148. }
  149. return cardEffects;
  150. }
  151. }
  152. }