ST10_15.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class ST10_15 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  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, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Trash the top 3 cards of your deck. Then, if you have a yellow Digimon in play, return 1 yellow or purple Digimon card from your trash to your hand.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource != null)
  26. {
  27. if (cardSource.IsDigimon)
  28. {
  29. if (cardSource.Owner == card.Owner)
  30. {
  31. if (cardSource.HasCardColor(CardColor.Yellow))
  32. {
  33. return true;
  34. }
  35. if (cardSource.HasCardColor(CardColor.Purple))
  36. {
  37. return true;
  38. }
  39. }
  40. }
  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. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(3, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  51. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.CardColors.Contains(CardColor.Yellow)))
  52. {
  53. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  54. {
  55. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  56. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  57. selectCardEffect.SetUp(
  58. canTargetCondition: CanSelectCardCondition,
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. canNoSelect: () => false,
  62. selectCardCoroutine: null,
  63. afterSelectCardCoroutine: null,
  64. message: "Select 1 card to add to your hand.",
  65. maxCount: maxCount,
  66. canEndNotMax: false,
  67. isShowOpponent: true,
  68. mode: SelectCardEffect.Mode.AddHand,
  69. root: SelectCardEffect.Root.Trash,
  70. customRootCardList: null,
  71. canLookReverseCard: true,
  72. selectPlayer: card.Owner,
  73. cardEffect: activateClass);
  74. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  75. }
  76. }
  77. }
  78. }
  79. if (timing == EffectTiming.SecuritySkill)
  80. {
  81. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Trash 3 cards from deck top and return 1 card from trash to hand");
  82. }
  83. return cardEffects;
  84. }
  85. }