BT17_085.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT17
  6. {
  7. public class BT17_085 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Turn
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Start of Your Main Phase] If your opponent has a Digimon, gain 1 memory.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. if (CardEffectCommons.IsExistOnBattleArea(card))
  26. {
  27. if (CardEffectCommons.IsOwnerTurn(card))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. if (CardEffectCommons.IsExistOnBattleArea(card))
  37. {
  38. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  39. {
  40. if (card.Owner.CanAddMemory(activateClass))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  51. }
  52. }
  53. #endregion
  54. #region Main
  55. if (timing == EffectTiming.OnDeclaration)
  56. {
  57. ActivateClass activateClass = new ActivateClass();
  58. activateClass.SetUpICardEffect("Digivolve your [Renamon] into [Sakuyamon]", CanUseCondition, card);
  59. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  60. cardEffects.Add(activateClass);
  61. string EffectDiscription()
  62. {
  63. return "[Main] By placing this Tamer and 1 [Kyubimon] and 1 [Taomon] from your trash in any order as the bottom digivolution cards of one of your [Renamon], that Digimon may digivolve into [Sakuyamon] in your hand for a digivolution cost of 4, ignoring its digivolution requirements. If digivolved by this effect, you may return 1 Option card from your trash to the hand.";
  64. }
  65. bool CanSelectPermanentCondition(Permanent permanent)
  66. {
  67. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  68. {
  69. if (permanent.TopCard.CardNames.Contains("Renamon"))
  70. {
  71. if (!permanent.IsToken)
  72. {
  73. return true;
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. bool CanSelectCardCondition(CardSource cardSource)
  80. {
  81. return cardSource.CardNames.Contains("Kyubimon");
  82. }
  83. bool CanSelectCardCondition1(CardSource cardSource)
  84. {
  85. return cardSource.CardNames.Contains("Taomon");
  86. }
  87. bool CanSelectCardCondition2(CardSource cardSource)
  88. {
  89. return cardSource.CardNames.Contains("Sakuyamon");
  90. }
  91. bool CanSelectCardCondition3(CardSource cardSource)
  92. {
  93. if (cardSource.IsOption)
  94. {
  95. return true;
  96. }
  97. return false;
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (!card.PermanentOfThisCard().IsToken)
  104. {
  105. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  106. {
  107. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  108. {
  109. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition1))
  110. {
  111. return true;
  112. }
  113. }
  114. }
  115. }
  116. }
  117. return false;
  118. }
  119. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  120. {
  121. if (CardEffectCommons.IsExistOnBattleArea(card))
  122. {
  123. List<CardSource> selectedCards = new List<CardSource>() { card };
  124. bool added = false;
  125. Permanent selectedPermanent = null;
  126. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  127. {
  128. int maxCount = 1;
  129. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  130. selectCardEffect.SetUp(
  131. canTargetCondition: CanSelectCardCondition,
  132. canTargetCondition_ByPreSelecetedList: null,
  133. canEndSelectCondition: null,
  134. canNoSelect: () => false,
  135. selectCardCoroutine: SelectCardCoroutine,
  136. afterSelectCardCoroutine: null,
  137. message: "Select 1 [Kyubimon] to place in Digivolution cards.",
  138. maxCount: maxCount,
  139. canEndNotMax: false,
  140. isShowOpponent: true,
  141. mode: SelectCardEffect.Mode.Custom,
  142. root: SelectCardEffect.Root.Trash,
  143. customRootCardList: null,
  144. canLookReverseCard: true,
  145. selectPlayer: card.Owner,
  146. cardEffect: activateClass);
  147. selectCardEffect.SetUpCustomMessage("Select 1 [Kyubimon] to place in Digivolution cards.", "The opponent is selecting 1 [Kyubimon] to place in Digivolution cards.");
  148. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  149. yield return StartCoroutine(selectCardEffect.Activate());
  150. IEnumerator SelectCardCoroutine(CardSource cardSource)
  151. {
  152. selectedCards.Add(cardSource);
  153. yield return null;
  154. }
  155. }
  156. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition1))
  157. {
  158. int maxCount = 1;
  159. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  160. selectCardEffect.SetUp(
  161. canTargetCondition: CanSelectCardCondition1,
  162. canTargetCondition_ByPreSelecetedList: null,
  163. canEndSelectCondition: null,
  164. canNoSelect: () => false,
  165. selectCardCoroutine: SelectCardCoroutine,
  166. afterSelectCardCoroutine: null,
  167. message: "Select 1 [Taomon] to place in Digivolution cards.",
  168. maxCount: maxCount,
  169. canEndNotMax: false,
  170. isShowOpponent: true,
  171. mode: SelectCardEffect.Mode.Custom,
  172. root: SelectCardEffect.Root.Trash,
  173. customRootCardList: null,
  174. canLookReverseCard: true,
  175. selectPlayer: card.Owner,
  176. cardEffect: activateClass);
  177. selectCardEffect.SetUpCustomMessage("Select 1 [Taomon] to place in Digivolution cards.", "The opponent is selecting 1 [Taomon] to place in Digivolution cards.");
  178. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  179. yield return StartCoroutine(selectCardEffect.Activate());
  180. IEnumerator SelectCardCoroutine(CardSource cardSource)
  181. {
  182. selectedCards.Add(cardSource);
  183. yield return null;
  184. }
  185. }
  186. if (selectedCards.Count == 3)
  187. {
  188. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  189. {
  190. int maxCount = 1;
  191. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  192. selectPermanentEffect.SetUp(
  193. selectPlayer: card.Owner,
  194. canTargetCondition: CanSelectPermanentCondition,
  195. canTargetCondition_ByPreSelecetedList: null,
  196. canEndSelectCondition: null,
  197. maxCount: maxCount,
  198. canNoSelect: false,
  199. canEndNotMax: false,
  200. selectPermanentCoroutine: SelectPermanentCoroutine,
  201. afterSelectPermanentCoroutine: null,
  202. mode: SelectPermanentEffect.Mode.Custom,
  203. cardEffect: activateClass);
  204. selectPermanentEffect.SetUpCustomMessage("Select 1 [Renamon].", "The opponent is selecting 1 [Renamon].");
  205. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  206. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  207. {
  208. selectedPermanent = permanent;
  209. yield return null;
  210. }
  211. }
  212. if (selectedPermanent != null)
  213. {
  214. if (selectedCards.Count == 3)
  215. {
  216. List<CardSource> digivolutionCards = new List<CardSource>();
  217. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  218. selectCardEffect.SetUp(
  219. canTargetCondition: (cardSource) => true,
  220. canTargetCondition_ByPreSelecetedList: null,
  221. canEndSelectCondition: null,
  222. canNoSelect: () => false,
  223. selectCardCoroutine: null,
  224. afterSelectCardCoroutine: AfterSelectCardCoroutine1,
  225. message: "Specify the order to place the cards in the digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  226. maxCount: selectedCards.Count,
  227. canEndNotMax: false,
  228. isShowOpponent: false,
  229. mode: SelectCardEffect.Mode.Custom,
  230. root: SelectCardEffect.Root.Custom,
  231. customRootCardList: selectedCards,
  232. canLookReverseCard: true,
  233. selectPlayer: card.Owner,
  234. cardEffect: activateClass);
  235. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards");
  236. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  237. IEnumerator AfterSelectCardCoroutine1(List<CardSource> cardSources)
  238. {
  239. digivolutionCards = cardSources.Clone();
  240. yield return null;
  241. }
  242. if (selectedPermanent.TopCard != null)
  243. {
  244. added = true;
  245. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(digivolutionCards, activateClass));
  246. }
  247. }
  248. }
  249. }
  250. if (added)
  251. {
  252. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  253. targetPermanent: selectedPermanent,
  254. cardCondition: CanSelectCardCondition2,
  255. payCost: true,
  256. reduceCostTuple: null,
  257. fixedCostTuple: null,
  258. ignoreDigivolutionRequirementFixedCost: 4,
  259. isHand: true,
  260. activateClass: activateClass,
  261. ignoreRequirements: CardEffectCommons.IgnoreRequirement.All,
  262. successProcess: SuccessProcess()));
  263. IEnumerator SuccessProcess()
  264. {
  265. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition3))
  266. {
  267. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition3));
  268. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  269. selectCardEffect.SetUp(
  270. canTargetCondition: CanSelectCardCondition3,
  271. canTargetCondition_ByPreSelecetedList: null,
  272. canEndSelectCondition: null,
  273. canNoSelect: () => false,
  274. selectCardCoroutine: null,
  275. afterSelectCardCoroutine: null,
  276. message: "Select 1 card to add to your hand.",
  277. maxCount: maxCount,
  278. canEndNotMax: false,
  279. isShowOpponent: true,
  280. mode: SelectCardEffect.Mode.AddHand,
  281. root: SelectCardEffect.Root.Trash,
  282. customRootCardList: null,
  283. canLookReverseCard: true,
  284. selectPlayer: card.Owner,
  285. cardEffect: activateClass);
  286. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  287. }
  288. }
  289. }
  290. }
  291. }
  292. }
  293. #endregion
  294. #region Security Skill
  295. if (timing == EffectTiming.SecuritySkill)
  296. {
  297. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  298. }
  299. #endregion
  300. return cardEffects;
  301. }
  302. }
  303. }