EX6_005.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_005 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start of Main Phase - ESS
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Return 1 card, to gain 1 memory", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. activateClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[Start of Your Main Phase] By returning 1 card with the [Legend-Arms] trait from this Digimon’s digivolution cards to the hand, gain 1 memory.";
  23. }
  24. bool HasLegendArms(CardSource cardSource)
  25. {
  26. return cardSource.ContainsTraits("Legend-Arms");
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  31. {
  32. if (CardEffectCommons.IsOwnerTurn(card))
  33. {
  34. return card.PermanentOfThisCard().DigivolutionCards.Count(HasLegendArms) > 0;
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable hashtable)
  44. {
  45. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  46. selectCardEffect.SetUp(
  47. canTargetCondition: HasLegendArms,
  48. canTargetCondition_ByPreSelecetedList: null,
  49. canEndSelectCondition: null,
  50. canNoSelect: () => true,
  51. selectCardCoroutine: null,
  52. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  53. message: "Select 1 digivolution card to add to your hand.",
  54. maxCount: 1,
  55. canEndNotMax: false,
  56. isShowOpponent: true,
  57. mode: SelectCardEffect.Mode.AddHand,
  58. root: SelectCardEffect.Root.Custom,
  59. customRootCardList: card.PermanentOfThisCard().DigivolutionCards.Where(HasLegendArms).ToList(),
  60. canLookReverseCard: false,
  61. selectPlayer: card.Owner,
  62. cardEffect: activateClass);
  63. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  64. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  65. {
  66. if (cardSources.Count > 0)
  67. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  68. yield return null;
  69. }
  70. }
  71. }
  72. #endregion
  73. return cardEffects;
  74. }
  75. }
  76. }