BT13_029.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT13
  4. {
  5. public class BT13_029 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnAllyAttack)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("This Digimon's attack target can't be switched", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[When Attacking] If your opponent has 8 or more cards in their hand, for the turn, this Digimon's attack target can't be switched.";
  19. }
  20. bool CanUseCondition(Hashtable hashtable)
  21. {
  22. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  23. }
  24. bool CanActivateCondition(Hashtable hashtable)
  25. {
  26. if (CardEffectCommons.IsExistOnBattleArea(card))
  27. {
  28. if (card.Owner.Enemy.HandCards.Count >= 8)
  29. {
  30. return true;
  31. }
  32. }
  33. return false;
  34. }
  35. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  36. {
  37. Permanent selectedPermanent = card.PermanentOfThisCard();
  38. if (selectedPermanent != null)
  39. {
  40. CanNotSwitchAttackTargetClass canNotSwitchAttackTargetClass = new CanNotSwitchAttackTargetClass();
  41. canNotSwitchAttackTargetClass.SetUpICardEffect("This Digimon's attack target can't be switched", CanUseCondition1, selectedPermanent.TopCard);
  42. canNotSwitchAttackTargetClass.SetUpCanNotSwitchAttackTargetClass(PermanentCondition: PermanentCondition);
  43. selectedPermanent.UntilEachTurnEndEffects.Add((_timing) => canNotSwitchAttackTargetClass);
  44. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  45. bool CanUseCondition1(Hashtable hashtable)
  46. {
  47. if (selectedPermanent.TopCard != null)
  48. {
  49. return true;
  50. }
  51. return false;
  52. }
  53. bool PermanentCondition(Permanent permanent)
  54. {
  55. if (permanent != null)
  56. {
  57. if (permanent.TopCard != null)
  58. {
  59. if (permanent == selectedPermanent)
  60. {
  61. return true;
  62. }
  63. }
  64. }
  65. return false;
  66. }
  67. }
  68. }
  69. }
  70. if (timing == EffectTiming.OnAddHand)
  71. {
  72. ActivateClass activateClass = new ActivateClass();
  73. activateClass.SetUpICardEffect("Unsuspend this Digimon", CanUseCondition, card);
  74. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  75. activateClass.SetIsInheritedEffect(true);
  76. activateClass.SetHashString("Unsuspend_BT13_029");
  77. cardEffects.Add(activateClass);
  78. string EffectDiscription()
  79. {
  80. return "[All Turns][Once Per Turn] When an effect adds cards to your opponent's hand, unsuspend this Digimon.";
  81. }
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.IsExistOnBattleArea(card))
  85. {
  86. if (CardEffectCommons.CanTriggerWhenAddHand(hashtable, player => player == card.Owner.Enemy, cardEffect => cardEffect != null))
  87. {
  88. return true;
  89. }
  90. }
  91. return false;
  92. }
  93. bool CanActivateCondition(Hashtable hashtable)
  94. {
  95. if (CardEffectCommons.IsExistOnBattleArea(card))
  96. {
  97. return true;
  98. }
  99. return false;
  100. }
  101. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  102. {
  103. Permanent selectedPermanent = card.PermanentOfThisCard();
  104. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { selectedPermanent }, activateClass).Unsuspend());
  105. }
  106. }
  107. return cardEffects;
  108. }
  109. }
  110. }