BT20_039.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_039 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution Requirement
  11. if (timing == EffectTiming.None)
  12. {
  13. static bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.IsLevel3 && targetPermanent.TopCard.EqualsTraits("ACCEL");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  18. }
  19. #endregion
  20. #region On Play
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[On Play] Suspend 1 of your opponent's Digimon.";
  30. }
  31. bool IsOpponentsDigimon(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  42. CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon);
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable hashtable)
  45. {
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: IsOpponentsDigimon,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: 1,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: null,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Tap,
  58. cardEffect: activateClass);
  59. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon suspend.", "The opponent is selecting 1 Digimon to suspend.");
  60. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  61. }
  62. }
  63. #endregion
  64. #region When Digivolving
  65. if (timing == EffectTiming.OnEnterFieldAnyone)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect("Suspend 1 of your opponent's Digimon", CanUseCondition, card);
  69. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  70. cardEffects.Add(activateClass);
  71. string EffectDiscription()
  72. {
  73. return "[When Digivolving] Suspend 1 of your opponent's Digimon.";
  74. }
  75. bool IsOpponentsDigimon(Permanent permanent)
  76. {
  77. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  78. }
  79. bool CanUseCondition(Hashtable hashtable)
  80. {
  81. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  82. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  83. }
  84. bool CanActivateCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  87. CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon);
  88. }
  89. IEnumerator ActivateCoroutine(Hashtable hashtable)
  90. {
  91. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  92. selectPermanentEffect.SetUp(
  93. selectPlayer: card.Owner,
  94. canTargetCondition: IsOpponentsDigimon,
  95. canTargetCondition_ByPreSelecetedList: null,
  96. canEndSelectCondition: null,
  97. maxCount: 1,
  98. canNoSelect: false,
  99. canEndNotMax: false,
  100. selectPermanentCoroutine: null,
  101. afterSelectPermanentCoroutine: null,
  102. mode: SelectPermanentEffect.Mode.Tap,
  103. cardEffect: activateClass);
  104. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon suspend.", "The opponent is selecting 1 Digimon to suspend.");
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. }
  107. }
  108. #endregion
  109. #region Piercing - ESS
  110. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  111. {
  112. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: true, card: card, condition: null));
  113. }
  114. #endregion
  115. return cardEffects;
  116. }
  117. }
  118. }