BT18_023.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT18
  6. {
  7. public class BT18_023 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Calmaramon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.None)
  22. {
  23. bool PermanentCondition(Permanent targetPermanent)
  24. {
  25. return targetPermanent.IsTamer && targetPermanent.TopCard.CardColors.Contains(CardColor.Blue);
  26. }
  27. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  28. permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false,
  29. card: card, condition: null));
  30. }
  31. #endregion
  32. #region On Play
  33. if (timing == EffectTiming.OnEnterFieldAnyone)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("Reveal top 3 cards of deck and add 1 to hand or as bottom digivolution card.", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[On Play] Reveal the top 3 cards of your deck. Add 1 Digimon card with the [Aqua]/[Sea Animal] in one of its traits among them to the hand or place 1 such card as any of your blue Digimon's bottom digivolution card. Return the rest to the bottom of the deck.";
  42. }
  43. bool CanSelectCardCondition(CardSource cardSource)
  44. {
  45. return cardSource.HasAquaTraits || cardSource.EqualsTraits("Sea Animal");
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  50. }
  51. bool CanSelectPermanentCondition(Permanent permanent)
  52. {
  53. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  54. {
  55. if (!permanent.IsToken && permanent.IsDigimon && permanent.TopCard.CardColors.Contains(CardColor.Blue))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  65. {
  66. if (card.Owner.LibraryCards.Count >= 1)
  67. {
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  74. {
  75. CardSource selectedCard = null;
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  77. revealCount: 3,
  78. simplifiedSelectCardConditions:
  79. new SimplifiedSelectCardConditionClass[]
  80. {
  81. new SimplifiedSelectCardConditionClass(
  82. canTargetCondition:CanSelectCardCondition,
  83. message: "Select 1 card with [Aqua] or [Sea Animal] in its traits.",
  84. mode: SelectCardEffect.Mode.Custom,
  85. maxCount: 1,
  86. selectCardCoroutine: SelectCardCoroutine),
  87. },
  88. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  89. activateClass: activateClass
  90. ));
  91. IEnumerator SelectCardCoroutine(CardSource cardSource)
  92. {
  93. selectedCard = cardSource;
  94. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  95. {
  96. new SelectionElement<bool>(message: $"Add to hand", value : true, spriteIndex: 0),
  97. new SelectionElement<bool>(message: $"Add to digivolution cards", value : false, spriteIndex: 1),
  98. };
  99. string selectPlayerMessage = "To which area do you place the card?";
  100. string notSelectPlayerMessage = "The opponent is choosing to which area to place the card.";
  101. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  102. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  103. bool toHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  104. if (toHand)
  105. {
  106. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { cardSource }, "Added Hand Card", true, true));
  107. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { cardSource }, false, activateClass));
  108. }
  109. else
  110. {
  111. if (CardEffectCommons.IsExistOnBattleArea(card))
  112. {
  113. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { cardSource }, "Digivolution Card", true, true));
  114. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  115. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  116. selectPermanentEffect.SetUp(
  117. selectPlayer: card.Owner,
  118. canTargetCondition: CanSelectPermanentCondition,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. maxCount: maxCount,
  122. canNoSelect: false,
  123. canEndNotMax: false,
  124. selectPermanentCoroutine: SelectPermanentCoroutine,
  125. afterSelectPermanentCoroutine: null,
  126. mode: SelectPermanentEffect.Mode.Custom,
  127. cardEffect: activateClass);
  128. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  129. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  130. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  131. {
  132. Permanent selectedPermanent = permanent;
  133. if (selectedPermanent != null)
  134. {
  135. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. #endregion
  144. #region When Digivolving
  145. if (timing == EffectTiming.OnEnterFieldAnyone)
  146. {
  147. ActivateClass activateClass = new ActivateClass();
  148. activateClass.SetUpICardEffect("Reveal top 3 cards of deck and add 1 to hand or as bottom digivolution card.", CanUseCondition, card);
  149. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  150. cardEffects.Add(activateClass);
  151. string EffectDiscription()
  152. {
  153. return "[When Digivolving] Reveal the top 3 cards of your deck. Add 1 Digimon card with the [Aqua]/[Sea Animal] in one of its traits among them to the hand or place 1 such card as any of your blue Digimon's bottom digivolution card. Return the rest to the bottom of the deck.";
  154. }
  155. bool CanSelectCardCondition(CardSource cardSource)
  156. {
  157. return cardSource.HasAquaTraits || cardSource.EqualsTraits("Sea Animal");
  158. }
  159. bool CanUseCondition(Hashtable hashtable)
  160. {
  161. if(CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  162. {
  163. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  164. }
  165. return false;
  166. }
  167. bool CanSelectPermanentCondition(Permanent permanent)
  168. {
  169. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  170. {
  171. if (!permanent.IsToken && permanent.IsDigimon && permanent.TopCard.CardColors.Contains(CardColor.Blue))
  172. {
  173. return true;
  174. }
  175. }
  176. return false;
  177. }
  178. bool CanActivateCondition(Hashtable hashtable)
  179. {
  180. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  181. {
  182. if (card.Owner.LibraryCards.Count >= 1)
  183. {
  184. return true;
  185. }
  186. }
  187. return false;
  188. }
  189. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  190. {
  191. CardSource selectedCard = null;
  192. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  193. revealCount: 3,
  194. simplifiedSelectCardConditions:
  195. new SimplifiedSelectCardConditionClass[]
  196. {
  197. new SimplifiedSelectCardConditionClass(
  198. canTargetCondition:CanSelectCardCondition,
  199. message: "Select 1 card with [Aqua] or [Sea Animal] in its traits.",
  200. mode: SelectCardEffect.Mode.Custom,
  201. maxCount: 1,
  202. selectCardCoroutine: SelectCardCoroutine),
  203. },
  204. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  205. activateClass: activateClass
  206. ));
  207. IEnumerator SelectCardCoroutine(CardSource cardSource)
  208. {
  209. selectedCard = cardSource;
  210. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  211. {
  212. new SelectionElement<bool>(message: $"Add to hand", value : true, spriteIndex: 0),
  213. new SelectionElement<bool>(message: $"Add to digivolution cards", value : false, spriteIndex: 1),
  214. };
  215. string selectPlayerMessage = "To which area do you place the card?";
  216. string notSelectPlayerMessage = "The opponent is choosing to which area to place the card.";
  217. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  218. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  219. bool toHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  220. if (toHand)
  221. {
  222. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { cardSource }, "Added Hand Card", true, true));
  223. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddHandCards(new List<CardSource>() { cardSource }, false, activateClass));
  224. }
  225. else
  226. {
  227. if (CardEffectCommons.IsExistOnBattleArea(card))
  228. {
  229. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { cardSource }, "Digivolution Card", true, true));
  230. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  231. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  232. selectPermanentEffect.SetUp(
  233. selectPlayer: card.Owner,
  234. canTargetCondition: CanSelectPermanentCondition,
  235. canTargetCondition_ByPreSelecetedList: null,
  236. canEndSelectCondition: null,
  237. maxCount: maxCount,
  238. canNoSelect: false,
  239. canEndNotMax: false,
  240. selectPermanentCoroutine: SelectPermanentCoroutine,
  241. afterSelectPermanentCoroutine: null,
  242. mode: SelectPermanentEffect.Mode.Custom,
  243. cardEffect: activateClass);
  244. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  245. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  246. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  247. {
  248. Permanent selectedPermanent = permanent;
  249. if (selectedPermanent != null)
  250. {
  251. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  252. }
  253. }
  254. }
  255. }
  256. }
  257. }
  258. }
  259. #endregion
  260. #region Inherit
  261. if (timing == EffectTiming.OnAllyAttack)
  262. {
  263. ActivateClass activateClass = new ActivateClass();
  264. activateClass.SetUpICardEffect("Return Digimon to hand", CanUseCondition, card);
  265. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  266. activateClass.SetHashString("ReturnDigimon_BT18-023");
  267. activateClass.SetIsInheritedEffect(true);
  268. cardEffects.Add(activateClass);
  269. string EffectDiscription()
  270. {
  271. return "[When Attacking] [Once Per Turn] You may return 1 level 3 Digimon to the hand.";
  272. }
  273. bool CanSelectPermanentCondition(Permanent permanent)
  274. {
  275. if (CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent))
  276. {
  277. if(permanent.IsDigimon && permanent.TopCard.HasLevel)
  278. {
  279. if (permanent.Level == 3)
  280. {
  281. return true;
  282. }
  283. }
  284. }
  285. return false;
  286. }
  287. bool CanUseCondition(Hashtable hashtable)
  288. {
  289. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  290. }
  291. bool CanActivateCondition(Hashtable hashtable)
  292. {
  293. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  294. {
  295. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  296. {
  297. return true;
  298. }
  299. }
  300. return false;
  301. }
  302. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  303. {
  304. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  305. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  306. selectPermanentEffect.SetUp(
  307. selectPlayer: card.Owner,
  308. canTargetCondition: CanSelectPermanentCondition,
  309. canTargetCondition_ByPreSelecetedList: null,
  310. canEndSelectCondition: null,
  311. maxCount: maxCount,
  312. canNoSelect: true,
  313. canEndNotMax: false,
  314. selectPermanentCoroutine: null,
  315. afterSelectPermanentCoroutine: null,
  316. mode: SelectPermanentEffect.Mode.Bounce,
  317. cardEffect: activateClass);
  318. selectPermanentEffect.SetUpCustomMessage("Select 1 level 3 Digimon to return to hand.", "The opponent is selecting 1 level 3 Digimon to return to hand.");
  319. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  320. }
  321. }
  322. #endregion
  323. return cardEffects;
  324. }
  325. }
  326. }