EX7_036.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_036 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Security Attack +1
  11. if (timing == EffectTiming.None)
  12. {
  13. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card,
  14. condition: null));
  15. }
  16. #endregion
  17. #region Vortex
  18. if (timing == EffectTiming.OnEndTurn)
  19. {
  20. cardEffects.Add(CardEffectFactory.VortexSelfEffect(isInheritedEffect: false, card: card,
  21. condition: null));
  22. }
  23. #endregion
  24. #region When Digivolving/ When Attacking Shared
  25. bool CanSelectPermanentSharedCondition(Permanent permanent)
  26. {
  27. return CardEffectCommons.IsPermanentExistsOnBattleAreaDigimon(permanent);
  28. }
  29. bool CanSelectSuspendedPermanentSharedCondition(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  32. permanent.IsSuspended;
  33. }
  34. bool CanActivateSharedCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  37. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition);
  38. }
  39. #endregion
  40. #region When Digivolving
  41. if (timing == EffectTiming.OnEnterFieldAnyone)
  42. {
  43. ActivateClass activateClass = new ActivateClass();
  44. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  45. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  46. cardEffects.Add(activateClass);
  47. string EffectDescription()
  48. {
  49. return
  50. "[When Digivolving] Suspend 1 Digimon. If this effect suspended your Digimon, return 1 of your opponent's suspended Digimon to the bottom of the deck.";
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  59. {
  60. Permanent selectedPermanent = null;
  61. bool ownDigimon = false;
  62. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  63. selectPermanentEffect.SetUp(
  64. selectPlayer: card.Owner,
  65. canTargetCondition: CanSelectPermanentSharedCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. maxCount: 1,
  69. canNoSelect: false,
  70. canEndNotMax: false,
  71. selectPermanentCoroutine: SelectPermanentCoroutine,
  72. afterSelectPermanentCoroutine: null,
  73. mode: SelectPermanentEffect.Mode.Custom,
  74. cardEffect: activateClass);
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  76. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  77. {
  78. selectedPermanent = permanent;
  79. yield return null;
  80. }
  81. if (selectedPermanent != null &&
  82. selectedPermanent.TopCard &&
  83. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  84. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  85. {
  86. yield return ContinuousController.instance.StartCoroutine(
  87. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  88. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  89. ownDigimon = selectedPermanent.IsSuspended &&
  90. CardEffectCommons.IsOwnerPermanent(selectedPermanent, card);
  91. }
  92. if (ownDigimon && CardEffectCommons.HasMatchConditionPermanent(CanSelectSuspendedPermanentSharedCondition))
  93. {
  94. selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  95. selectPermanentEffect.SetUp(
  96. selectPlayer: card.Owner,
  97. canTargetCondition_ByPreSelecetedList: null,
  98. canTargetCondition: CanSelectSuspendedPermanentSharedCondition,
  99. canEndSelectCondition: null,
  100. maxCount: 1,
  101. canNoSelect: false,
  102. canEndNotMax: false,
  103. selectPermanentCoroutine: null,
  104. afterSelectPermanentCoroutine: null,
  105. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  106. cardEffect: activateClass);
  107. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.",
  108. "The opponent is selecting 1 Digimon to bottom deck.");
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. }
  111. }
  112. }
  113. }
  114. #endregion
  115. #region When Attacking
  116. if (timing == EffectTiming.OnAllyAttack)
  117. {
  118. ActivateClass activateClass = new ActivateClass();
  119. activateClass.SetUpICardEffect("Suspend 1 Digimon", CanUseCondition, card);
  120. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, false, EffectDescription());
  121. cardEffects.Add(activateClass);
  122. string EffectDescription()
  123. {
  124. return
  125. "[When Attacking] Suspend 1 Digimon. If this effect suspended your Digimon, return 1 of your opponent's suspended Digimon to the bottom of the deck.";
  126. }
  127. bool CanUseCondition(Hashtable hashtable)
  128. {
  129. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable hashtable)
  132. {
  133. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  134. {
  135. Permanent selectedPermanent = null;
  136. bool ownDigimon = false;
  137. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  138. selectPermanentEffect.SetUp(
  139. selectPlayer: card.Owner,
  140. canTargetCondition: CanSelectPermanentSharedCondition,
  141. canTargetCondition_ByPreSelecetedList: null,
  142. canEndSelectCondition: null,
  143. maxCount: 1,
  144. canNoSelect: false,
  145. canEndNotMax: false,
  146. selectPermanentCoroutine: SelectPermanentCoroutine,
  147. afterSelectPermanentCoroutine: null,
  148. mode: SelectPermanentEffect.Mode.Custom,
  149. cardEffect: activateClass);
  150. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  151. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  152. {
  153. selectedPermanent = permanent;
  154. yield return null;
  155. }
  156. if (selectedPermanent != null &&
  157. selectedPermanent.TopCard &&
  158. !selectedPermanent.TopCard.CanNotBeAffected(activateClass) &&
  159. !selectedPermanent.IsSuspended && selectedPermanent.CanSuspend)
  160. {
  161. yield return ContinuousController.instance.StartCoroutine(
  162. new SuspendPermanentsClass(new List<Permanent>() { selectedPermanent },
  163. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  164. ownDigimon = selectedPermanent.IsSuspended &&
  165. CardEffectCommons.IsOwnerPermanent(selectedPermanent, card);
  166. }
  167. if (ownDigimon && CardEffectCommons.HasMatchConditionPermanent(CanSelectSuspendedPermanentSharedCondition))
  168. {
  169. selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  170. selectPermanentEffect.SetUp(
  171. selectPlayer: card.Owner,
  172. canTargetCondition_ByPreSelecetedList: null,
  173. canTargetCondition: CanSelectSuspendedPermanentSharedCondition,
  174. canEndSelectCondition: null,
  175. maxCount: 1,
  176. canNoSelect: false,
  177. canEndNotMax: false,
  178. selectPermanentCoroutine: null,
  179. afterSelectPermanentCoroutine: null,
  180. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  181. cardEffect: activateClass);
  182. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bottom deck.",
  183. "The opponent is selecting 1 Digimon to bottom deck.");
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. }
  186. }
  187. }
  188. }
  189. #endregion
  190. return cardEffects;
  191. }
  192. }
  193. }