BT9_097.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. public class BT9_097 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.None)
  14. {
  15. ChangeCostClass changeCostClass = new ChangeCostClass();
  16. changeCostClass.SetUpICardEffect($"Play Cost -2", CanUseCondition, card);
  17. changeCostClass.SetUpChangeCostClass(changeCostFunc: ChangeCost, cardSourceCondition: CardSourceCondition, rootCondition: RootCondition, isUpDown: isUpDown, isCheckAvailability: () => false, isChangePayingCost: () => true);
  18. cardEffects.Add(changeCostClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("XAntibody") || cardSource.CardNames.Contains("X Antibody")) >= 1))
  22. {
  23. return true;
  24. }
  25. return false;
  26. }
  27. int ChangeCost(CardSource cardSource, int Cost, SelectCardEffect.Root root, List<Permanent> targetPermanents)
  28. {
  29. if (CardSourceCondition(cardSource))
  30. {
  31. if (RootCondition(root))
  32. {
  33. if (PermanentsCondition(targetPermanents))
  34. {
  35. Cost -= 2;
  36. }
  37. }
  38. }
  39. return Cost;
  40. }
  41. bool PermanentsCondition(List<Permanent> targetPermanents)
  42. {
  43. return true;
  44. }
  45. bool CardSourceCondition(CardSource cardSource)
  46. {
  47. return cardSource == card;
  48. }
  49. bool RootCondition(SelectCardEffect.Root root)
  50. {
  51. return true;
  52. }
  53. bool isUpDown()
  54. {
  55. return true;
  56. }
  57. }
  58. if (timing == EffectTiming.OptionSkill)
  59. {
  60. ActivateClass activateClass = new ActivateClass();
  61. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  62. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  63. cardEffects.Add(activateClass);
  64. string EffectDiscription()
  65. {
  66. return "[Main] Return 1 of your opponent's level 6 or lower Digimon to its owner's hand. Then, unsuspend 1 of your Digimon with [Garurumon] in its name.";
  67. }
  68. bool CanSelectPermanentCondition(Permanent permanent)
  69. {
  70. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  71. {
  72. if (permanent.TopCard.HasLevel)
  73. {
  74. if (permanent.Level <= 6)
  75. {
  76. return true;
  77. }
  78. }
  79. }
  80. return false;
  81. }
  82. bool CanSelectPermanentCondition1(Permanent permanent)
  83. {
  84. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  85. {
  86. if (permanent.TopCard.HasGarurumonName)
  87. {
  88. return true;
  89. }
  90. }
  91. return false;
  92. }
  93. bool CanUseCondition(Hashtable hashtable)
  94. {
  95. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  96. }
  97. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  98. {
  99. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  100. {
  101. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  102. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  103. selectPermanentEffect.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectPermanentCondition,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: maxCount,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: null,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.Bounce,
  114. cardEffect: activateClass);
  115. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  116. }
  117. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  118. {
  119. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  120. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  121. selectPermanentEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectPermanentCondition1,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: maxCount,
  127. canNoSelect: false,
  128. canEndNotMax: false,
  129. selectPermanentCoroutine: null,
  130. afterSelectPermanentCoroutine: null,
  131. mode: SelectPermanentEffect.Mode.UnTap,
  132. cardEffect: activateClass);
  133. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  134. }
  135. }
  136. }
  137. if (timing == EffectTiming.SecuritySkill)
  138. {
  139. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Return 1 level 6 or lower Digimon to hand and unsuspend your Digimon");
  140. }
  141. return cardEffects;
  142. }
  143. }