EX5_064.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. public class EX5_064 : CEntity_Effect
  5. {
  6. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  7. {
  8. List<ICardEffect> cardEffects = new List<ICardEffect>();
  9. if (timing == EffectTiming.OnStartTurn)
  10. {
  11. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  12. }
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Your Digimon digivolves", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] By suspending this Tamer and placing the top card of one of your [Light Fang]/[Night Claw] trait Digimon as that Digimon's bottom digivolution card, 1 of your Digimon may digivolve into a Digimon card in your hand without paying the cost.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.DigivolutionCards.Count >= 1)
  28. {
  29. if (permanent.TopCard.CardTraits.Contains("Light Fang"))
  30. {
  31. return true;
  32. }
  33. if (permanent.TopCard.CardTraits.Contains("LightFung"))
  34. {
  35. return true;
  36. }
  37. if (permanent.TopCard.CardTraits.Contains("Night Claw"))
  38. {
  39. return true;
  40. }
  41. if (permanent.TopCard.CardTraits.Contains("NightClaw"))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. return false;
  48. }
  49. bool CanSelectPermanentCondition1(Permanent permanent)
  50. {
  51. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  52. {
  53. foreach (CardSource cardSource in card.Owner.HandCards)
  54. {
  55. if (CanSelectCardCondition(cardSource))
  56. {
  57. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  58. {
  59. return true;
  60. }
  61. }
  62. }
  63. }
  64. return false;
  65. }
  66. bool CanSelectCardCondition(CardSource cardSource)
  67. {
  68. return cardSource.IsDigimon;
  69. }
  70. bool CanUseCondition(Hashtable hashtable)
  71. {
  72. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  73. }
  74. bool CanActivateCondition(Hashtable hashtable)
  75. {
  76. if (CardEffectCommons.IsExistOnBattleArea(card))
  77. {
  78. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  79. {
  80. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  81. {
  82. return true;
  83. }
  84. }
  85. }
  86. return false;
  87. }
  88. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  89. {
  90. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  91. new List<Permanent>() { card.PermanentOfThisCard() },
  92. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  93. Permanent selectedPermanent = null;
  94. bool digivolutionCardsAdded = false;
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  96. {
  97. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: false,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: SelectPermanentCoroutine,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Custom,
  110. cardEffect: activateClass);
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  113. {
  114. selectedPermanent = permanent;
  115. yield return null;
  116. }
  117. }
  118. if (selectedPermanent != null)
  119. {
  120. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  121. {
  122. if (selectedPermanent.DigivolutionCards.Count >= 1)
  123. {
  124. CardSource topCard = selectedPermanent.TopCard;
  125. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(
  126. new List<CardSource>() { topCard },
  127. activateClass));
  128. digivolutionCardsAdded = true;
  129. }
  130. }
  131. }
  132. if (digivolutionCardsAdded)
  133. {
  134. if (selectedPermanent != null)
  135. {
  136. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  137. {
  138. selectedPermanent = null;
  139. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  140. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  141. selectPermanentEffect.SetUp(
  142. selectPlayer: card.Owner,
  143. canTargetCondition: CanSelectPermanentCondition1,
  144. canTargetCondition_ByPreSelecetedList: null,
  145. canEndSelectCondition: null,
  146. maxCount: maxCount,
  147. canNoSelect: true,
  148. canEndNotMax: false,
  149. selectPermanentCoroutine: SelectPermanentCoroutine,
  150. afterSelectPermanentCoroutine: null,
  151. mode: SelectPermanentEffect.Mode.Custom,
  152. cardEffect: activateClass);
  153. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  154. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  155. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  156. {
  157. selectedPermanent = permanent;
  158. yield return null;
  159. }
  160. if (selectedPermanent != null)
  161. {
  162. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  163. targetPermanent: selectedPermanent,
  164. cardCondition: CanSelectCardCondition,
  165. payCost: false,
  166. reduceCostTuple: null,
  167. fixedCostTuple: null,
  168. ignoreDigivolutionRequirementFixedCost: -1,
  169. isHand: true,
  170. activateClass: activateClass,
  171. successProcess: null));
  172. }
  173. }
  174. }
  175. }
  176. }
  177. }
  178. if (timing == EffectTiming.OnDeclaration)
  179. {
  180. ActivateClass activateClass = new ActivateClass();
  181. activateClass.SetUpICardEffect("Your Digimon digivolves", CanUseCondition, card);
  182. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  183. cardEffects.Add(activateClass);
  184. string EffectDiscription()
  185. {
  186. return "[Main] By suspending this Tamer and placing the top card of one of your [Light Fang]/[Night Claw] trait Digimon as that Digimon's bottom digivolution card, 1 of your Digimon may digivolve into a Digimon card in your hand without paying the cost.";
  187. }
  188. bool CanSelectPermanentCondition(Permanent permanent)
  189. {
  190. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  191. {
  192. if (permanent.DigivolutionCards.Count >= 1)
  193. {
  194. if (permanent.TopCard.CardTraits.Contains("Light Fang"))
  195. {
  196. return true;
  197. }
  198. if (permanent.TopCard.CardTraits.Contains("LightFung"))
  199. {
  200. return true;
  201. }
  202. if (permanent.TopCard.CardTraits.Contains("Night Claw"))
  203. {
  204. return true;
  205. }
  206. if (permanent.TopCard.CardTraits.Contains("NightClaw"))
  207. {
  208. return true;
  209. }
  210. }
  211. }
  212. return false;
  213. }
  214. bool CanSelectPermanentCondition1(Permanent permanent)
  215. {
  216. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  217. {
  218. foreach (CardSource cardSource in card.Owner.HandCards)
  219. {
  220. if (CanSelectCardCondition(cardSource))
  221. {
  222. if (cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass))
  223. {
  224. return true;
  225. }
  226. }
  227. }
  228. }
  229. return false;
  230. }
  231. bool CanSelectCardCondition(CardSource cardSource)
  232. {
  233. return cardSource.IsDigimon;
  234. }
  235. bool CanUseCondition(Hashtable hashtable)
  236. {
  237. if (CardEffectCommons.IsExistOnBattleArea(card))
  238. {
  239. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  240. {
  241. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  242. {
  243. return true;
  244. }
  245. }
  246. }
  247. return false;
  248. }
  249. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  250. {
  251. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  252. new List<Permanent>() { card.PermanentOfThisCard() },
  253. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  254. Permanent selectedPermanent = null;
  255. bool digivolutionCardsAdded = false;
  256. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  257. {
  258. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  259. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  260. selectPermanentEffect.SetUp(
  261. selectPlayer: card.Owner,
  262. canTargetCondition: CanSelectPermanentCondition,
  263. canTargetCondition_ByPreSelecetedList: null,
  264. canEndSelectCondition: null,
  265. maxCount: maxCount,
  266. canNoSelect: false,
  267. canEndNotMax: false,
  268. selectPermanentCoroutine: SelectPermanentCoroutine,
  269. afterSelectPermanentCoroutine: null,
  270. mode: SelectPermanentEffect.Mode.Custom,
  271. cardEffect: activateClass);
  272. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  273. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  274. {
  275. selectedPermanent = permanent;
  276. yield return null;
  277. }
  278. }
  279. if (selectedPermanent != null)
  280. {
  281. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  282. {
  283. if (selectedPermanent.DigivolutionCards.Count >= 1)
  284. {
  285. CardSource topCard = selectedPermanent.TopCard;
  286. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(
  287. new List<CardSource>() { topCard },
  288. activateClass));
  289. digivolutionCardsAdded = true;
  290. }
  291. }
  292. }
  293. if (digivolutionCardsAdded)
  294. {
  295. if (selectedPermanent != null)
  296. {
  297. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  298. {
  299. selectedPermanent = null;
  300. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  301. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  302. selectPermanentEffect.SetUp(
  303. selectPlayer: card.Owner,
  304. canTargetCondition: CanSelectPermanentCondition1,
  305. canTargetCondition_ByPreSelecetedList: null,
  306. canEndSelectCondition: null,
  307. maxCount: maxCount,
  308. canNoSelect: true,
  309. canEndNotMax: false,
  310. selectPermanentCoroutine: SelectPermanentCoroutine,
  311. afterSelectPermanentCoroutine: null,
  312. mode: SelectPermanentEffect.Mode.Custom,
  313. cardEffect: activateClass);
  314. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will digivolve.", "The opponent is selecting 1 Digimon that will digivolve.");
  315. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  316. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  317. {
  318. selectedPermanent = permanent;
  319. yield return null;
  320. }
  321. if (selectedPermanent != null)
  322. {
  323. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  324. targetPermanent: selectedPermanent,
  325. cardCondition: CanSelectCardCondition,
  326. payCost: false,
  327. reduceCostTuple: null,
  328. fixedCostTuple: null,
  329. ignoreDigivolutionRequirementFixedCost: -1,
  330. isHand: true,
  331. activateClass: activateClass,
  332. successProcess: null));
  333. }
  334. }
  335. }
  336. }
  337. }
  338. }
  339. if (timing == EffectTiming.SecuritySkill)
  340. {
  341. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  342. }
  343. return cardEffects;
  344. }
  345. }