BT17_024.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT17
  6. {
  7. public class BT17_024 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region On Play/ When Digivolving Shared
  13. bool CanSelectOwnPermanentSharedCondition(Permanent permanent)
  14. {
  15. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  16. }
  17. bool CanSelectHandCardSharedCondition(CardSource cardSource)
  18. {
  19. return cardSource.IsDigimon &&
  20. cardSource.IsLevel3 &&
  21. cardSource.HasCardColor(CardColor.Blue);
  22. }
  23. #endregion
  24. #region On Play
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Place 1 card to digivolution cards to give [Jamming]", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  30. cardEffects.Add(activateClass);
  31. string EffectDescription()
  32. {
  33. return
  34. "[On Play] By placing 1 level 3 blue Digimon card from your hand as this Digimon's bottom digivolution card, 1 of your Digimon gains [Jamming] for the turn.";
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (card.Owner.HandCards.Count(CanSelectHandCardSharedCondition) >= 1)
  45. {
  46. return true;
  47. }
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (card.Owner.HandCards.Count(CanSelectHandCardSharedCondition) >= 1)
  56. {
  57. List<CardSource> selectedCards = new List<CardSource>();
  58. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectHandCardSharedCondition));
  59. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  60. selectHandEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: CanSelectHandCardSharedCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: maxCount,
  66. canNoSelect: true,
  67. canEndNotMax: false,
  68. isShowOpponent: true,
  69. selectCardCoroutine: SelectCardCoroutine,
  70. afterSelectCardCoroutine: null,
  71. mode: SelectHandEffect.Mode.Custom,
  72. cardEffect: activateClass);
  73. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.",
  74. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  75. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  76. yield return StartCoroutine(selectHandEffect.Activate());
  77. IEnumerator SelectCardCoroutine(CardSource cardSource)
  78. {
  79. selectedCards.Add(cardSource);
  80. yield return null;
  81. }
  82. if (selectedCards.Count >= 1)
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  85. .AddDigivolutionCardsBottom(
  86. selectedCards,
  87. activateClass));
  88. maxCount = Math.Min(1,
  89. CardEffectCommons.MatchConditionPermanentCount(CanSelectOwnPermanentSharedCondition));
  90. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  91. selectPermanentEffect.SetUp(
  92. selectPlayer: card.Owner,
  93. canTargetCondition: CanSelectOwnPermanentSharedCondition,
  94. canTargetCondition_ByPreSelecetedList: null,
  95. canEndSelectCondition: null,
  96. maxCount: maxCount,
  97. canNoSelect: false,
  98. canEndNotMax: false,
  99. selectPermanentCoroutine: SelectPermanentCoroutine,
  100. afterSelectPermanentCoroutine: null,
  101. mode: SelectPermanentEffect.Mode.Custom,
  102. cardEffect: activateClass);
  103. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain Jamming.",
  104. "The opponent is selecting 1 Digimon that will gain Jamming.");
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(
  109. CardEffectCommons.GainJamming(targetPermanent: permanent,
  110. effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  111. }
  112. }
  113. }
  114. }
  115. }
  116. }
  117. #endregion
  118. #region When Digivolving
  119. if (timing == EffectTiming.OnEnterFieldAnyone)
  120. {
  121. ActivateClass activateClass = new ActivateClass();
  122. activateClass.SetUpICardEffect("Place 1 card to digivolution cards to give [Jamming]", CanUseCondition, card);
  123. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  124. cardEffects.Add(activateClass);
  125. string EffectDescription()
  126. {
  127. return
  128. "[When Digivolving] By placing 1 level 3 blue Digimon card from your hand as this Digimon's bottom digivolution card, 1 of your Digimon gains [Jamming] for the turn.";
  129. }
  130. bool CanUseCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  133. }
  134. bool CanActivateCondition(Hashtable hashtable)
  135. {
  136. if (CardEffectCommons.IsExistOnBattleArea(card))
  137. {
  138. if (card.Owner.HandCards.Count(CanSelectHandCardSharedCondition) >= 1)
  139. {
  140. return true;
  141. }
  142. }
  143. return false;
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable hashtable)
  146. {
  147. if (CardEffectCommons.IsExistOnBattleArea(card))
  148. {
  149. if (card.Owner.HandCards.Count(CanSelectHandCardSharedCondition) >= 1)
  150. {
  151. List<CardSource> selectedCards = new List<CardSource>();
  152. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectHandCardSharedCondition));
  153. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  154. selectHandEffect.SetUp(
  155. selectPlayer: card.Owner,
  156. canTargetCondition: CanSelectHandCardSharedCondition,
  157. canTargetCondition_ByPreSelecetedList: null,
  158. canEndSelectCondition: null,
  159. maxCount: maxCount,
  160. canNoSelect: true,
  161. canEndNotMax: false,
  162. isShowOpponent: true,
  163. selectCardCoroutine: SelectCardCoroutine,
  164. afterSelectCardCoroutine: null,
  165. mode: SelectHandEffect.Mode.Custom,
  166. cardEffect: activateClass);
  167. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.",
  168. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  169. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  170. yield return StartCoroutine(selectHandEffect.Activate());
  171. IEnumerator SelectCardCoroutine(CardSource cardSource)
  172. {
  173. selectedCards.Add(cardSource);
  174. yield return null;
  175. }
  176. if (selectedCards.Count >= 1)
  177. {
  178. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard()
  179. .AddDigivolutionCardsBottom(
  180. selectedCards,
  181. activateClass));
  182. maxCount = Math.Min(1,
  183. CardEffectCommons.MatchConditionPermanentCount(CanSelectOwnPermanentSharedCondition));
  184. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  185. selectPermanentEffect.SetUp(
  186. selectPlayer: card.Owner,
  187. canTargetCondition: CanSelectOwnPermanentSharedCondition,
  188. canTargetCondition_ByPreSelecetedList: null,
  189. canEndSelectCondition: null,
  190. maxCount: maxCount,
  191. canNoSelect: false,
  192. canEndNotMax: false,
  193. selectPermanentCoroutine: SelectPermanentCoroutine,
  194. afterSelectPermanentCoroutine: null,
  195. mode: SelectPermanentEffect.Mode.Custom,
  196. cardEffect: activateClass);
  197. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will gain Jamming.",
  198. "The opponent is selecting 1 Digimon that will gain Jamming.");
  199. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  200. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  201. {
  202. yield return ContinuousController.instance.StartCoroutine(
  203. CardEffectCommons.GainJamming(targetPermanent: permanent,
  204. effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  205. }
  206. }
  207. }
  208. }
  209. }
  210. }
  211. #endregion
  212. #region Jamming Static Effect - ESS
  213. if (timing == EffectTiming.None)
  214. {
  215. cardEffects.Add(CardEffectFactory.JammingSelfStaticEffect(
  216. isInheritedEffect: true,
  217. card: card,
  218. condition: null));
  219. }
  220. #endregion
  221. return cardEffects;
  222. }
  223. }
  224. }