BT24_055.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. //Ginryumon
  6. namespace DCGO.CardEffects.BT24
  7. {
  8. public class BT24_055 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternate Digivolution
  14. if (timing == EffectTiming.None)
  15. {
  16. static bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return (targetPermanent.TopCard.EqualsTraits("DigiPolice")
  19. || targetPermanent.TopCard.EqualsTraits("SEEKERS"))
  20. && targetPermanent.TopCard.IsLevel3;
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  23. }
  24. #endregion
  25. #region Blocker
  26. if (timing == EffectTiming.None)
  27. {
  28. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  29. }
  30. #endregion
  31. #region Shared OP/WD
  32. string SharedEffectName() => "Place [Shuu Yulin] under to prevent De-Digivolve on 1 Digimon.";
  33. string SharedEffectDescription(string tag) => $"[{tag}] By placing 1 [Shuu Yulin] from your hand as this Digimon's bottom digivolution card, your opponent's <De-Digivolve> effects don't affect 1 of your [DigiPolice] or [SEEKERS] trait Digimon until their turn ends.";
  34. bool SharedCanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  37. && card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  38. }
  39. bool CanSelectCardCondition(CardSource cardSource)
  40. {
  41. return cardSource.EqualsCardName("Shuu Yulin");
  42. }
  43. bool CanSelectPermanentConditionShared(Permanent permanent)
  44. {
  45. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  46. && (permanent.TopCard.EqualsTraits("DigiPolice")
  47. || permanent.TopCard.EqualsTraits("SEEKERS"));
  48. }
  49. #region Can't Be De-Digivolved
  50. Permanent selectedPermanent = null;
  51. IEnumerator AfterSelectPermanent(List<Permanent> permanents)
  52. {
  53. if (permanents.Count >= 1)
  54. selectedPermanent = permanents[0];
  55. yield return null;
  56. }
  57. void ActivateDeDigivolveProtection()
  58. {
  59. ImmuneFromDeDigivolveClass immuneFromDeDigivolveClass = new ImmuneFromDeDigivolveClass();
  60. immuneFromDeDigivolveClass.SetUpICardEffect("Isn't affected by <De-Digivolve>", CanUseDeDigivolveCondition, selectedPermanent.TopCard);
  61. immuneFromDeDigivolveClass.SetUpImmuneFromDeDigivolveClass(PermanentCondition: PermanentDeDigivolveCondition);
  62. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => immuneFromDeDigivolveClass);
  63. }
  64. bool CanUseDeDigivolveCondition(Hashtable hashtable1)
  65. {
  66. return selectedPermanent.TopCard != null;
  67. }
  68. bool PermanentDeDigivolveCondition(Permanent permanent)
  69. {
  70. return permanent == selectedPermanent;
  71. }
  72. #endregion
  73. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  74. {
  75. List<CardSource> selectedCards = new List<CardSource>();
  76. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  77. selectHandEffect.SetUp(
  78. selectPlayer: card.Owner,
  79. canTargetCondition: CanSelectCardCondition,
  80. canTargetCondition_ByPreSelecetedList: null,
  81. canEndSelectCondition: null,
  82. maxCount: 1,
  83. canNoSelect: true,
  84. canEndNotMax: false,
  85. isShowOpponent: true,
  86. selectCardCoroutine: SelectCardCoroutine,
  87. afterSelectCardCoroutine: null,
  88. mode: SelectHandEffect.Mode.Custom,
  89. cardEffect: activateClass);
  90. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  91. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  92. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  93. IEnumerator SelectCardCoroutine(CardSource source)
  94. {
  95. if (source != null)
  96. selectedCards.Add(source);
  97. yield return null;
  98. }
  99. if (selectedCards.Count >= 1)
  100. {
  101. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  102. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  103. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared));
  104. selectPermanentEffect.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: CanSelectPermanentConditionShared,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount1,
  110. canNoSelect: false,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: null,
  113. afterSelectPermanentCoroutine: AfterSelectPermanent,
  114. mode: SelectPermanentEffect.Mode.Custom,
  115. cardEffect: activateClass);
  116. selectPermanentEffect.SetUpCustomMessage(
  117. "Select Digimon that will get effects.",
  118. "The opponent is selecting Digimon that will get effects.");
  119. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  120. if (selectedPermanent != null)
  121. {
  122. ActivateDeDigivolveProtection();
  123. }
  124. }
  125. }
  126. #endregion
  127. #region On Play
  128. if (timing == EffectTiming.OnEnterFieldAnyone)
  129. {
  130. ActivateClass activateClass = new ActivateClass();
  131. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  132. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, true, SharedEffectDescription("On Play"));
  133. cardEffects.Add(activateClass);
  134. bool CanUseCondition(Hashtable hashtable)
  135. {
  136. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  137. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  138. }
  139. }
  140. #endregion
  141. #region When Digivolving
  142. if (timing == EffectTiming.OnEnterFieldAnyone)
  143. {
  144. ActivateClass activateClass = new ActivateClass();
  145. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  146. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, true, SharedEffectDescription("When Digivolving"));
  147. cardEffects.Add(activateClass);
  148. bool CanUseCondition(Hashtable hashtable)
  149. {
  150. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  151. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  152. }
  153. }
  154. #endregion
  155. #region Inherited
  156. if (timing == EffectTiming.OnTappedAnyone)
  157. {
  158. ActivateClass activateClass = new ActivateClass();
  159. activateClass.SetUpICardEffect("Suspend opponent's Digimon or Tamers with play cost less than this Digimon.", CanUseCondition, card);
  160. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  161. activateClass.SetIsInheritedEffect(true);
  162. activateClass.SetHashString("BT24_055_Inherited");
  163. cardEffects.Add(activateClass);
  164. string EffectDescription()
  165. {
  166. 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 playcost as this digimon.";
  167. }
  168. bool CanSelectPermanentCondition(Permanent permanent)
  169. {
  170. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  171. && permanent.TopCard.HasPlayCost
  172. && (permanent.IsDigimon
  173. || permanent.IsTamer)
  174. && permanent.TopCard.GetCostItself <= card.PermanentOfThisCard().TopCard.GetCostItself;
  175. }
  176. bool CanActivateCondition(Hashtable hashtable)
  177. {
  178. return CardEffectCommons.IsExistOnBattleArea(card);
  179. }
  180. bool CanUseCondition(Hashtable hashtable)
  181. {
  182. return CardEffectCommons.IsExistOnBattleArea(card)
  183. && CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card);
  184. }
  185. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  186. {
  187. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  188. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  189. selectPermanentEffect.SetUp(
  190. selectPlayer: card.Owner,
  191. canTargetCondition: CanSelectPermanentCondition,
  192. canTargetCondition_ByPreSelecetedList: null,
  193. canEndSelectCondition: null,
  194. maxCount: maxCount,
  195. canNoSelect: false,
  196. canEndNotMax: false,
  197. selectPermanentCoroutine: null,
  198. afterSelectPermanentCoroutine: null,
  199. mode: SelectPermanentEffect.Mode.Tap,
  200. cardEffect: activateClass);
  201. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  202. }
  203. }
  204. #endregion
  205. return cardEffects;
  206. }
  207. }
  208. }