TakatoMatsuki_BT17_080.cs 16 KB

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