BT9_021.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 BT9_021 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  18. activateClass.SetHashString("Draw1_BT9_021");
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Your Turn][Once Per Turn] When you play a blue Tamer, <Draw 1>. (Draw 1 card from your deck.)";
  23. }
  24. bool PermanentCondition(Permanent permanent)
  25. {
  26. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  27. {
  28. if (permanent.IsTamer)
  29. {
  30. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  31. {
  32. return true;
  33. }
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. if (CardEffectCommons.IsExistOnBattleArea(card))
  41. {
  42. if (CardEffectCommons.IsOwnerTurn(card))
  43. {
  44. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  45. {
  46. return true;
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. if (CardEffectCommons.IsExistOnBattleArea(card))
  55. {
  56. return true;
  57. }
  58. return false;
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  63. }
  64. }
  65. if (timing == EffectTiming.OnAddHand)
  66. {
  67. ActivateClass activateClass = new ActivateClass();
  68. activateClass.SetUpICardEffect("Return 1 level 3 Digimon to hand", CanUseCondition, card);
  69. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  70. activateClass.SetIsInheritedEffect(true);
  71. activateClass.SetHashString("Bounce_BT9_021");
  72. cardEffects.Add(activateClass);
  73. string EffectDiscription()
  74. {
  75. return "[Your Turn][Once Per Turn] When an effect adds a card to your hand, return 1 of your opponent's level 3 Digimon to its owner's hand.";
  76. }
  77. bool CanSelectPermanentCondition(Permanent permanent)
  78. {
  79. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  80. {
  81. if (permanent.Level == 3)
  82. {
  83. if (permanent.TopCard.HasLevel)
  84. {
  85. return true;
  86. }
  87. }
  88. }
  89. return false;
  90. }
  91. bool CanUseCondition(Hashtable hashtable)
  92. {
  93. if (CardEffectCommons.IsExistOnBattleArea(card))
  94. {
  95. if (CardEffectCommons.IsOwnerTurn(card))
  96. {
  97. if (CardEffectCommons.CanTriggerWhenAddHand(hashtable, player => player == card.Owner, cardEffect => cardEffect != null))
  98. {
  99. return true;
  100. }
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. return true;
  110. }
  111. return false;
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  114. {
  115. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  116. {
  117. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  118. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  119. selectPermanentEffect.SetUp(
  120. selectPlayer: card.Owner,
  121. canTargetCondition: CanSelectPermanentCondition,
  122. canTargetCondition_ByPreSelecetedList: null,
  123. canEndSelectCondition: null,
  124. maxCount: maxCount,
  125. canNoSelect: false,
  126. canEndNotMax: false,
  127. selectPermanentCoroutine: null,
  128. afterSelectPermanentCoroutine: null,
  129. mode: SelectPermanentEffect.Mode.Bounce,
  130. cardEffect: activateClass);
  131. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  132. }
  133. }
  134. }
  135. return cardEffects;
  136. }
  137. }