BT24_046.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. // Garurumon
  5. namespace DCGO.CardEffects.BT24
  6. {
  7. public class BT24_046 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool Condition(Permanent permanent)
  16. {
  17. return (permanent.TopCard.ContainsCardName("Gabumon")
  18. || permanent.TopCard.EqualsTraits("TS"))
  19. && permanent.TopCard.IsLevel3;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(Condition, 2, false, card, null));
  22. }
  23. #endregion
  24. #region Jamming
  25. if (timing == EffectTiming.None)
  26. {
  27. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  28. }
  29. #endregion
  30. #region OP/WD Shared
  31. string SharedEffectName() => "Suspend 1 opponent's Digimon.";
  32. string SharedEffectDescription(string tag) => $"[{tag}] Suspend 1 of your opponent's Digimon.";
  33. bool CanSelectPermanentConditionShared(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  36. }
  37. bool SharedCanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleArea(card);
  40. }
  41. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  42. {
  43. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared))
  44. {
  45. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentConditionShared));
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: CanSelectPermanentConditionShared,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: maxCount,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: null,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Tap,
  58. cardEffect: activateClass);
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. }
  61. }
  62. #endregion
  63. #region On Play
  64. if (timing == EffectTiming.OnEnterFieldAnyone)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  68. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("On Play"));
  69. cardEffects.Add(activateClass);
  70. bool CanUseCondition(Hashtable hashtable)
  71. {
  72. return CardEffectCommons.CanTriggerOnPlay(hashtable, card)
  73. && CardEffectCommons.IsExistOnBattleArea(card);
  74. }
  75. }
  76. #endregion
  77. #region When Digivolving
  78. if (timing == EffectTiming.OnEnterFieldAnyone)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect(SharedEffectName(), CanUseCondition, card);
  82. activateClass.SetUpActivateClass(SharedCanActivateCondition, (hashTable) => SharedActivateCoroutine(hashTable, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  83. cardEffects.Add(activateClass);
  84. bool CanUseCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card)
  87. && CardEffectCommons.IsExistOnBattleArea(card);
  88. }
  89. }
  90. #endregion
  91. #region Inherit - When Attacking
  92. if (timing == EffectTiming.OnAllyAttack)
  93. {
  94. ActivateClass activateClass = new ActivateClass();
  95. activateClass.SetUpICardEffect("Suspend 1 opponent's Digimon", CanUseCondition, card);
  96. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  97. activateClass.SetHashString("BT24_046_Inherited");
  98. activateClass.SetIsInheritedEffect(true);
  99. cardEffects.Add(activateClass);
  100. string EffectDescription()
  101. {
  102. return "[When Attacking] [Once Per Turn] Suspend 1 of your opponent's Digimon.";
  103. }
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. return CardEffectCommons.CanTriggerOnAttack(hashtable, card)
  107. && CardEffectCommons.IsExistOnBattleArea(card);
  108. }
  109. bool CanActivateCondition(Hashtable hashtable)
  110. {
  111. return CardEffectCommons.IsExistOnBattleArea(card);
  112. }
  113. bool CanSelectPermanentCondition(Permanent permanent)
  114. {
  115. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  120. {
  121. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  122. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  123. selectPermanentEffect.SetUp(
  124. selectPlayer: card.Owner,
  125. canTargetCondition: CanSelectPermanentCondition,
  126. canTargetCondition_ByPreSelecetedList: null,
  127. canEndSelectCondition: null,
  128. maxCount: maxCount,
  129. canNoSelect: false,
  130. canEndNotMax: false,
  131. selectPermanentCoroutine: null,
  132. afterSelectPermanentCoroutine: null,
  133. mode: SelectPermanentEffect.Mode.Tap,
  134. cardEffect: activateClass);
  135. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  136. }
  137. }
  138. }
  139. #endregion
  140. return cardEffects;
  141. }
  142. }
  143. }