BT15_063.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_063 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  15. }
  16. if (timing == EffectTiming.None)
  17. {
  18. static bool PermanentCondition(Permanent targetPermanent)
  19. {
  20. if (targetPermanent.TopCard.CardTraits.Contains("DigiPolice") || targetPermanent.TopCard.HasXAntibodyTraits)
  21. {
  22. if (targetPermanent.TopCard.HasLevel)
  23. {
  24. if (targetPermanent.Level == 4)
  25. {
  26. return true;
  27. }
  28. }
  29. }
  30. return false;
  31. }
  32. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  33. }
  34. if (timing == EffectTiming.OnTappedAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Unsuspend a Digimon with the [Beast Dragon] or [DigiPolice] trait.", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  39. activateClass.SetIsInheritedEffect(true);
  40. activateClass.SetHashString("unsuspend_BT15_063");
  41. cardEffects.Add(activateClass);
  42. string EffectDiscription()
  43. {
  44. return "[All Turns][Once Per Turn] When an effect suspends another Digimon or Tamer, unsuspend 1 of your Digimon with the [Beast Dragon] or [DigiPolice] trait.";
  45. }
  46. bool PermanentCondition(Permanent permanent)
  47. {
  48. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  49. {
  50. if (permanent.IsDigimon)
  51. {
  52. if (permanent.TopCard.HasDigiPoliceTraits || permanent.TopCard.HasBeastDragonTraits)
  53. {
  54. if (permanent.IsSuspended)
  55. {
  56. return true;
  57. }
  58. }
  59. }
  60. }
  61. return false;
  62. }
  63. bool CanUseCondition(Hashtable hashtable)
  64. {
  65. if (CardEffectCommons.IsExistOnBattleArea(card))
  66. {
  67. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => CardEffectCommons.IsPermanentExistsOnBattleArea(permanent) && permanent != card.PermanentOfThisCard()))
  68. {
  69. if (CardEffectCommons.IsByEffect(hashtable, null))
  70. {
  71. return true;
  72. }
  73. }
  74. }
  75. return false;
  76. }
  77. bool CanActivateCondition(Hashtable hashtable)
  78. {
  79. if (CardEffectCommons.IsExistOnBattleArea(card))
  80. {
  81. return true;
  82. }
  83. return false;
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  86. {
  87. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  88. {
  89. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  90. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  91. selectPermanentEffect.SetUp(
  92. selectPlayer: card.Owner,
  93. canTargetCondition: PermanentCondition,
  94. canTargetCondition_ByPreSelecetedList: null,
  95. canEndSelectCondition: CanEndSelectCondition,
  96. maxCount: maxCount,
  97. canNoSelect: false,
  98. canEndNotMax: true,
  99. selectPermanentCoroutine: null,
  100. afterSelectPermanentCoroutine: null,
  101. mode: SelectPermanentEffect.Mode.UnTap,
  102. cardEffect: activateClass);
  103. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  104. bool CanEndSelectCondition(List<Permanent> permanents)
  105. {
  106. if (CardEffectCommons.HasNoElement(permanents))
  107. {
  108. return false;
  109. }
  110. return true;
  111. }
  112. }
  113. }
  114. }
  115. if (timing == EffectTiming.OnTappedAnyone)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect("This Digimon digivolves", CanUseCondition, card);
  119. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  120. cardEffects.Add(activateClass);
  121. string EffectDiscription()
  122. {
  123. return "[All Turns] When an effect suspends another Digimon or Tamer, if this Digimon has a Tamer card with the [DigiPolice] trait in it's digivolution cards, you may digivolve this Digimon into a Digimon card with the [Beast Dragon] or [DigiPolice] trait from your hand without paying the cost.";
  124. }
  125. bool CanSelectCardCondition(CardSource cardSource)
  126. {
  127. if (cardSource.HasBeastDragonTraits || cardSource.HasDigiPoliceTraits)
  128. {
  129. if (cardSource.IsDigimon)
  130. {
  131. return true;
  132. }
  133. }
  134. return false;
  135. }
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. if (CardEffectCommons.IsExistOnBattleArea(card))
  139. {
  140. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, (permanent) => CardEffectCommons.IsExistOnBattleAreaDigimon(card) && permanent != card.PermanentOfThisCard()))
  141. {
  142. if (CardEffectCommons.IsByEffect(hashtable, null))
  143. {
  144. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => (cardSource.CardTraits.Contains("DigiPolice") && cardSource.IsTamer)) >= 1)
  145. {
  146. return true;
  147. }
  148. }
  149. }
  150. }
  151. return false;
  152. }
  153. bool CanActivateCondition(Hashtable hashtable)
  154. {
  155. if (CardEffectCommons.IsExistOnBattleArea(card))
  156. {
  157. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  158. {
  159. return true;
  160. }
  161. }
  162. return false;
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  165. {
  166. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  167. targetPermanent: card.PermanentOfThisCard(),
  168. cardCondition: CanSelectCardCondition,
  169. payCost: false,
  170. reduceCostTuple: null,
  171. fixedCostTuple: null,
  172. ignoreDigivolutionRequirementFixedCost: -1,
  173. isHand: true,
  174. activateClass: activateClass,
  175. successProcess: null));
  176. }
  177. }
  178. return cardEffects;
  179. }
  180. }
  181. }