BT4_059.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT4_059 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OnDeclaration)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] <Digi-Burst 2> (Trash 2 of this Digimon's digivolution cards to activate the effect below.) - Suspend 1 of your opponent's Digimon.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. if (new IDigiBurst(card.PermanentOfThisCard(), 2, activateClass).CanDigiBurst())
  32. {
  33. return true;
  34. }
  35. }
  36. return false;
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  39. {
  40. yield return ContinuousController.instance.StartCoroutine(new IDigiBurst(card.PermanentOfThisCard(), 2, activateClass).DigiBurst());
  41. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  42. {
  43. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  44. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  45. selectPermanentEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: CanSelectPermanentCondition,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. maxCount: maxCount,
  51. canNoSelect: false,
  52. canEndNotMax: false,
  53. selectPermanentCoroutine: null,
  54. afterSelectPermanentCoroutine: null,
  55. mode: SelectPermanentEffect.Mode.Tap,
  56. cardEffect: activateClass);
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. }
  59. }
  60. }
  61. if (timing == EffectTiming.OnAllyAttack)
  62. {
  63. ActivateClass activateClass = new ActivateClass();
  64. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  65. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  66. activateClass.SetIsInheritedEffect(true);
  67. cardEffects.Add(activateClass);
  68. string EffectDiscription()
  69. {
  70. return "[When Attacking] If you have a Tamer in play, suspend 1 of your opponent's Digimon.";
  71. }
  72. bool CanSelectPermanentCondition(Permanent permanent)
  73. {
  74. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  75. }
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  79. }
  80. bool CanActivateCondition(Hashtable hashtable)
  81. {
  82. if (CardEffectCommons.IsExistOnBattleArea(card))
  83. {
  84. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  85. {
  86. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  87. {
  88. return true;
  89. }
  90. }
  91. }
  92. return false;
  93. }
  94. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  95. {
  96. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  97. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  98. selectPermanentEffect.SetUp(
  99. selectPlayer: card.Owner,
  100. canTargetCondition: CanSelectPermanentCondition,
  101. canTargetCondition_ByPreSelecetedList: null,
  102. canEndSelectCondition: null,
  103. maxCount: maxCount,
  104. canNoSelect: false,
  105. canEndNotMax: false,
  106. selectPermanentCoroutine: null,
  107. afterSelectPermanentCoroutine: null,
  108. mode: SelectPermanentEffect.Mode.Tap,
  109. cardEffect: activateClass);
  110. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  111. }
  112. }
  113. return cardEffects;
  114. }
  115. }