EX6_028.cs 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. namespace DCGO.CardEffects.EX6
  5. {
  6. public class EX6_028 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("MagnaAngemon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 3,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null)
  24. );
  25. }
  26. #endregion
  27. #region Ace - Blast Digivolve
  28. if (timing == EffectTiming.OnCounterTiming)
  29. {
  30. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  31. }
  32. #endregion
  33. #region On Play
  34. if (timing == EffectTiming.OnEnterFieldAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  39. EffectDescription());
  40. cardEffects.Add(activateClass);
  41. string EffectDescription()
  42. {
  43. return
  44. "[On Play] Trigger <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.)";
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  53. {
  54. if (card.Owner.LibraryCards.Count >= 1)
  55. {
  56. if (card.Owner.CanAddSecurity(activateClass))
  57. {
  58. return true;
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable hashtable)
  65. {
  66. yield return ContinuousController.instance.StartCoroutine(
  67. new IRecovery(card.Owner, 1, activateClass).Recovery());
  68. }
  69. }
  70. #endregion
  71. #region When Digivolving
  72. if (timing == EffectTiming.OnEnterFieldAnyone)
  73. {
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect("Recovery +1 (Deck)", CanUseCondition, card);
  76. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  77. EffectDescription());
  78. cardEffects.Add(activateClass);
  79. string EffectDescription()
  80. {
  81. return
  82. "[When Digivolving] Trigger <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.)";
  83. }
  84. bool CanUseCondition(Hashtable hashtable)
  85. {
  86. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  87. }
  88. bool CanActivateCondition(Hashtable hashtable)
  89. {
  90. if (CardEffectCommons.IsExistOnBattleArea(card))
  91. {
  92. if (card.Owner.LibraryCards.Count >= 1)
  93. {
  94. if (card.Owner.CanAddSecurity(activateClass))
  95. {
  96. return true;
  97. }
  98. }
  99. }
  100. return false;
  101. }
  102. IEnumerator ActivateCoroutine(Hashtable hashtable)
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(
  105. new IRecovery(card.Owner, 1, activateClass).Recovery());
  106. }
  107. }
  108. #endregion
  109. #region All Turns
  110. if (timing == EffectTiming.OnAddSecurity)
  111. {
  112. ActivateClass activateClass = new ActivateClass();
  113. activateClass.SetUpICardEffect("Return 1 of your opponent's Digimon to the hand", CanUseCondition, card);
  114. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  115. activateClass.SetHashString("ReturnToHand_EX6_028");
  116. cardEffects.Add(activateClass);
  117. string EffectDescription()
  118. {
  119. return
  120. "[All Turns] [Once per Turn] When a card is added to your security stack, return 1 of your opponent's Digimon with as high or lower a level as the number of your security cards to the hand.";
  121. }
  122. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  123. {
  124. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  125. {
  126. if (permanent.Level <= card.Owner.SecurityCards.Count)
  127. {
  128. if (permanent.TopCard.HasLevel)
  129. {
  130. return true;
  131. }
  132. }
  133. }
  134. return false;
  135. }
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  139. {
  140. if (CardEffectCommons.CanTriggerWhenAddSecurity(hashtable, player => player == card.Owner))
  141. {
  142. return true;
  143. }
  144. }
  145. return false;
  146. }
  147. bool CanActivateCondition(Hashtable hashtable)
  148. {
  149. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  150. }
  151. IEnumerator ActivateCoroutine(Hashtable hashtable)
  152. {
  153. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  154. {
  155. int maxCount = Math.Min(1,
  156. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  157. SelectPermanentEffect selectPermanentEffect =
  158. GManager.instance.GetComponent<SelectPermanentEffect>();
  159. selectPermanentEffect.SetUp(
  160. selectPlayer: card.Owner,
  161. canTargetCondition: CanSelectOpponentPermanentCondition,
  162. canTargetCondition_ByPreSelecetedList: null,
  163. canEndSelectCondition: null,
  164. maxCount: maxCount,
  165. canNoSelect: false,
  166. canEndNotMax: false,
  167. selectPermanentCoroutine: null,
  168. afterSelectPermanentCoroutine: null,
  169. mode: SelectPermanentEffect.Mode.Bounce,
  170. cardEffect: activateClass);
  171. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  172. }
  173. }
  174. }
  175. #endregion
  176. return cardEffects;
  177. }
  178. }
  179. }