BT10_103.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_103 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.None)
  16. {
  17. ChangeCostClass changeCostClass = new ChangeCostClass();
  18. changeCostClass.SetUpICardEffect($"Use Cost -2", CanUseCondition, card);
  19. changeCostClass.SetUpChangeCostClass(
  20. changeCostFunc: ChangeCost,
  21. cardSourceCondition: CardSourceCondition,
  22. rootCondition: RootCondition,
  23. isUpDown: isUpDown,
  24. isCheckAvailability: () => false,
  25. isChangePayingCost: () => true);
  26. cardEffects.Add(changeCostClass);
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return card.Owner.GetBattleAreaDigimons().Count(permanent =>
  30. permanent.TopCard.CardColors.Contains(CardColor.Green) && permanent.IsSuspended) >= 2;
  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 -= 2;
  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] Suspend 1 of your opponent's Digimon. Then, return 1 of your opponent's suspended Digimon to the bottom of its owner's deck.";
  72. }
  73. bool CanSelectPermanentCondition(Permanent permanent)
  74. {
  75. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  76. }
  77. bool CanSelectPermanentCondition1(Permanent permanent)
  78. {
  79. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  80. {
  81. if (permanent.IsSuspended)
  82. {
  83. return true;
  84. }
  85. }
  86. return false;
  87. }
  88. bool CanUseCondition(Hashtable hashtable)
  89. {
  90. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  93. {
  94. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  95. {
  96. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  97. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  98. selectPermanentEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: CanSelectPermanentCondition,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: maxCount,
  104. canNoSelect: false,
  105. canEndNotMax: false,
  106. selectPermanentCoroutine: null,
  107. afterSelectPermanentCoroutine: null,
  108. mode: SelectPermanentEffect.Mode.Tap,
  109. cardEffect: activateClass);
  110. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  111. }
  112. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  113. {
  114. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  115. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  116. selectPermanentEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: CanSelectPermanentCondition1,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: maxCount,
  122. canNoSelect: false,
  123. canEndNotMax: false,
  124. selectPermanentCoroutine: null,
  125. afterSelectPermanentCoroutine: null,
  126. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  127. cardEffect: activateClass);
  128. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  129. }
  130. }
  131. }
  132. if (timing == EffectTiming.SecuritySkill)
  133. {
  134. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  135. card: card,
  136. cardEffects: ref cardEffects,
  137. effectName: $"Suspend 1 Digimon and return a suspended Digimon to bottom of deck");
  138. }
  139. return cardEffects;
  140. }
  141. }
  142. }