BT10_098.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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_098 : 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. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 2)
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  36. {
  37. if (CardSourceCondition(cardSource))
  38. {
  39. if (RootCondition(root))
  40. {
  41. if (PermanentsCondition(targetPermanents))
  42. {
  43. Cost -= 2;
  44. }
  45. }
  46. }
  47. return Cost;
  48. }
  49. bool PermanentsCondition(List<Permanent> targetPermanents)
  50. {
  51. return true;
  52. }
  53. bool CardSourceCondition(CardSource cardSource)
  54. {
  55. return cardSource == card;
  56. }
  57. bool RootCondition(SelectCardEffect.Root root)
  58. {
  59. return true;
  60. }
  61. bool isUpDown()
  62. {
  63. return true;
  64. }
  65. }
  66. if (timing == EffectTiming.OptionSkill)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  70. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  71. cardEffects.Add(activateClass);
  72. string EffectDiscription()
  73. {
  74. return "[Main] Return 1 of your opponent's level 6 or higher Digimon to its owner's hand.";
  75. }
  76. bool CanSelectPermanentCondition(Permanent permanent)
  77. {
  78. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  79. {
  80. if (permanent.Level >= 6)
  81. {
  82. if (permanent.TopCard.HasLevel)
  83. {
  84. return true;
  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(1, 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.Bounce,
  111. cardEffect: activateClass);
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. }
  114. }
  115. }
  116. if (timing == EffectTiming.SecuritySkill)
  117. {
  118. ActivateClass activateClass = new ActivateClass();
  119. activateClass.SetUpICardEffect($"Return 1 Digimon to hand", CanUseCondition, card);
  120. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  121. activateClass.SetIsSecurityEffect(true);
  122. cardEffects.Add(activateClass);
  123. string EffectDiscription()
  124. {
  125. return "[Security] Return 1 of your opponent's Digimon to its owner's hand.";
  126. }
  127. bool CanSelectPermanentCondition(Permanent permanent)
  128. {
  129. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  130. {
  131. return true;
  132. }
  133. return false;
  134. }
  135. bool CanUseCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  138. }
  139. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  140. {
  141. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  142. {
  143. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  144. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  145. selectPermanentEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: CanSelectPermanentCondition,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: maxCount,
  151. canNoSelect: false,
  152. canEndNotMax: false,
  153. selectPermanentCoroutine: null,
  154. afterSelectPermanentCoroutine: null,
  155. mode: SelectPermanentEffect.Mode.Bounce,
  156. cardEffect: activateClass);
  157. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  158. }
  159. }
  160. }
  161. return cardEffects;
  162. }
  163. }
  164. }