BT11_108.cs 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_108 : 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. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) =>
  26. permanent.TopCard.CardColors.Contains(CardColor.Black) && permanent.IsTamer);
  27. }
  28. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  29. {
  30. if (CardSourceCondition(cardSource))
  31. {
  32. if (RootCondition(root))
  33. {
  34. if (PermanentsCondition(targetPermanents))
  35. {
  36. Cost -= 1;
  37. }
  38. }
  39. }
  40. return Cost;
  41. }
  42. bool PermanentsCondition(List<Permanent> targetPermanents)
  43. {
  44. return true;
  45. }
  46. bool CardSourceCondition(CardSource cardSource)
  47. {
  48. return cardSource == card;
  49. }
  50. bool RootCondition(SelectCardEffect.Root root)
  51. {
  52. return true;
  53. }
  54. bool isUpDown()
  55. {
  56. return true;
  57. }
  58. }
  59. if (timing == EffectTiming.OptionSkill)
  60. {
  61. ActivateClass activateClass = new ActivateClass();
  62. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  63. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  64. cardEffects.Add(activateClass);
  65. string EffectDiscription()
  66. {
  67. return "[Main] <De-Digivolve 1> 3 of your opponent's Digimon. (Trash 1 card from the top of 3 of your opponent's Digimon. Stop trashing when you would trash a level 3 card or the Digimon's last card.) Then, delete 3 of your opponent's Digimon with play costs of 6 or less.";
  68. }
  69. bool CanSelectPermanentCondition(Permanent permanent)
  70. {
  71. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  72. {
  73. if (permanent.CanSelectBySkill(activateClass))
  74. {
  75. return true;
  76. }
  77. }
  78. return false;
  79. }
  80. bool CanSelectPermanentCondition1(Permanent permanent)
  81. {
  82. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  83. {
  84. if (permanent.CanSelectBySkill(activateClass))
  85. {
  86. if (permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 6)
  87. {
  88. return true;
  89. }
  90. }
  91. }
  92. return false;
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  97. }
  98. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  99. {
  100. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  101. {
  102. int maxCount = Math.Min(3, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  103. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  104. selectPermanentEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectPermanentCondition,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount,
  110. canNoSelect: false,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: SelectPermanentCoroutine,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Custom,
  115. cardEffect: activateClass);
  116. selectPermanentEffect.SetUpCustomMessage("Select Digimon to De-Digivolve.", "The opponent is selecting Digimon to De-Digivolve.");
  117. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  118. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  119. {
  120. Permanent selectedPermanent = permanent;
  121. if (selectedPermanent != null)
  122. {
  123. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  124. }
  125. yield return null;
  126. }
  127. }
  128. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  129. {
  130. int maxCount = Math.Min(3, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  131. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: CanSelectPermanentCondition1,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: maxCount,
  138. canNoSelect: false,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: null,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.Destroy,
  143. cardEffect: activateClass);
  144. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  145. }
  146. }
  147. }
  148. if (timing == EffectTiming.SecuritySkill)
  149. {
  150. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  151. card: card,
  152. cardEffects: ref cardEffects,
  153. effectName: $"De-Digivolve 1 and delete Digimon with 6 or less Cost");
  154. }
  155. return cardEffects;
  156. }
  157. }
  158. }