BT16_068.cs 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_068 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play
  12. if (timing == EffectTiming.OnEnterFieldAnyone)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("1 of your Digimon gains [Blocker]", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[On Play] 1 of your Digimon gains [Blocker] until the end of your opponent's turn.";
  21. }
  22. bool CanSelectPermanentCondition(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  29. }
  30. bool CanActivateCondition(Hashtable hashtable)
  31. {
  32. if (CardEffectCommons.IsExistOnBattleArea(card))
  33. {
  34. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  35. {
  36. return true;
  37. }
  38. }
  39. return false;
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  44. {
  45. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  46. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  47. selectPermanentEffect.SetUp(
  48. selectPlayer: card.Owner,
  49. canTargetCondition: CanSelectPermanentCondition,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. maxCount: maxCount,
  53. canNoSelect: false,
  54. canEndNotMax: false,
  55. selectPermanentCoroutine: SelectPermanentCoroutine,
  56. afterSelectPermanentCoroutine: null,
  57. mode: SelectPermanentEffect.Mode.Custom,
  58. cardEffect: activateClass);
  59. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Blocker.", "The opponent is selecting 1 Digimon that will get Blocker.");
  60. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  61. IEnumerator SelectPermanentCoroutine(Permanent selectedPermanent)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  64. targetPermanent: selectedPermanent,
  65. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  66. activateClass: activateClass));
  67. }
  68. }
  69. }
  70. }
  71. #endregion
  72. #region When Digivolving
  73. if (timing == EffectTiming.OnEnterFieldAnyone)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("1 of your Digimon gains [Blocker]", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  78. cardEffects.Add(activateClass);
  79. string EffectDiscription()
  80. {
  81. return "[When Digivolving] 1 of your Digimon gains [Blocker] until the end of your opponent's turn.";
  82. }
  83. bool CanSelectPermanentCondition(Permanent permanent)
  84. {
  85. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  86. }
  87. bool CanUseCondition(Hashtable hashtable)
  88. {
  89. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  90. }
  91. bool CanActivateCondition(Hashtable hashtable)
  92. {
  93. if (CardEffectCommons.IsExistOnBattleArea(card))
  94. {
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  96. {
  97. return true;
  98. }
  99. }
  100. return false;
  101. }
  102. IEnumerator ActivateCoroutine(Hashtable hashtable)
  103. {
  104. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  105. {
  106. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  107. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  108. selectPermanentEffect.SetUp(
  109. selectPlayer: card.Owner,
  110. canTargetCondition: CanSelectPermanentCondition,
  111. canTargetCondition_ByPreSelecetedList: null,
  112. canEndSelectCondition: null,
  113. maxCount: maxCount,
  114. canNoSelect: false,
  115. canEndNotMax: false,
  116. selectPermanentCoroutine: SelectPermanentCoroutine,
  117. afterSelectPermanentCoroutine: null,
  118. mode: SelectPermanentEffect.Mode.Custom,
  119. cardEffect: activateClass);
  120. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Blocker.", "The opponent is selecting 1 Digimon that will get Blocker.");
  121. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  122. IEnumerator SelectPermanentCoroutine(Permanent selectedPermanent)
  123. {
  124. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(
  125. targetPermanent: selectedPermanent,
  126. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  127. activateClass: activateClass));
  128. }
  129. }
  130. }
  131. }
  132. #endregion
  133. #region Inherit
  134. if (timing == EffectTiming.OnEnterFieldAnyone)
  135. {
  136. ActivateClass activateClass = new ActivateClass();
  137. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  138. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  139. activateClass.SetIsInheritedEffect(true);
  140. activateClass.SetHashString("Draw1_BT16_068");
  141. cardEffects.Add(activateClass);
  142. string EffectDiscription()
  143. {
  144. return "[Your Turn] When an effect plays one of your Digimon, Draw 1.";
  145. }
  146. bool PermanentCondition(Permanent permanent)
  147. {
  148. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  149. {
  150. if (permanent.IsDigimon)
  151. {
  152. return true;
  153. }
  154. }
  155. return false;
  156. }
  157. bool CanUseCondition(Hashtable hashtable)
  158. {
  159. if (CardEffectCommons.IsExistOnBattleArea(card))
  160. {
  161. if (CardEffectCommons.IsOwnerTurn(card))
  162. {
  163. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  164. {
  165. if (CardEffectCommons.IsByEffect(hashtable, null))
  166. {
  167. return true;
  168. }
  169. }
  170. }
  171. }
  172. return false;
  173. }
  174. bool CanActivateCondition(Hashtable hashtable)
  175. {
  176. if (CardEffectCommons.IsExistOnBattleArea(card))
  177. {
  178. return true;
  179. }
  180. return false;
  181. }
  182. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  183. {
  184. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  185. }
  186. }
  187. #endregion
  188. return cardEffects;
  189. }
  190. }
  191. }