BT19_024.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_024 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Decode
  11. if (timing == EffectTiming.WhenRemoveField)
  12. {
  13. bool SourceCondition(CardSource source)
  14. {
  15. return source.HasCardColor(CardColor.Blue) && source.HasLevel && source.IsLevel4;
  16. }
  17. string[] decodeStrings = { "(Blue Lv.4)", "Blue Level 4" };
  18. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  19. }
  20. #endregion
  21. #region On Play/ When Digivolving Shared
  22. bool CanSelectHandCardConditionShared(CardSource cardSource)
  23. {
  24. return cardSource.IsDigimon &&
  25. cardSource.HasAquaTraits;
  26. }
  27. bool CanSelectOwnerPermanentConditionShared(Permanent permanent)
  28. {
  29. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  30. }
  31. bool CanActivateConditionShared(Hashtable hashtable)
  32. {
  33. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  34. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectHandCardConditionShared);
  35. }
  36. #endregion
  37. #region On Play
  38. if (timing == EffectTiming.OnEnterFieldAnyone)
  39. {
  40. ActivateClass activateClass = new ActivateClass();
  41. activateClass.SetUpICardEffect("Place a card from hand as the bottom digivolution card of 1 of our Digimon",
  42. CanUseCondition, card);
  43. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, true, EffectDescription());
  44. cardEffects.Add(activateClass);
  45. string EffectDescription()
  46. {
  47. return
  48. "[On Play] You may place 1 Digimon card with [Aqua]/[Sea Animal] in one of its traits from your hand as 1 of your Digimon's bottom digivolution card.";
  49. }
  50. bool CanUseCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable hashtable)
  55. {
  56. List<CardSource> selectedCards = new List<CardSource>();
  57. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  58. selectHandEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition: CanSelectHandCardConditionShared,
  61. canTargetCondition_ByPreSelecetedList: null,
  62. canEndSelectCondition: null,
  63. maxCount: 1,
  64. canNoSelect: true,
  65. canEndNotMax: false,
  66. isShowOpponent: true,
  67. selectCardCoroutine: SelectCardCoroutine,
  68. afterSelectCardCoroutine: null,
  69. mode: SelectHandEffect.Mode.Custom,
  70. cardEffect: activateClass);
  71. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.",
  72. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  73. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  74. yield return StartCoroutine(selectHandEffect.Activate());
  75. IEnumerator SelectCardCoroutine(CardSource cardSource)
  76. {
  77. selectedCards.Add(cardSource);
  78. yield return null;
  79. }
  80. if (selectedCards.Count >= 1)
  81. {
  82. Permanent selectedPermanent = null;
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectOwnerPermanentConditionShared,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: 1,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage(
  97. "Select 1 of your Digimon to place the chosen card as its bottom digivolution card.",
  98. "The opponent is selecting 1 of their Digimon to place the chosen card as its bottom digivolution card");
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  101. {
  102. selectedPermanent = permanent;
  103. yield return null;
  104. }
  105. if (selectedPermanent != null)
  106. {
  107. yield return ContinuousController.instance.StartCoroutine(selectedPermanent
  108. .AddDigivolutionCardsBottom(selectedCards, activateClass));
  109. }
  110. }
  111. }
  112. }
  113. #endregion
  114. #region When Digivolving
  115. if (timing == EffectTiming.OnEnterFieldAnyone)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect("Place a card from hand as the bottom digivolution card of 1 of our Digimon",
  119. CanUseCondition, card);
  120. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, true, EffectDescription());
  121. cardEffects.Add(activateClass);
  122. string EffectDescription()
  123. {
  124. return
  125. "[When Digivolving] You may place 1 Digimon card with [Aqua]/[Sea Animal] in one of its traits from your hand as 1 of your Digimon's bottom digivolution card.";
  126. }
  127. bool CanUseCondition(Hashtable hashtable)
  128. {
  129. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable hashtable)
  132. {
  133. List<CardSource> selectedCards = new List<CardSource>();
  134. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  135. selectHandEffect.SetUp(
  136. selectPlayer: card.Owner,
  137. canTargetCondition: CanSelectHandCardConditionShared,
  138. canTargetCondition_ByPreSelecetedList: null,
  139. canEndSelectCondition: null,
  140. maxCount: 1,
  141. canNoSelect: true,
  142. canEndNotMax: false,
  143. isShowOpponent: true,
  144. selectCardCoroutine: SelectCardCoroutine,
  145. afterSelectCardCoroutine: null,
  146. mode: SelectHandEffect.Mode.Custom,
  147. cardEffect: activateClass);
  148. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.",
  149. "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  150. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  151. yield return StartCoroutine(selectHandEffect.Activate());
  152. IEnumerator SelectCardCoroutine(CardSource cardSource)
  153. {
  154. selectedCards.Add(cardSource);
  155. yield return null;
  156. }
  157. if (selectedCards.Count >= 1)
  158. {
  159. Permanent selectedPermanent = null;
  160. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  161. selectPermanentEffect.SetUp(
  162. selectPlayer: card.Owner,
  163. canTargetCondition: CanSelectOwnerPermanentConditionShared,
  164. canTargetCondition_ByPreSelecetedList: null,
  165. canEndSelectCondition: null,
  166. maxCount: 1,
  167. canNoSelect: false,
  168. canEndNotMax: false,
  169. selectPermanentCoroutine: SelectPermanentCoroutine,
  170. afterSelectPermanentCoroutine: null,
  171. mode: SelectPermanentEffect.Mode.Custom,
  172. cardEffect: activateClass);
  173. selectPermanentEffect.SetUpCustomMessage(
  174. "Select 1 of your Digimon to place the chosen card as its bottom digivolution card.",
  175. "The opponent is selecting 1 of their Digimon to place the chosen card as its bottom digivolution card");
  176. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  177. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  178. {
  179. selectedPermanent = permanent;
  180. yield return null;
  181. }
  182. if (selectedPermanent != null)
  183. {
  184. yield return ContinuousController.instance.StartCoroutine(selectedPermanent
  185. .AddDigivolutionCardsBottom(selectedCards, activateClass));
  186. }
  187. }
  188. }
  189. }
  190. #endregion
  191. #region End of Attack - ESS
  192. if (timing == EffectTiming.OnEndAttack)
  193. {
  194. ActivateClass activateClass = new ActivateClass();
  195. activateClass.SetUpICardEffect("Play 1 Digimon from this Digimon's digivolution cards", CanUseCondition, card);
  196. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  197. activateClass.SetIsInheritedEffect(true);
  198. activateClass.SetHashString("PlayFromSources_BT19_024");
  199. cardEffects.Add(activateClass);
  200. string EffectDescription()
  201. {
  202. return
  203. "[End of Attack] (Once Per Turn) You may play 1 level 4 or lower Digimon card with [Aqua]/[Sea Animal] in one of its traits from this Digimon's digivolution cards without paying the cost.";
  204. }
  205. bool CanUseCondition(Hashtable hashtable)
  206. {
  207. return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
  208. }
  209. bool CanSelectSourceCardCondition(CardSource cardSource)
  210. {
  211. return cardSource.IsDigimon &&
  212. cardSource.HasLevel && cardSource.Level <= 4 &&
  213. cardSource.HasAquaTraits &&
  214. CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass);
  215. }
  216. bool CanActivateCondition(Hashtable hashtable)
  217. {
  218. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  219. card.PermanentOfThisCard().DigivolutionCards.Some(CanSelectSourceCardCondition);
  220. }
  221. IEnumerator ActivateCoroutine(Hashtable hashtable)
  222. {
  223. List<CardSource> selectedCards = new List<CardSource>();
  224. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  225. selectCardEffect.SetUp(
  226. canTargetCondition: CanSelectSourceCardCondition,
  227. canTargetCondition_ByPreSelecetedList: null,
  228. canEndSelectCondition: null,
  229. canNoSelect: () => true,
  230. selectCardCoroutine: SelectCardCoroutine,
  231. afterSelectCardCoroutine: null,
  232. message: "Select 1 digivolution card to play.",
  233. maxCount: 1,
  234. canEndNotMax: false,
  235. isShowOpponent: true,
  236. mode: SelectCardEffect.Mode.Custom,
  237. root: SelectCardEffect.Root.Custom,
  238. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  239. canLookReverseCard: true,
  240. selectPlayer: card.Owner,
  241. cardEffect: activateClass);
  242. selectCardEffect.SetUpCustomMessage(
  243. "Select 1 digivolution card to play.",
  244. "The opponent is selecting 1 digivolution card to play.");
  245. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  246. yield return StartCoroutine(selectCardEffect.Activate());
  247. IEnumerator SelectCardCoroutine(CardSource cardSource)
  248. {
  249. selectedCards.Add(cardSource);
  250. yield return null;
  251. }
  252. yield return ContinuousController.instance.StartCoroutine(
  253. CardEffectCommons.PlayPermanentCards(
  254. cardSources: selectedCards,
  255. activateClass: activateClass,
  256. payCost: false,
  257. isTapped: false,
  258. root: SelectCardEffect.Root.DigivolutionCards,
  259. activateETB: true));
  260. }
  261. }
  262. #endregion
  263. return cardEffects;
  264. }
  265. }
  266. }