BT24_054.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. //Ryudamon
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_054 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Black box Digivolution requirement
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.EqualsCardName("Kyokyomon")
  19. || (targetPermanent.TopCard.IsLevel2
  20. && (targetPermanent.TopCard.EqualsTraits("DigiPolice")
  21. || targetPermanent.TopCard.EqualsTraits("SEEKERS")));
  22. }
  23. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  24. }
  25. #endregion
  26. #region Your Turn
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Digivolve into a [Hisyaryumon]] in the hand", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  32. cardEffects.Add(activateClass);
  33. string EffectDescription()
  34. {
  35. return "[Your Turn] When any of your [Shuu Yulin]s are played, this Digimon may digivolve into [Hisyaryumon] in the hand for a digivolution cost of 3, ignoring digivolution requirements.";
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  40. && CardEffectCommons.IsOwnerTurn(card)
  41. && CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PlayedPermanentCondition);
  42. }
  43. bool PlayedPermanentCondition(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  46. && permanent.TopCard.EqualsCardName("Shuu Yulin");
  47. }
  48. bool CanSelectCardToDigivolveInto(CardSource cardSource)
  49. {
  50. return cardSource.ContainsCardName("Hisyaryumon");
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  55. && CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardToDigivolveInto);
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable hashtable)
  58. {
  59. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  60. targetPermanent: card.PermanentOfThisCard(),
  61. cardCondition: CanSelectCardToDigivolveInto,
  62. payCost: true,
  63. reduceCostTuple: null,
  64. fixedCostTuple: null,
  65. ignoreDigivolutionRequirementFixedCost: 3,
  66. isHand: true,
  67. activateClass: activateClass,
  68. successProcess: null));
  69. }
  70. }
  71. #endregion
  72. #region Inherited effect
  73. if (timing == EffectTiming.OnTappedAnyone)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Suspend opponent's Digimon or Tamers with play cost less than this Digimon.", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  78. activateClass.SetIsInheritedEffect(true);
  79. activateClass.SetHashString("BT24_054_Inherited");
  80. cardEffects.Add(activateClass);
  81. string EffectDescription()
  82. {
  83. return "[All Turns] [Once Per Turn] When this Digimon suspends, suspend 1 of your opponent's Digimon or Tamers with as high or lower a play cost as this Digimon.";
  84. }
  85. bool CanSelectPermanentCondition(Permanent permanent)
  86. {
  87. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  88. && permanent.TopCard.GetCostItself <= card.PermanentOfThisCard().TopCard.GetCostItself
  89. && (permanent.TopCard.IsDigimon || permanent.TopCard.IsTamer);
  90. }
  91. bool CanUseCondition(Hashtable hashtable)
  92. {
  93. return CardEffectCommons.IsExistOnBattleArea(card)
  94. && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. return CardEffectCommons.IsExistOnBattleArea(card);
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  101. {
  102. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  103. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  104. selectPermanentEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectPermanentCondition,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount,
  110. canNoSelect: false,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: null,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Tap,
  115. cardEffect: activateClass);
  116. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  117. }
  118. }
  119. # endregion
  120. return cardEffects;
  121. }
  122. }
  123. }