BT11_096.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT11
  5. {
  6. public class BT11_096 : 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($"Use 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) => permanent.TopCard.CardColors.Contains(CardColor.Red) && permanent.IsTamer))
  26. {
  27. return true;
  28. }
  29. return false;
  30. }
  31. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  32. {
  33. if (CardSourceCondition(cardSource))
  34. {
  35. if (RootCondition(root))
  36. {
  37. if (PermanentsCondition(targetPermanents))
  38. {
  39. Cost -= 1;
  40. }
  41. }
  42. }
  43. return Cost;
  44. }
  45. bool PermanentsCondition(List<Permanent> targetPermanents)
  46. {
  47. return true;
  48. }
  49. bool CardSourceCondition(CardSource cardSource)
  50. {
  51. return cardSource == card;
  52. }
  53. bool RootCondition(SelectCardEffect.Root root)
  54. {
  55. return true;
  56. }
  57. bool isUpDown()
  58. {
  59. return true;
  60. }
  61. }
  62. if (timing == EffectTiming.OptionSkill)
  63. {
  64. ActivateClass activateClass = new ActivateClass();
  65. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  66. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  67. cardEffects.Add(activateClass);
  68. string EffectDiscription()
  69. {
  70. return "[Main] Delete 1 of your opponent's Digimon with the lowest DP.";
  71. }
  72. bool CanSelectPermanentCondition(Permanent permanent)
  73. {
  74. return CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy);
  75. }
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  79. }
  80. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  81. {
  82. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  83. {
  84. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. selectPermanentEffect.SetUp(
  87. selectPlayer: card.Owner,
  88. canTargetCondition: CanSelectPermanentCondition,
  89. canTargetCondition_ByPreSelecetedList: null,
  90. canEndSelectCondition: null,
  91. maxCount: maxCount,
  92. canNoSelect: false,
  93. canEndNotMax: false,
  94. selectPermanentCoroutine: null,
  95. afterSelectPermanentCoroutine: null,
  96. mode: SelectPermanentEffect.Mode.Destroy,
  97. cardEffect: activateClass);
  98. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  99. }
  100. }
  101. }
  102. if (timing == EffectTiming.SecuritySkill)
  103. {
  104. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  105. card: card,
  106. cardEffects: ref cardEffects,
  107. effectName: $"Delete 1 Digimon with the lowest DP");
  108. }
  109. return cardEffects;
  110. }
  111. }
  112. }