EX12_036.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Ryugumon
  5. namespace DCGO.CardEffects.EX12
  6. {
  7. public class EX12_036 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition [Digivolve] Lv.5 w/[Aquatic]/[Shambala] trait: Cost 3
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsTraits("Aquatic")
  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: 5)
  27. );
  28. }
  29. #endregion
  30. #region Barrier
  31. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  32. {
  33. cardEffects.Add(CardEffectFactory.BarrierSelfEffect(isInheritedEffect: false, card: card, condition: null));
  34. }
  35. #endregion
  36. #region Evade
  37. if (timing == EffectTiming.WhenPermanentWouldBeDeleted)
  38. {
  39. cardEffects.Add(CardEffectFactory.EvadeSelfEffect(isInheritedEffect: false, card: card, condition: null));
  40. }
  41. #endregion
  42. #region Decode <Lv.5 or lower w/[Aqua]/[Sea Animal] in any trait or w/[TB] trait>
  43. if (timing == EffectTiming.WhenRemoveField)
  44. {
  45. bool SourceCondition(CardSource cardSource)
  46. {
  47. return cardSource.IsDigimon
  48. && cardSource.HasLevel
  49. && cardSource.Level <= 5
  50. && (cardSource.ContainsTraits("Aqua")
  51. || cardSource.ContainsTraits("Sea Animal")
  52. || cardSource.EqualsTraits("TB"));
  53. }
  54. string[] decodeStrings = { "(Lv.5 or lower w/[Aqua]/[Sea Animal] in any trait or w/[TB] trait)", "Level 5 or lower Digimon card with [Aqua]/[Sea Animal] in any trait or [TB] trait" };
  55. cardEffects.Add(CardEffectFactory.DecodeSelfEffect(card: card, isInheritedEffect: false, decodeStrings: decodeStrings, sourceCondition: SourceCondition, condition: null));
  56. }
  57. #endregion
  58. #region Shared OP/WD/WA — Place 1 Lv.6 or lower [Aqua]/[Sea Animal]/[TB] from hand as bottom source, then unsuspend 1 of your Digimon
  59. string SharedHashString = "EX12_036_OP_WD_WA";
  60. string SharedEffectName = "Place 1 Lv.6 or lower [Aqua]/[Sea Animal]/[TB] card from hand as bottom source to unsuspend 1 of your Digimon";
  61. CardEffectFactory.ActivateClassesForSharedEffects(
  62. ref cardEffects, timing, card,
  63. SharedEffectName,
  64. SharedActivateCoroutine,
  65. SharedEffectDescription,
  66. optional: false,
  67. isSkippable: true,
  68. maxCountPerTurn: 1,
  69. hashValue: SharedHashString,
  70. onPlay: true,
  71. whenDigivolving: true,
  72. whenAttacking: true);
  73. string SharedEffectDescription(string tag)
  74. => $"[{tag}] [Once Per Turn] By placing 1 level 6 or lower card with [Aqua] or [Sea Animal] in any of its traits or the [TB] trait from your hand as this Digimon's bottom digivolution card, 1 of your Digimon may unsuspend.";
  75. bool CanSelectHandCardCondition(CardSource cardSource)
  76. {
  77. return cardSource.HasLevel
  78. && cardSource.Level <= 6
  79. && (cardSource.ContainsTraits("Aqua")
  80. || cardSource.ContainsTraits("Sea Animal")
  81. || cardSource.EqualsTraits("TB"));
  82. }
  83. bool IsYourDigimonCondition(Permanent permanent)
  84. {
  85. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  86. }
  87. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  88. {
  89. bool isUsed = false;
  90. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectHandCardCondition))
  91. {
  92. CardSource selectedCard = null;
  93. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  94. selectHandEffect.SetUp(
  95. selectPlayer: card.Owner,
  96. canTargetCondition: CanSelectHandCardCondition,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canEndSelectCondition: null,
  99. maxCount: 1,
  100. canNoSelect: true,
  101. canEndNotMax: false,
  102. isShowOpponent: true,
  103. selectCardCoroutine: SelectCardCoroutine,
  104. afterSelectCardCoroutine: null,
  105. mode: SelectHandEffect.Mode.Custom,
  106. cardEffect: activateClass);
  107. selectHandEffect.SetUpCustomMessage("Select 1 card to place as the bottom digivolution card.", "The opponent is selecting 1 card to place as the bottom digivolution card.");
  108. selectHandEffect.SetUpCustomMessage_ShowCard("Selected Card");
  109. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  110. IEnumerator SelectCardCoroutine(CardSource cardSource)
  111. {
  112. selectedCard = cardSource;
  113. yield return null;
  114. }
  115. if (selectedCard != null)
  116. {
  117. isUsed = true;
  118. yield return ContinuousController.instance.StartCoroutine(
  119. card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  120. if (CardEffectCommons.HasMatchConditionPermanent(IsYourDigimonCondition))
  121. {
  122. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  123. selectPermanentEffect.SetUp(
  124. selectPlayer: card.Owner,
  125. canTargetCondition: IsYourDigimonCondition,
  126. canTargetCondition_ByPreSelecetedList: null,
  127. canEndSelectCondition: null,
  128. maxCount: 1,
  129. canNoSelect: true,
  130. canEndNotMax: false,
  131. selectPermanentCoroutine: null,
  132. afterSelectPermanentCoroutine: null,
  133. mode: SelectPermanentEffect.Mode.UnTap,
  134. cardEffect: activateClass);
  135. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  136. }
  137. }
  138. }
  139. if (!isUsed) activateClass.RemoveUse();
  140. }
  141. #endregion
  142. #region [All Turns]
  143. if (timing == EffectTiming.OnEnterFieldAnyone)
  144. {
  145. ActivateClass activateClass = new ActivateClass();
  146. activateClass.SetUpICardEffect("1 opponent's Digimon can't activate [When Digivolving] effects or suspend until their turn ends", CanUseCondition, card);
  147. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  148. activateClass.SetHashString("EX12_036_AT");
  149. cardEffects.Add(activateClass);
  150. string EffectDescription()
  151. {
  152. return "[All Turns] [Once Per Turn] When any of your Digimon are played or digivolve, 1 of your opponent's Digimon can't activate [When Digivolving] effects or suspend until their turn ends.";
  153. }
  154. bool CanUseCondition(Hashtable hashtable)
  155. {
  156. return CardEffectCommons.IsExistOnBattleAreaTrigger(card, activateClass)
  157. && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, YourDigimonPlayedCondition)
  158. || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, YourDigimonPlayedCondition));
  159. }
  160. bool YourDigimonPlayedCondition(Permanent permanent)
  161. {
  162. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  163. }
  164. bool CanActivateCondition(Hashtable hashtable)
  165. {
  166. return CardEffectCommons.IsExistOnBattleAreaActivate(card, activateClass)
  167. && CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon);
  168. }
  169. bool IsOpponentsDigimon(Permanent permanent)
  170. {
  171. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  172. }
  173. IEnumerator ActivateCoroutine(Hashtable hashtable)
  174. {
  175. if (CardEffectCommons.HasMatchConditionPermanent(IsOpponentsDigimon))
  176. {
  177. Permanent selectedPermanent = null;
  178. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  179. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsOpponentsDigimon));
  180. selectPermanentEffect.SetUp(
  181. selectPlayer: card.Owner,
  182. canTargetCondition: IsOpponentsDigimon,
  183. canTargetCondition_ByPreSelecetedList: null,
  184. canEndSelectCondition: null,
  185. maxCount: maxCount,
  186. canNoSelect: false,
  187. canEndNotMax: false,
  188. selectPermanentCoroutine: SelectedPermanent,
  189. afterSelectPermanentCoroutine: null,
  190. mode: SelectPermanentEffect.Mode.Custom,
  191. cardEffect: activateClass);
  192. IEnumerator SelectedPermanent(Permanent target)
  193. {
  194. selectedPermanent = target;
  195. yield return null;
  196. }
  197. selectPermanentEffect.SetUpCustomMessage(
  198. "Select 1 Digimon that cant activate [When Digivolving] effects or suspend.",
  199. "The opponent is selecting 1 Digimon that will gain cant activate [When Digivolving] effects or suspend.");
  200. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  201. if (selectedPermanent != null)
  202. {
  203. // Can't activate [When Digivolving] effects
  204. DisableEffectClass invalidationClass = new DisableEffectClass();
  205. invalidationClass.SetUpICardEffect("Ignore [When Digivolving] Effect", CanUseConditionDebuff, card);
  206. invalidationClass.SetUpDisableEffectClass(DisableCondition: InvalidateCondition);
  207. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => invalidationClass);
  208. bool CanUseConditionDebuff(Hashtable hashtableDebuff)
  209. {
  210. return selectedPermanent.TopCard != null
  211. && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  212. }
  213. bool InvalidateCondition(ICardEffect cardEffect)
  214. {
  215. return selectedPermanent.TopCard != null
  216. && cardEffect != null
  217. && cardEffect.EffectSourceCard != null
  218. && isExistOnField(cardEffect.EffectSourceCard)
  219. && cardEffect.EffectSourceCard.PermanentOfThisCard() == selectedPermanent
  220. && cardEffect.IsWhenDigivolving
  221. && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  222. }
  223. // Can't suspend
  224. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  225. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseConditionSuspend, card);
  226. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCanNotSuspendCondition);
  227. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
  228. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  229. {
  230. yield return ContinuousController.instance.StartCoroutine(
  231. GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  232. }
  233. bool CanUseConditionSuspend(Hashtable hashtableSuspend)
  234. {
  235. return selectedPermanent.TopCard != null
  236. && !selectedPermanent.TopCard.CanNotBeAffected(activateClass);
  237. }
  238. bool PermanentCanNotSuspendCondition(Permanent permanentTarget)
  239. {
  240. return permanentTarget == selectedPermanent;
  241. }
  242. }
  243. }
  244. }
  245. }
  246. #endregion
  247. return cardEffects;
  248. }
  249. }
  250. }