HenryWong_ST17_10.cs 16 KB

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