BT11_110.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_110 : 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.Purple) && 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] Delete 3 of your opponent's unsuspended level 5 or lower Digimon.";
  72. }
  73. bool CanSelectPermanentCondition(Permanent permanent)
  74. {
  75. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  76. {
  77. if (permanent.Level <= 5)
  78. {
  79. if (permanent.TopCard.HasLevel)
  80. {
  81. if (!permanent.IsSuspended)
  82. {
  83. return true;
  84. }
  85. }
  86. }
  87. }
  88. return false;
  89. }
  90. bool CanUseCondition(Hashtable hashtable)
  91. {
  92. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  93. }
  94. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  95. {
  96. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  97. {
  98. int maxCount = Math.Min(3, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  99. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  100. selectPermanentEffect.SetUp(
  101. selectPlayer: card.Owner,
  102. canTargetCondition: CanSelectPermanentCondition,
  103. canTargetCondition_ByPreSelecetedList: null,
  104. canEndSelectCondition: null,
  105. maxCount: maxCount,
  106. canNoSelect: false,
  107. canEndNotMax: false,
  108. selectPermanentCoroutine: null,
  109. afterSelectPermanentCoroutine: null,
  110. mode: SelectPermanentEffect.Mode.Destroy,
  111. cardEffect: activateClass);
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. }
  114. }
  115. }
  116. if (timing == EffectTiming.SecuritySkill)
  117. {
  118. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  119. card: card,
  120. cardEffects: ref cardEffects,
  121. effectName: $"Delete 3 level 5 or lower unsuspended Digimon");
  122. }
  123. return cardEffects;
  124. }
  125. }
  126. }