EX6_067.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_067 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Main Effect
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  18. cardEffects.Add(activateClass);
  19. string EffectDescription()
  20. {
  21. return
  22. "[Main] Unsuspend 1 of your Digimon with the [Angel]/[Archangel]/[Three Great Angels] trait. If you have [Dominimon], unsuspend all of your Digimon with the [Angel]/[Archangel]/[Three Great Angels] trait instead.";
  23. }
  24. bool PermanentIsDominimon(Permanent permanent)
  25. {
  26. return permanent.TopCard.ContainsCardName("Dominimon");
  27. }
  28. bool PermanentIsCorrectTarget(Permanent permanent)
  29. {
  30. if (permanent.IsSuspended && permanent.CanUnsuspend)
  31. {
  32. return permanent.TopCard.HasAngelTraitRestrictive;
  33. }
  34. return false;
  35. }
  36. bool CanSelectPermanentCondition(Permanent permanent)
  37. {
  38. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  39. {
  40. return PermanentIsCorrectTarget(permanent);
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  51. {
  52. if (card.Owner.GetBattleAreaDigimons().Count(PermanentIsDominimon) >= 1)
  53. {
  54. List<Permanent> untappedPermanents = new List<Permanent>();
  55. foreach (Permanent permanent in card.Owner.GetBattleAreaDigimons())
  56. {
  57. if (PermanentIsCorrectTarget(permanent))
  58. {
  59. untappedPermanents.Add(permanent);
  60. }
  61. }
  62. yield return ContinuousController.instance.StartCoroutine(
  63. new IUnsuspendPermanents(untappedPermanents, activateClass).Unsuspend());
  64. }
  65. else
  66. {
  67. int maxCount = Math.Min(1,
  68. CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  69. SelectPermanentEffect selectPermanentEffect =
  70. GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectPermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: null,
  80. afterSelectPermanentCoroutine: null,
  81. mode: SelectPermanentEffect.Mode.UnTap,
  82. cardEffect: activateClass);
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. }
  85. }
  86. }
  87. }
  88. #endregion
  89. #region Security Effect
  90. if (timing == EffectTiming.SecuritySkill)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect($"[Recovery +1 <Deck>], then add this card to the hand", CanUseCondition,
  94. card);
  95. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  96. activateClass.SetIsSecurityEffect(true);
  97. cardEffects.Add(activateClass);
  98. string EffectDiscription()
  99. {
  100. return "[Security] [Recovery +1 <Deck>]. Then, add this card to the hand";
  101. }
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable hashtable)
  107. {
  108. if (card.Owner.LibraryCards.Count >= 1)
  109. {
  110. if (card.Owner.CanAddSecurity(activateClass))
  111. {
  112. yield return ContinuousController.instance.StartCoroutine(
  113. new IRecovery(card.Owner, 1, activateClass).Recovery());
  114. }
  115. }
  116. yield return ContinuousController.instance.StartCoroutine(
  117. CardEffectCommons.AddThisCardToHand(card, activateClass));
  118. }
  119. }
  120. #endregion
  121. return cardEffects;
  122. }
  123. }
  124. }