EX12_029.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Sagomon
  4. namespace DCGO.CardEffects.EX12
  5. {
  6. public class EX12_029 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternative Digivolve Condition
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.EqualsTraits("Shambala");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, false, card, null, level: 4));
  19. }
  20. #endregion
  21. #region Blocker
  22. if (timing == EffectTiming.None) cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  23. #endregion
  24. #region Shared OP / WD
  25. string SharedEffectName = "Stun 1 enemy Digimon/Tamer, then 1 of your other [SW] Digimon may gain <Alliance> and attack.";
  26. CardEffectFactory.ActivateClassesForSharedEffects
  27. (ref cardEffects, timing, card,
  28. SharedEffectName,
  29. SharedActivateCoroutine,
  30. SharedEffectDescription,
  31. optional: false,
  32. onPlay: true,
  33. whenDigivolving: true);
  34. string SharedEffectDescription(string tag) => $"[{tag}] 1 of your opponent's Digimon or Tamers can't suspend until their turn ends. Then, 1 of your other [SW] trait Digimon may gain <Alliance> for the turn and attack.";
  35. bool CanSelectEnemyPermanentCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  38. && (permanent.IsDigimon
  39. || permanent.IsTamer);
  40. }
  41. bool CanSelectOwnerPermanentCondition(Permanent permanent)
  42. {
  43. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  44. && permanent.TopCard.EqualsTraits("SW")
  45. && permanent != card.PermanentOfThisCard();
  46. }
  47. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  48. {
  49. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectEnemyPermanentCondition))
  50. {
  51. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  52. selectPermanentEffect.SetUp(
  53. selectPlayer: card.Owner,
  54. canTargetCondition: CanSelectEnemyPermanentCondition,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. maxCount: 1,
  58. canNoSelect: false,
  59. canEndNotMax: false,
  60. selectPermanentCoroutine: SelectPermanentCoroutine,
  61. afterSelectPermanentCoroutine: null,
  62. mode: SelectPermanentEffect.Mode.Custom,
  63. cardEffect: activateClass);
  64. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon or Tamer that will get unable to suspend.", "The opponent is selecting 1 Digimon or Tamer that will get unable to suspend.");
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  67. {
  68. Permanent selectedPermanent = permanent;
  69. if (selectedPermanent != null)
  70. {
  71. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  72. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  73. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  74. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  75. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  76. {
  77. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  78. }
  79. bool CanUseCondition1(Hashtable hashtable)
  80. {
  81. return selectedPermanent.TopCard != null
  82. && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  83. }
  84. bool PermanentCondition(Permanent permanent)
  85. {
  86. return permanent == selectedPermanent;
  87. }
  88. }
  89. }
  90. }
  91. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentCondition))
  92. {
  93. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  94. selectPermanentEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: CanSelectOwnerPermanentCondition,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: 1,
  100. canNoSelect: true,
  101. canEndNotMax: false,
  102. selectPermanentCoroutine: SelectPermanentCoroutine,
  103. afterSelectPermanentCoroutine: null,
  104. mode: SelectPermanentEffect.Mode.Custom,
  105. cardEffect: activateClass);
  106. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to gain <Alliance> and attack", "The opponent is selecting 1 Digimon to gain <Alliance> and attack");
  107. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  108. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  109. {
  110. if (permanent != null)
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: permanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  113. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  114. selectAttackEffect.SetUp(
  115. attacker: permanent,
  116. canAttackPlayerCondition: () => true,
  117. defenderCondition: _ => true,
  118. cardEffect: activateClass);
  119. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  120. }
  121. }
  122. }
  123. }
  124. #endregion
  125. #region DigiXros
  126. if (timing == EffectTiming.None)
  127. {
  128. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  129. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros -2", CanUseCondition, card);
  130. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  131. addDigiXrosConditionClass.SetNotShowUI(true);
  132. cardEffects.Add(addDigiXrosConditionClass);
  133. bool CanUseCondition(Hashtable hashtable)
  134. {
  135. return true;
  136. }
  137. DigiXrosCondition GetDigiXros(CardSource cardSource)
  138. {
  139. if (cardSource == card)
  140. {
  141. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition,
  142. "1 Lv.5 or lower Digimon card w/[Gokuumon] in text or w/[SW] trait");
  143. bool CanSelectCardCondition(CardSource xrosCardSource)
  144. {
  145. return xrosCardSource != null
  146. && xrosCardSource.Owner == card.Owner
  147. && xrosCardSource.IsDigimon
  148. && xrosCardSource.HasLevel
  149. && xrosCardSource.Level <= 5
  150. && (xrosCardSource.HasText("Gokuumon")
  151. || xrosCardSource.EqualsTraits("SW"));
  152. }
  153. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element };
  154. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  155. return digiXrosCondition;
  156. }
  157. return null;
  158. }
  159. }
  160. #endregion
  161. #region Inherited
  162. if (timing == EffectTiming.OnAllyAttack)
  163. {
  164. ActivateClass activateClass = new ActivateClass();
  165. activateClass.SetUpICardEffect("Trash bot 2 sources of 1 enemy Digimon, 1 of their sourceless Digimon can't suspend until their turn ends", CanUseCondition, card);
  166. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  167. activateClass.SetHashString("EX12_029_Inherited");
  168. activateClass.SetIsInheritedEffect(true);
  169. cardEffects.Add(activateClass);
  170. string EffectDescription()
  171. {
  172. return "[When Attacking] [Once Per Turn] Trash the bottom 2 digivolution cards of 1 of your opponent's Digimon. Then, 1 of their Digimon with no digivolution cards can't suspend until their turn ends.";
  173. }
  174. bool CanUseCondition(Hashtable hashtable)
  175. {
  176. return CardEffectCommons.IsExistOnBattleAreaDigimonTrigger(card, activateClass)
  177. && CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  178. }
  179. bool CanActivateCondition(Hashtable hashtable)
  180. {
  181. return CardEffectCommons.IsExistOnBattleAreaDigimonActivate(card, activateClass);
  182. }
  183. bool CanSelectPermanentCondition(Permanent permanent)
  184. {
  185. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  186. }
  187. bool OpponentsDigimonWithoutSources(Permanent permanent)
  188. {
  189. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  190. && permanent.DigivolutionCards.Count == 0;
  191. }
  192. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  193. {
  194. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  195. {
  196. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  197. selectPermanentEffect.SetUp(
  198. selectPlayer: card.Owner,
  199. canTargetCondition: CanSelectPermanentCondition,
  200. canTargetCondition_ByPreSelecetedList: null,
  201. canEndSelectCondition: null,
  202. maxCount: 1,
  203. canNoSelect: false,
  204. canEndNotMax: false,
  205. selectPermanentCoroutine: SelectPermanentCoroutine,
  206. afterSelectPermanentCoroutine: null,
  207. mode: SelectPermanentEffect.Mode.Custom,
  208. cardEffect: activateClass);
  209. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to trash digivolution cards from.",
  210. "The opponent is selecting 1 Digimon to trash digivolution cards from.");
  211. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  212. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  213. {
  214. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(
  215. targetPermanent: permanent,
  216. trashCount: 2,
  217. isFromTop: false,
  218. activateClass: activateClass));
  219. }
  220. }
  221. if (CardEffectCommons.HasMatchConditionPermanent(OpponentsDigimonWithoutSources))
  222. {
  223. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  224. selectPermanentEffect1.SetUp(
  225. selectPlayer: card.Owner,
  226. canTargetCondition: OpponentsDigimonWithoutSources,
  227. canTargetCondition_ByPreSelecetedList: null,
  228. canEndSelectCondition: null,
  229. maxCount: 1,
  230. canNoSelect: false,
  231. canEndNotMax: false,
  232. selectPermanentCoroutine: null,
  233. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  234. mode: SelectPermanentEffect.Mode.Custom,
  235. cardEffect: activateClass);
  236. selectPermanentEffect1.SetUpCustomMessage("Select 1 Digimon to gain can't suspend until end of opponent's turn.", "The opponent is selecting 1 Digimon that will gain can't suspend until end of opponent's turn.");
  237. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  238. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  239. {
  240. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotSuspendPlayerEffect(
  241. permanentCondition: (permanent) => permanent == permanents[0],
  242. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  243. activateClass: activateClass,
  244. isOnlyActivePhase: false,
  245. effectName: "Can't Suspend"));
  246. }
  247. }
  248. }
  249. }
  250. #endregion
  251. return cardEffects;
  252. }
  253. }
  254. }