EX11_036.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. // Dalphomon
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. public class EX11_036 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alt Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel5 && targetPermanent.TopCard.HasText("Maquinamon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region Vortex
  23. if (timing == EffectTiming.OnEndTurn)
  24. {
  25. cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card, condition: null));
  26. }
  27. #endregion
  28. #region Shared OP / WD /WA
  29. string SharedHashString = "EX11_036_OP_WD_WA";
  30. string SharedEffectName = "Suspend 2 Opponent's digimon or Tamers. 1 of their Digimon or Tamers can't unsuspend";
  31. string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] Suspend 2 of your opponent's Digimon or Tamers. Then, 1 of their Digimon or Tamers can't unsuspend until their turn ends.";
  32. bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  33. bool SharedCanSelectPermanentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  36. && (permanent.IsDigimon || permanent.IsTamer);
  37. }
  38. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  39. {
  40. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, SharedCanSelectPermanentCondition))
  41. {
  42. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, SharedCanSelectPermanentCondition));
  43. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  44. selectPermanentEffect1.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: SharedCanSelectPermanentCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: maxCount,
  50. canNoSelect: false,
  51. canEndNotMax: false,
  52. selectPermanentCoroutine: null,
  53. afterSelectPermanentCoroutine: null,
  54. mode: SelectPermanentEffect.Mode.Tap,
  55. cardEffect: activateClass);
  56. selectPermanentEffect1.SetUpCustomMessage($"Select {maxCount} Digimon or Tamers to Suspend.", $"The opponent is selecting {maxCount} Digimon or Tamers to Suspend.");
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  58. SelectPermanentEffect selectPermanentEffect2 = GManager.instance.GetComponent<SelectPermanentEffect>();
  59. selectPermanentEffect2 = GManager.instance.GetComponent<SelectPermanentEffect>();
  60. selectPermanentEffect2.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: SharedCanSelectPermanentCondition,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: 1,
  66. canNoSelect: false,
  67. canEndNotMax: false,
  68. selectPermanentCoroutine: SelectPermanentCoroutine,
  69. afterSelectPermanentCoroutine: null,
  70. mode: SelectPermanentEffect.Mode.Custom,
  71. cardEffect: activateClass);
  72. selectPermanentEffect2.SetUpCustomMessage("Select 1 Digimon or Tamer that can't unsuspend.", "The opponent is selecting 1 Digimon or Tamer that can't unsuspend.");
  73. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect2.Activate());
  74. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  75. {
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  77. targetPermanent: permanent,
  78. activateClass: activateClass
  79. ));
  80. }
  81. }
  82. }
  83. #endregion
  84. #region On Play
  85. if (timing == EffectTiming.OnEnterFieldAnyone)
  86. {
  87. ActivateClass activateClass = new ActivateClass();
  88. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  89. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("On Play"));
  90. activateClass.SetHashString(SharedHashString);
  91. cardEffects.Add(activateClass);
  92. bool CanUseCondition(Hashtable hashtable)
  93. {
  94. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  95. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  96. }
  97. }
  98. #endregion
  99. #region When Digivolving
  100. if (timing == EffectTiming.OnEnterFieldAnyone)
  101. {
  102. ActivateClass activateClass = new ActivateClass();
  103. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  104. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Digivolving"));
  105. activateClass.SetHashString(SharedHashString);
  106. cardEffects.Add(activateClass);
  107. bool CanUseCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  110. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  111. }
  112. }
  113. #endregion
  114. #region When Attacking
  115. if(timing == EffectTiming.OnAllyAttack)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  119. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), 1, false, SharedEffectDescription("When Attacking"));
  120. activateClass.SetHashString(SharedHashString);
  121. cardEffects.Add(activateClass);
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  125. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  126. }
  127. }
  128. #endregion
  129. #region End of Your Turn
  130. if (timing == EffectTiming.OnEndTurn)
  131. {
  132. ActivateClass activateClass = new ActivateClass();
  133. activateClass.SetUpICardEffect("1 other digimon may digivolve into a black card w/[Maquinamon] in text for free", CanUseCondition, card);
  134. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDescription());
  135. activateClass.SetHashString("EX11_036_EOYT");
  136. cardEffects.Add(activateClass);
  137. string EffectDescription() => "[End of Your Turn] [Once Per Turn] 1 of your other Digimon may digivolve into a black Digimon card with [Maquinamon] in its text in the hand without paying the cost.";
  138. bool CanUseCondition(Hashtable hashtable)
  139. {
  140. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  141. && CardEffectCommons.IsOwnerTurn(card);
  142. }
  143. bool CanActivateCondition(Hashtable hashtable)
  144. {
  145. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  146. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, CanDigivolvePermanentCondition);
  147. }
  148. bool CanDigivolvePermanentCondition(Permanent permanent)
  149. {
  150. return permanent != card.PermanentOfThisCard()
  151. && CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card)
  152. && CardEffectCommons.HasMatchConditionOwnersHand(card, cardSource => CanDigivolveCardCondition(cardSource, permanent));
  153. }
  154. bool CanDigivolveCardCondition(CardSource cardSource, Permanent permanent)
  155. {
  156. return CanSelectCardCondition(cardSource)
  157. && cardSource.CanPlayCardTargetFrame(permanent.PermanentFrame, false, activateClass);
  158. }
  159. bool CanSelectCardCondition(CardSource cardSource)
  160. {
  161. return cardSource.HasText("Maquinamon")
  162. && cardSource.HasCardColor(CardColor.Black);
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable hashtable)
  165. {
  166. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  167. selectPermanentEffect.SetUp(
  168. selectPlayer: card.Owner,
  169. canTargetCondition: CanDigivolvePermanentCondition,
  170. canTargetCondition_ByPreSelecetedList: null,
  171. canEndSelectCondition: null,
  172. maxCount: 1,
  173. canNoSelect: true,
  174. canEndNotMax: false,
  175. selectPermanentCoroutine: SelectPermanentCoroutine,
  176. afterSelectPermanentCoroutine: null,
  177. mode: SelectPermanentEffect.Mode.Custom,
  178. cardEffect: activateClass);
  179. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to digivolve.", "Opponent is selecting a Digimon to digivolve.");
  180. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  181. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  182. {
  183. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DigivolveIntoHandOrTrashCard(
  184. targetPermanent: permanent,
  185. cardCondition: CanSelectCardCondition,
  186. payCost: false,
  187. reduceCostTuple: null,
  188. fixedCostTuple: null,
  189. ignoreDigivolutionRequirementFixedCost: -1,
  190. isHand: true,
  191. activateClass: activateClass,
  192. successProcess: null
  193. ));
  194. }
  195. }
  196. }
  197. #endregion
  198. #region Assembly
  199. if (timing == EffectTiming.None)
  200. {
  201. AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
  202. addAssemblyConditionClass.SetUpICardEffect($"Assembly", CanUseCondition, card);
  203. addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
  204. addAssemblyConditionClass.SetNotShowUI(true);
  205. cardEffects.Add(addAssemblyConditionClass);
  206. bool CanUseCondition(Hashtable hashtable)
  207. {
  208. return true;
  209. }
  210. AssemblyCondition GetAssembly(CardSource cardSource)
  211. {
  212. if (cardSource == card)
  213. {
  214. AssemblyConditionElement element = new AssemblyConditionElement(CanSelectCardCondition);
  215. bool CanSelectCardCondition(CardSource cardSource)
  216. {
  217. return cardSource != null
  218. && cardSource.Owner == card.Owner
  219. && cardSource.IsDigimon
  220. && cardSource.HasCardColor(CardColor.Green)
  221. && cardSource.HasText("Maquinamon");
  222. }
  223. AssemblyCondition assemblyCondition = new AssemblyCondition(
  224. element: element,
  225. CanTargetCondition_ByPreSelecetedList: null,
  226. selectMessage: "5 Green Digimon cards with [Maquinamon] in text",
  227. elementCount: 5,
  228. reduceCost: 5);
  229. return assemblyCondition;
  230. }
  231. return null;
  232. }
  233. }
  234. #endregion
  235. #region ESS
  236. if (timing == EffectTiming.WhenLinked)
  237. {
  238. ActivateClass activateClass = new ActivateClass();
  239. activateClass.SetUpICardEffect("Suspend 1 Digimon, then this may attack", CanUseCondition, card);
  240. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  241. activateClass.SetIsInheritedEffect(true);
  242. activateClass.SetHashString("EX11_036_YT_ESS");
  243. cardEffects.Add(activateClass);
  244. string EffectDescription() => "[Your Turn] [Once Per Turn] When this Digimon gets linked, suspend 1 of your opponent's Digimon. Then, this Digimon may attack.";
  245. bool CanUseCondition(Hashtable hashtable)
  246. {
  247. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  248. && CardEffectCommons.IsOwnerTurn(card)
  249. && CardEffectCommons.CanTriggerWhenLinked(hashtable, PermanentCondition, null);
  250. }
  251. bool PermanentCondition(Permanent permanent) => permanent == card.PermanentOfThisCard();
  252. bool CanActivateCondition(Hashtable hashtable)
  253. {
  254. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  255. }
  256. bool IsOpponentsDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  257. IEnumerator ActivateCoroutine(Hashtable hashtable)
  258. {
  259. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon))
  260. {
  261. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  262. selectPermanentEffect1.SetUp(
  263. selectPlayer: card.Owner,
  264. canTargetCondition: IsOpponentsDigimon,
  265. canTargetCondition_ByPreSelecetedList: null,
  266. canEndSelectCondition: null,
  267. maxCount: 1,
  268. canNoSelect: false,
  269. canEndNotMax: false,
  270. selectPermanentCoroutine: null,
  271. afterSelectPermanentCoroutine: null,
  272. mode: SelectPermanentEffect.Mode.Tap,
  273. cardEffect: activateClass);
  274. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon to Suspend.", "The opponent is selecting 1 Digimon to Suspend.");
  275. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  276. }
  277. if (card.PermanentOfThisCard().CanAttack(activateClass))
  278. {
  279. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  280. selectAttackEffect.SetUp(
  281. attacker: card.PermanentOfThisCard(),
  282. canAttackPlayerCondition: () => true,
  283. defenderCondition: _ => true,
  284. cardEffect: activateClass);
  285. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  286. }
  287. }
  288. }
  289. #endregion
  290. return cardEffects;
  291. }
  292. }
  293. }