BT22_028.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Ariemon
  5. namespace DCGO.CardEffects.BT22
  6. {
  7. public class BT22_028 : 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.Level <= 6
  19. && (source.HasSeaAnimalTraits || source.HasAquaTraits);
  20. }
  21. string[] decodeStrings = { "(Lv.6 or lower w/[Aqua]/[Sea Animal] trait)", "Level 6 or lower 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 Alternate Digivolution
  26. if (timing == EffectTiming.None)
  27. {
  28. bool Condition()
  29. {
  30. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, HasYaoQinglan);
  31. }
  32. bool HasYaoQinglan(Permanent targetPermanent)
  33. {
  34. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(targetPermanent, card) &&
  35. targetPermanent.TopCard.EqualsCardName("Yao Qinglan");
  36. }
  37. bool PermanentCondition(Permanent targetPermanent)
  38. {
  39. return targetPermanent.TopCard.EqualsCardName("MarineBullmon");
  40. }
  41. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  42. permanentCondition: PermanentCondition,
  43. digivolutionCost: 6,
  44. ignoreDigivolutionRequirement: false,
  45. card: card,
  46. condition: Condition)
  47. );
  48. }
  49. #endregion
  50. #region When Digivolving
  51. if (timing == EffectTiming.OnEnterFieldAnyone)
  52. {
  53. ActivateClass activateClass = new ActivateClass();
  54. activateClass.SetUpICardEffect("Play 1 of each level (3, 4, and 5)", CanUseCondition, card);
  55. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  56. cardEffects.Add(activateClass);
  57. string EffectDiscription()
  58. {
  59. return "[When Digivolving] You may play 1 each of level 3, level 4 and level 5 Digimon cards with [Aqua] or [Sea Animal] in any of their traits from this Digimon's digivolution cards without paying the cost.";
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  64. }
  65. bool CanActivateCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  68. }
  69. bool DigimonCondition(int level, CardSource cardSource)
  70. {
  71. return CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass)
  72. && cardSource.IsDigimon
  73. && cardSource.HasLevel && cardSource.Level == level
  74. && (cardSource.HasAquaTraits);
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable hashtable)
  77. {
  78. List<CardSource> selectedCards = new List<CardSource>();
  79. Permanent thisPermanent = card.PermanentOfThisCard();
  80. IEnumerator SelectCardCoroutine(CardSource cardSource)
  81. {
  82. selectedCards.Add(cardSource);
  83. yield return null;
  84. }
  85. #region Select Level 3 Digivolution Cards
  86. int maxCount = Math.Min(1, thisPermanent.DigivolutionCards.Filter(x => DigimonCondition(3, x)).Count);
  87. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  88. selectCardEffect.SetUp(
  89. canTargetCondition: cs => DigimonCondition(3, cs),
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. canNoSelect: () => false,
  93. selectCardCoroutine: SelectCardCoroutine,
  94. afterSelectCardCoroutine: null,
  95. message: "Select 1 level 3 digivolution card to play.",
  96. maxCount: maxCount,
  97. canEndNotMax: false,
  98. isShowOpponent: true,
  99. mode: SelectCardEffect.Mode.Custom,
  100. root: SelectCardEffect.Root.Custom,
  101. customRootCardList: thisPermanent.DigivolutionCards,
  102. canLookReverseCard: true,
  103. selectPlayer: card.Owner,
  104. cardEffect: activateClass);
  105. selectCardEffect.SetUpCustomMessage("Select 1 level 3 digivolution card to play.", "The opponent is selecting 1 level 3 digivolution card to play.");
  106. yield return StartCoroutine(selectCardEffect.Activate());
  107. #endregion
  108. #region Select Level 4 Digivolution Cards
  109. int maxCount1 = Math.Min(1, thisPermanent.DigivolutionCards.Filter(x => DigimonCondition(4, x)).Count);
  110. SelectCardEffect selectCardEffect1 = GManager.instance.GetComponent<SelectCardEffect>();
  111. selectCardEffect1.SetUp(
  112. canTargetCondition: cs => DigimonCondition(4, cs),
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canEndSelectCondition: null,
  115. canNoSelect: () => false,
  116. selectCardCoroutine: SelectCardCoroutine,
  117. afterSelectCardCoroutine: null,
  118. message: "Select 1 level 4 digivolution card to play.",
  119. maxCount: maxCount1,
  120. canEndNotMax: false,
  121. isShowOpponent: true,
  122. mode: SelectCardEffect.Mode.Custom,
  123. root: SelectCardEffect.Root.Custom,
  124. customRootCardList: thisPermanent.DigivolutionCards,
  125. canLookReverseCard: true,
  126. selectPlayer: card.Owner,
  127. cardEffect: activateClass);
  128. selectCardEffect1.SetUpCustomMessage("Select 1 level 4 digivolution card to play.", "The opponent is selecting 1 level 4 digivolution card to play.");
  129. yield return StartCoroutine(selectCardEffect1.Activate());
  130. #endregion
  131. #region Select Level 3 Digivolution Cards
  132. int maxCount2 = Math.Min(1, thisPermanent.DigivolutionCards.Filter(x => DigimonCondition(5, x)).Count);
  133. SelectCardEffect selectCardEffect2 = GManager.instance.GetComponent<SelectCardEffect>();
  134. selectCardEffect2.SetUp(
  135. canTargetCondition: cs => DigimonCondition(5, cs),
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. canNoSelect: () => false,
  139. selectCardCoroutine: SelectCardCoroutine,
  140. afterSelectCardCoroutine: null,
  141. message: "Select 1 level 5 digivolution card to play.",
  142. maxCount: maxCount2,
  143. canEndNotMax: false,
  144. isShowOpponent: true,
  145. mode: SelectCardEffect.Mode.Custom,
  146. root: SelectCardEffect.Root.Custom,
  147. customRootCardList: thisPermanent.DigivolutionCards,
  148. canLookReverseCard: true,
  149. selectPlayer: card.Owner,
  150. cardEffect: activateClass);
  151. selectCardEffect1.SetUpCustomMessage("Select 1 level 5 digivolution card to play.", "The opponent is selecting 1 level 5 digivolution card to play.");
  152. yield return StartCoroutine(selectCardEffect1.Activate());
  153. #endregion
  154. if (selectedCards.Count > 0) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.DigivolutionCards, activateETB: true));
  155. }
  156. }
  157. #endregion
  158. #region When Digivolving OPT
  159. if (timing == EffectTiming.OnEnterFieldAnyone)
  160. {
  161. ActivateClass activateClass = new ActivateClass();
  162. activateClass.SetUpICardEffect("Place 1 digimon as bottom source, bottom deck 1 digimon & unsuspend", CanUseCondition, card);
  163. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  164. activateClass.SetHashString("BT22_028_BottomDeck");
  165. cardEffects.Add(activateClass);
  166. string EffectDiscription()
  167. {
  168. return "[When Digivolving] [Once Per Turn] By placing 1 of your other Digimon as this Digimon's bottom digivolution card, return 1 of your opponent's Digimon to the bottom of the deck and this Digimon unsuspends.";
  169. }
  170. bool CanUseCondition(Hashtable hashtable)
  171. {
  172. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  173. }
  174. bool CanActivateCondition(Hashtable hashtable)
  175. {
  176. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  177. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, DigimonCondition);
  178. }
  179. bool DigimonCondition(Permanent targetPermanent)
  180. {
  181. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(targetPermanent, card)
  182. && targetPermanent != card.PermanentOfThisCard();
  183. }
  184. bool OpponentDigimonCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  185. IEnumerator ActivateCoroutine(Hashtable hashtable)
  186. {
  187. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, DigimonCondition))
  188. {
  189. Permanent selectedPermanent = null;
  190. #region Select Owner Other Permanent
  191. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, DigimonCondition));
  192. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  193. selectPermanentEffect.SetUp(
  194. selectPlayer: card.Owner,
  195. canTargetCondition: DigimonCondition,
  196. canTargetCondition_ByPreSelecetedList: null,
  197. canEndSelectCondition: null,
  198. maxCount: maxCount,
  199. canNoSelect: false,
  200. canEndNotMax: false,
  201. selectPermanentCoroutine: SelectPermanentCoroutine,
  202. afterSelectPermanentCoroutine: null,
  203. mode: SelectPermanentEffect.Mode.Custom,
  204. cardEffect: activateClass);
  205. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  206. {
  207. selectedPermanent = permanent;
  208. yield return null;
  209. }
  210. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to add digivolution source.", "The opponent is selecting 1 Digimon to add digivolution source.");
  211. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  212. #endregion
  213. if (selectedPermanent != null)
  214. {
  215. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { selectedPermanent, card.PermanentOfThisCard() } }, false, activateClass).PlacePermanentToDigivolutionCards());
  216. #region Bottom Deck Opponent Digimon
  217. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, OpponentDigimonCondition))
  218. {
  219. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, OpponentDigimonCondition));
  220. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  221. selectPermanentEffect1.SetUp(
  222. selectPlayer: card.Owner,
  223. canTargetCondition: OpponentDigimonCondition,
  224. canTargetCondition_ByPreSelecetedList: null,
  225. canEndSelectCondition: null,
  226. maxCount: maxCount1,
  227. canNoSelect: false,
  228. canEndNotMax: false,
  229. selectPermanentCoroutine: null,
  230. afterSelectPermanentCoroutine: null,
  231. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  232. cardEffect: activateClass);
  233. selectPermanentEffect1.SetUpCustomMessage("Select 1 digimon to bottom deck.", "The opponent is selecting a digimon to bottom deck.");
  234. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  235. }
  236. #endregion
  237. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  238. }
  239. }
  240. }
  241. }
  242. #endregion
  243. #region When Attacking OPT
  244. if (timing == EffectTiming.OnAllyAttack)
  245. {
  246. ActivateClass activateClass = new ActivateClass();
  247. activateClass.SetUpICardEffect("Place 1 digimon as bottom source, bottom deck 1 digimon & unsuspend", CanUseCondition, card);
  248. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  249. activateClass.SetHashString("BT22_028_BottomDeck");
  250. cardEffects.Add(activateClass);
  251. string EffectDiscription()
  252. {
  253. return "[When Attacking] [Once Per Turn] By placing 1 of your other Digimon as this Digimon's bottom digivolution card, return 1 of your opponent's Digimon to the bottom of the deck and this Digimon unsuspends.";
  254. }
  255. bool CanUseCondition(Hashtable hashtable)
  256. {
  257. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  258. }
  259. bool CanActivateCondition(Hashtable hashtable)
  260. {
  261. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  262. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, DigimonCondition);
  263. }
  264. bool DigimonCondition(Permanent targetPermanent)
  265. {
  266. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(targetPermanent, card)
  267. && targetPermanent != card.PermanentOfThisCard();
  268. }
  269. bool OpponentDigimonCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  270. IEnumerator ActivateCoroutine(Hashtable hashtable)
  271. {
  272. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, DigimonCondition))
  273. {
  274. Permanent selectedPermanent = null;
  275. #region Select Owner Other Permanent
  276. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersPermanentCount(card, DigimonCondition));
  277. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  278. selectPermanentEffect.SetUp(
  279. selectPlayer: card.Owner,
  280. canTargetCondition: DigimonCondition,
  281. canTargetCondition_ByPreSelecetedList: null,
  282. canEndSelectCondition: null,
  283. maxCount: maxCount,
  284. canNoSelect: false,
  285. canEndNotMax: false,
  286. selectPermanentCoroutine: SelectPermanentCoroutine,
  287. afterSelectPermanentCoroutine: null,
  288. mode: SelectPermanentEffect.Mode.Custom,
  289. cardEffect: activateClass);
  290. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  291. {
  292. selectedPermanent = permanent;
  293. yield return null;
  294. }
  295. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to add digivolution source.", "The opponent is selecting 1 Digimon to add digivolution source.");
  296. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  297. #endregion
  298. if (selectedPermanent != null)
  299. {
  300. yield return ContinuousController.instance.StartCoroutine(new IPlacePermanentToDigivolutionCards(new List<Permanent[]>() { new Permanent[] { selectedPermanent, card.PermanentOfThisCard() } }, false, activateClass).PlacePermanentToDigivolutionCards());
  301. #region Bottom Deck Opponent Digimon
  302. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, OpponentDigimonCondition))
  303. {
  304. int maxCount1 = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, OpponentDigimonCondition));
  305. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  306. selectPermanentEffect1.SetUp(
  307. selectPlayer: card.Owner,
  308. canTargetCondition: OpponentDigimonCondition,
  309. canTargetCondition_ByPreSelecetedList: null,
  310. canEndSelectCondition: null,
  311. maxCount: maxCount1,
  312. canNoSelect: false,
  313. canEndNotMax: false,
  314. selectPermanentCoroutine: null,
  315. afterSelectPermanentCoroutine: null,
  316. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  317. cardEffect: activateClass);
  318. selectPermanentEffect1.SetUpCustomMessage("Select 1 digimon to bottom deck.", "The opponent is selecting a digimon to bottom deck.");
  319. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  320. }
  321. #endregion
  322. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  323. }
  324. }
  325. }
  326. }
  327. #endregion
  328. return cardEffects;
  329. }
  330. }
  331. }