EX12_063.cs 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Karakurumon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_063 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolution Cost
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return !targetPermanent.HasPermanentColor(CardColor.White)
  17. && (targetPermanent.TopCard.EqualsTraits("Puppet")
  18. || targetPermanent.TopCard.EqualsTraits("Shambala"));
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition,
  22. digivolutionCost: 3,
  23. ignoreDigivolutionRequirement: false,
  24. card: card,
  25. condition: null,
  26. level: 4
  27. )
  28. );
  29. }
  30. #endregion
  31. #region Shared OP / WD
  32. string SharedEffectName = "Suspend 1 enemy Digimon/Tamer. 1 of their Digimon/Tamers can't unsuspend until their turn ends";
  33. string SharedEffectDescription(string tag)
  34. => $"[{tag}] Suspend 1 of your opponent's Digimon or Tamers. Then, 1 of their Digimon or Tamers can't unsuspend until their turn ends.";
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  38. && (permanent.IsDigimon || permanent.IsTamer);
  39. }
  40. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  41. {
  42. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  43. {
  44. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  45. selectPermanentEffect.SetUp(
  46. selectPlayer: card.Owner,
  47. canTargetCondition: CanSelectPermanentCondition,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. maxCount: 1,
  51. canNoSelect: false,
  52. canEndNotMax: false,
  53. selectPermanentCoroutine: null,
  54. afterSelectPermanentCoroutine: null,
  55. mode: SelectPermanentEffect.Mode.Tap,
  56. cardEffect: activateClass);
  57. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  58. }
  59. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  60. {
  61. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: 1,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectPermanentCoroutine,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will not unsuspend.", "The opponent is selecting 1 Digimon or Tamer that will not unsuspend.");
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  77. {
  78. Permanent selectedPermanent = permanent;
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCantUnsuspendUntilOpponentTurnEnd(
  80. targetPermanent: selectedPermanent,
  81. activateClass: activateClass
  82. ));
  83. }
  84. }
  85. }
  86. CardEffectFactory.ActivateClassesForSharedEffects
  87. (ref cardEffects, timing, card,
  88. SharedEffectName,
  89. SharedActivateCoroutine,
  90. SharedEffectDescription,
  91. optional: false,
  92. onPlay: true,
  93. whenDigivolving: true);
  94. #endregion
  95. #region Shared On Deletion
  96. string OnDeletionEffectName = "May play 1 Level 4 or less [Puppet]/[TB] from trash";
  97. string OnDeletionEffectDescription() => "[On Deletion] You may play 1 level 4 or lower [Puppet] or [TB] trait Digimon from your trash without paying the cost.";
  98. bool OnDeletionUseCondition(Hashtable hashtable, ActivateClass activateClass) => CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  99. bool OnDeletionActivateCondition(Hashtable hashtable, ActivateClass activateClass) => CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  100. IEnumerator OnDeletionActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  101. {
  102. bool CanPlayTrashDigimon(CardSource cardSource)
  103. {
  104. return cardSource.IsDigimon
  105. && cardSource.HasLevel
  106. && cardSource.Level <= 4
  107. && (cardSource.EqualsTraits("Puppet") || cardSource.EqualsTraits("TB"))
  108. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  109. }
  110. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanPlayTrashDigimon))
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayByEffect(
  113. canTargetCondition: CanPlayTrashDigimon,
  114. SelectCardEffect.Root.Trash,
  115. activateClass,
  116. payCost: false
  117. ));
  118. }
  119. }
  120. if (timing == EffectTiming.OnDestroyedAnyone)
  121. {
  122. ActivateClass activateClass = new();
  123. activateClass.SetUpICardEffect(OnDeletionEffectName, hash => OnDeletionUseCondition(hash, activateClass), card);
  124. activateClass.SetUpActivateClass(hash => OnDeletionActivateCondition(hash, activateClass), hash => OnDeletionActivateCoroutine(hash, activateClass), -1, false, OnDeletionEffectDescription());
  125. activateClass.SetIsSkippable(true);
  126. cardEffects.Add(activateClass);
  127. }
  128. if (timing == EffectTiming.OnDestroyedAnyone)
  129. {
  130. ActivateClass activateClass = new();
  131. activateClass.SetUpICardEffect(OnDeletionEffectName, hash => OnDeletionUseCondition(hash, activateClass), card);
  132. activateClass.SetUpActivateClass(hash => OnDeletionActivateCondition(hash, activateClass), hash => OnDeletionActivateCoroutine(hash, activateClass), -1, false, OnDeletionEffectDescription());
  133. activateClass.SetIsSkippable(true);
  134. activateClass.SetIsInheritedEffect(true);
  135. cardEffects.Add(activateClass);
  136. }
  137. #endregion
  138. #region Assembly
  139. if (timing == EffectTiming.None)
  140. {
  141. AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
  142. addAssemblyConditionClass.SetUpICardEffect($"Assembly", CanUseCondition, card);
  143. addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
  144. addAssemblyConditionClass.SetNotShowUI(true);
  145. cardEffects.Add(addAssemblyConditionClass);
  146. bool CanUseCondition(Hashtable hashtable) => true;
  147. AssemblyCondition GetAssembly(CardSource cardSource)
  148. {
  149. if (cardSource == card)
  150. {
  151. AssemblyConditionElement element = new AssemblyConditionElement(CanSelectCardCondition);
  152. bool CanSelectCardCondition(CardSource cardSource)
  153. {
  154. return cardSource != null
  155. && cardSource.Owner == card.Owner
  156. && cardSource.HasLevel
  157. && cardSource.Level <= 4
  158. && (cardSource.EqualsTraits("Puppet")
  159. || cardSource.EqualsTraits("TB"));
  160. }
  161. AssemblyCondition assemblyCondition = new AssemblyCondition(
  162. element: element,
  163. CanTargetCondition_ByPreSelecetedList: null,
  164. selectMessage: "Lv. 4 or Lower [Puppet]/[TB] trait card",
  165. elementCount: 1,
  166. reduceCost: 2);
  167. return assemblyCondition;
  168. }
  169. return null;
  170. }
  171. }
  172. #endregion
  173. return cardEffects;
  174. }
  175. }
  176. }