EX11_058.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Yao Qinglan
  6. namespace DCGO.CardEffects.EX11
  7. {
  8. public class EX11_058 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. bool OwnAquaDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) && permanent.TopCard.HasAquaTraits;
  14. #region Start of your Main Phase
  15. if (timing == EffectTiming.OnStartMainPhase)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("By placing a card from hand under your Digimon, gain 1 memory", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  20. cardEffects.Add(activateClass);
  21. string EffectDescription() => "[Start of Your Main Phase] By placing 1 level 5 or lower card with [Aqua] or [Sea Animal] in any of its traits from your hand as the bottom digivolution card of any of your Digimon with [Aqua] or [Sea Animal] in any of their traits, gain 1 memory.";
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.IsExistOnBattleArea(card)
  25. && CardEffectCommons.IsOwnerTurn(card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.IsExistOnBattleArea(card)
  30. && card.Owner.HandCards.Count(CanSelectCardCondition) > 0
  31. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, OwnAquaDigimon);
  32. }
  33. bool CanSelectCardCondition(CardSource cardSource)
  34. {
  35. return cardSource.HasLevel && cardSource.Level <= 5
  36. && cardSource.HasAquaTraits;
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable hashtable)
  39. {
  40. bool added = false;
  41. CardSource selectedCard = null;
  42. int maxCount = 1;
  43. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  44. selectHandEffect.SetUp(
  45. selectPlayer: card.Owner,
  46. canTargetCondition: CanSelectCardCondition,
  47. canTargetCondition_ByPreSelecetedList: null,
  48. canEndSelectCondition: null,
  49. maxCount: maxCount,
  50. canNoSelect: true,
  51. canEndNotMax: false,
  52. isShowOpponent: true,
  53. selectCardCoroutine: SelectCardCoroutine,
  54. afterSelectCardCoroutine: null,
  55. mode: SelectHandEffect.Mode.Custom,
  56. cardEffect: activateClass);
  57. selectHandEffect.SetUpCustomMessage("Select 1 card to place at the bottom of digivolution cards.", "The opponent is selecting 1 card to place at the bottom of digivolution cards.");
  58. yield return StartCoroutine(selectHandEffect.Activate());
  59. IEnumerator SelectCardCoroutine(CardSource cardSource)
  60. {
  61. selectedCard = cardSource;
  62. yield return null;
  63. }
  64. if (selectedCard != null)
  65. {
  66. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(OwnAquaDigimon));
  67. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: OwnAquaDigimon,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: true,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: SelectPermanentCoroutine,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Custom,
  79. cardEffect: activateClass);
  80. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  81. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  82. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  83. {
  84. Permanent selectedPermanent = permanent;
  85. if (selectedPermanent != null)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(new List<CardSource>() { selectedCard }, activateClass));
  88. added = true;
  89. }
  90. }
  91. }
  92. if (added)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  95. }
  96. }
  97. }
  98. #endregion
  99. #region All Turns
  100. if (timing == EffectTiming.OnEnterFieldAnyone)
  101. {
  102. ActivateClass activateClass = new ActivateClass();
  103. activateClass.SetUpICardEffect("Draw 1. If played by Decode, 1 enemy can't suspend.", CanUseCondition, card);
  104. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  105. cardEffects.Add(activateClass);
  106. string EffectDescription() => "[All Turns] When your Digimon are played or digivolve, if any of them have [Aqua] or [Sea Animal] in any of their traits, by suspending this Tamer, <Draw 1>. If played by <Decode>, 1 of your opponent's Digimon can't suspend until their turn ends.";
  107. bool CanUseCondition(Hashtable hashtable)
  108. {
  109. return CardEffectCommons.IsExistOnBattleArea(card)
  110. && (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, OwnAquaDigimon)
  111. || CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, OwnAquaDigimon));
  112. }
  113. bool CanActivateCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.IsExistOnBattleArea(card)
  116. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  117. }
  118. bool CanSelectPermanentCondition(Permanent permanent)
  119. {
  120. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  121. }
  122. IEnumerator ActivateCoroutine(Hashtable hashtable)
  123. {
  124. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent> { card.PermanentOfThisCard() }, hashtable).Tap());
  125. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  126. if (CardEffectCommons.IsByEffect(hashtable, effect => effect.EffectName.StartsWith("Decode")))
  127. {
  128. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  129. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  130. {
  131. selectPermanentEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: CanSelectPermanentCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: 1,
  137. canNoSelect: false,
  138. canEndNotMax: false,
  139. selectPermanentCoroutine: SelectPermanentCoroutine,
  140. afterSelectPermanentCoroutine: null,
  141. mode: SelectPermanentEffect.Mode.Custom,
  142. cardEffect: activateClass);
  143. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get unable to suspend.", "The opponent is selecting 1 Digimon that will get unable to suspend.");
  144. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  145. }
  146. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  147. {
  148. Permanent selectedPermanent = permanent;
  149. if (selectedPermanent != null)
  150. {
  151. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  152. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCondition1, card);
  153. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCondition);
  154. selectedPermanent.UntilOwnerTurnEndEffects.Add((_timing) => canNotSuspendClass);
  155. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  156. {
  157. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  158. }
  159. bool CanUseCondition1(Hashtable hashtable)
  160. {
  161. if (selectedPermanent.TopCard != null)
  162. {
  163. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  164. {
  165. return true;
  166. }
  167. }
  168. return false;
  169. }
  170. bool PermanentCondition(Permanent permanent)
  171. {
  172. if (permanent == selectedPermanent)
  173. {
  174. return true;
  175. }
  176. return false;
  177. }
  178. }
  179. }
  180. }
  181. }
  182. }
  183. #endregion
  184. #region Security
  185. if (timing == EffectTiming.SecuritySkill)
  186. {
  187. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }