BT22_027.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Ryugumon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_027 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Decode
  13. if (timing == EffectTiming.WhenRemoveField)
  14. {
  15. bool SourceCondition(CardSource source)
  16. {
  17. return source.IsDigimon
  18. && source.HasLevel && source.IsLevel5
  19. && (source.ContainsTraits("Aqua") || source.ContainsTraits("Sea Animal"));
  20. }
  21. string[] decodeStrings = { "(Lv.5 w/[Aqua]/[Sea Animal] trait)", "Level 5 Digimon card with [Aqua] or [Sea Animal] " };
  22. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  23. }
  24. #endregion
  25. #region On Play
  26. if (timing == EffectTiming.OnEnterFieldAnyone)
  27. {
  28. ActivateClass activateClass = new ActivateClass();
  29. activateClass.SetUpICardEffect("Place 1 level 5 or lower [Aqua]/[Sea Animal] digimon in sources, 1 digimon or tamer cant suspend", CanUseCondition, card);
  30. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  31. cardEffects.Add(activateClass);
  32. string EffectDiscription()
  33. {
  34. return "[On Play] By placing 1 level 5 or lower Digimon card with [Aqua] or [Sea Animal] in any of its traits from your hand as this Digimon's bottom digivolution card, 1 of your opponent's Digimon or Tamers can't suspend until their turn ends.";
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  39. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  44. && CardEffectCommons.HasMatchConditionOwnersHand(card, HandCondition);
  45. }
  46. bool HandCondition(CardSource source)
  47. {
  48. return source.IsDigimon &&
  49. source.HasLevel && source.Level <= 5 &&
  50. source.HasAquaTraits;
  51. }
  52. bool PermanentCondition(Permanent permanent)
  53. {
  54. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  55. && (permanent.IsDigimon || permanent.IsTamer);
  56. }
  57. bool IsRyugumon(Permanent permanent)
  58. {
  59. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  60. && permanent == card.PermanentOfThisCard();
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.HasMatchConditionOwnersHand(card, HandCondition) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsRyugumon))
  65. {
  66. #region Select Hand Card
  67. CardSource selectedCard = null;
  68. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, HandCondition));
  69. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  70. selectHandEffect.SetUp(
  71. selectPlayer: card.Owner,
  72. canTargetCondition: HandCondition,
  73. canTargetCondition_ByPreSelecetedList: null,
  74. canEndSelectCondition: null,
  75. maxCount: maxCount,
  76. canNoSelect: true,
  77. canEndNotMax: false,
  78. isShowOpponent: true,
  79. selectCardCoroutine: SelectCardCoroutine,
  80. afterSelectCardCoroutine: null,
  81. mode: SelectHandEffect.Mode.Custom,
  82. cardEffect: activateClass);
  83. IEnumerator SelectCardCoroutine(CardSource cardSource)
  84. {
  85. selectedCard = cardSource;
  86. yield return null;
  87. }
  88. selectHandEffect.SetUpCustomMessage("Select 1 card to add as digivolution card,", "The opponent is selecting 1 card to add as digivolution card,");
  89. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  90. yield return StartCoroutine(selectHandEffect.Activate());
  91. #endregion
  92. if (selectedCard != null)
  93. {
  94. Permanent selectedPermanent = card.PermanentOfThisCard();
  95. if (selectedPermanent != null && selectedCard != null)
  96. {
  97. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  98. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
  99. {
  100. #region Select Opponent Permanent
  101. Permanent opponentPermanent = null;
  102. int maxCount2 = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, PermanentCondition));
  103. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  104. selectPermanentEffect1.SetUp(
  105. selectPlayer: card.Owner,
  106. canTargetCondition: PermanentCondition,
  107. canTargetCondition_ByPreSelecetedList: null,
  108. canEndSelectCondition: null,
  109. maxCount: maxCount2,
  110. canNoSelect: false,
  111. canEndNotMax: false,
  112. selectPermanentCoroutine: SelectPermanentCoroutine1,
  113. afterSelectPermanentCoroutine: null,
  114. mode: SelectPermanentEffect.Mode.Custom,
  115. cardEffect: activateClass);
  116. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  117. {
  118. opponentPermanent = permanent;
  119. yield return null;
  120. }
  121. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon/Tamer that can't suspend.", "The opponent is selecting 1 Digimon/Tamer that can't suspend.");
  122. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  123. #endregion
  124. if (opponentPermanent != null)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantSuspendUntilOpponentTurnEnd(
  127. targetPermanent: opponentPermanent,
  128. activateClass: activateClass
  129. ));
  130. }
  131. }
  132. }
  133. }
  134. }
  135. }
  136. }
  137. #endregion
  138. #region When Digivolving
  139. if (timing == EffectTiming.OnEnterFieldAnyone)
  140. {
  141. ActivateClass activateClass = new ActivateClass();
  142. activateClass.SetUpICardEffect("Place 1 level 5 or lower [Aqua]/[Sea Animal] digimon in sources, 1 digimon or tamer cant suspend", CanUseCondition, card);
  143. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  144. cardEffects.Add(activateClass);
  145. string EffectDiscription()
  146. {
  147. return "[When Digivolving] By placing 1 level 5 or lower Digimon card with [Aqua] or [Sea Animal] in any of its traits from your hand as this Digimon's bottom digivolution card, 1 of your opponent's Digimon or Tamers can't suspend until their turn ends.";
  148. }
  149. bool CanUseCondition(Hashtable hashtable)
  150. {
  151. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  152. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  153. }
  154. bool CanActivateCondition(Hashtable hashtable)
  155. {
  156. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  157. && CardEffectCommons.HasMatchConditionOwnersHand(card, HandCondition);
  158. }
  159. bool HandCondition(CardSource source)
  160. {
  161. return source.IsDigimon &&
  162. source.HasLevel && source.Level <= 5 &&
  163. source.HasAquaTraits;
  164. }
  165. bool PermanentCondition(Permanent permanent)
  166. {
  167. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  168. && (permanent.IsDigimon || permanent.IsTamer);
  169. }
  170. bool IsRyugumon(Permanent permanent)
  171. {
  172. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  173. && permanent == card.PermanentOfThisCard();
  174. }
  175. IEnumerator ActivateCoroutine(Hashtable hashtable)
  176. {
  177. if (CardEffectCommons.HasMatchConditionOwnersHand(card, HandCondition) && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsRyugumon))
  178. {
  179. #region Select Hand Card
  180. CardSource selectedCard = null;
  181. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, HandCondition));
  182. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  183. selectHandEffect.SetUp(
  184. selectPlayer: card.Owner,
  185. canTargetCondition: HandCondition,
  186. canTargetCondition_ByPreSelecetedList: null,
  187. canEndSelectCondition: null,
  188. maxCount: maxCount,
  189. canNoSelect: true,
  190. canEndNotMax: false,
  191. isShowOpponent: true,
  192. selectCardCoroutine: SelectCardCoroutine,
  193. afterSelectCardCoroutine: null,
  194. mode: SelectHandEffect.Mode.Custom,
  195. cardEffect: activateClass);
  196. IEnumerator SelectCardCoroutine(CardSource cardSource)
  197. {
  198. selectedCard = cardSource;
  199. yield return null;
  200. }
  201. selectHandEffect.SetUpCustomMessage("Select 1 card to add as digivolution card,", "The opponent is selecting 1 card to add as digivolution card,");
  202. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  203. yield return StartCoroutine(selectHandEffect.Activate());
  204. #endregion
  205. if (selectedCard != null)
  206. {
  207. Permanent selectedPermanent = card.PermanentOfThisCard();
  208. if (selectedPermanent != null && selectedCard != null)
  209. {
  210. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  211. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, PermanentCondition))
  212. {
  213. #region Select Opponent Permanent
  214. Permanent opponentPermanent = null;
  215. int maxCount2 = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, PermanentCondition));
  216. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  217. selectPermanentEffect1.SetUp(
  218. selectPlayer: card.Owner,
  219. canTargetCondition: PermanentCondition,
  220. canTargetCondition_ByPreSelecetedList: null,
  221. canEndSelectCondition: null,
  222. maxCount: maxCount2,
  223. canNoSelect: false,
  224. canEndNotMax: false,
  225. selectPermanentCoroutine: SelectPermanentCoroutine1,
  226. afterSelectPermanentCoroutine: null,
  227. mode: SelectPermanentEffect.Mode.Custom,
  228. cardEffect: activateClass);
  229. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  230. {
  231. opponentPermanent = permanent;
  232. yield return null;
  233. }
  234. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon/Tamer that can't suspend.", "The opponent is selecting 1 Digimon/Tamer that can't suspend.");
  235. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  236. #endregion
  237. if (opponentPermanent != null)
  238. {
  239. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantSuspendUntilOpponentTurnEnd(
  240. targetPermanent: opponentPermanent,
  241. activateClass: activateClass
  242. ));
  243. }
  244. }
  245. }
  246. }
  247. }
  248. }
  249. }
  250. #endregion
  251. #region All Turns
  252. if (timing == EffectTiming.OnAddDigivolutionCards)
  253. {
  254. ActivateClass activateClass = new ActivateClass();
  255. activateClass.SetUpICardEffect("Bottom deck 1 level 5 or lower digimon", CanUseCondition, card);
  256. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  257. activateClass.SetHashString("BT22_027_OnAddDigivolutionCards");
  258. cardEffects.Add(activateClass);
  259. string EffectDiscription()
  260. {
  261. return "[All Turns] [Once Per Turn] When effects add to this Digimon's digivolution cards, return 1 of your opponent's level 5 or lower Digimon to the bottom of the deck.";
  262. }
  263. bool CanUseCondition(Hashtable hashtable)
  264. {
  265. return CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  266. hashtable,
  267. IsRyugumon,
  268. cardEffectCondition: cardEffect => cardEffect.EffectSourceCard != null,
  269. null);
  270. }
  271. bool CanActivateCondition(Hashtable hashtable)
  272. {
  273. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  274. }
  275. bool IsRyugumon(Permanent permanent)
  276. {
  277. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  278. && permanent == card.PermanentOfThisCard();
  279. }
  280. bool CanSelectPermanentCondition(Permanent permanent)
  281. {
  282. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  283. && permanent.TopCard.HasLevel && permanent.TopCard.Level <= 5;
  284. }
  285. IEnumerator ActivateCoroutine(Hashtable hashtable)
  286. {
  287. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermanentCondition));
  288. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  289. selectPermanentEffect.SetUp(
  290. selectPlayer: card.Owner,
  291. canTargetCondition: CanSelectPermanentCondition,
  292. canTargetCondition_ByPreSelecetedList: null,
  293. canEndSelectCondition: null,
  294. maxCount: maxCount,
  295. canNoSelect: false,
  296. canEndNotMax: false,
  297. selectPermanentCoroutine: null,
  298. afterSelectPermanentCoroutine: null,
  299. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  300. cardEffect: activateClass);
  301. selectPermanentEffect.SetUpCustomMessage("Select 1 digimon to bottom deck.", "The opponent is selecting 1 digimon to bottom deck.");
  302. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  303. }
  304. }
  305. #endregion
  306. return cardEffects;
  307. }
  308. }
  309. }