BT7_109.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 BT7_109 : 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] Play 1 purple level 5 Digimon card from your trash without paying its memory cost. If there are 10 or more cards in your trash, you may play 1 Digimon card with [Lucemon] in its name without paying its memory cost instead.";
  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.IsDigimon)
  32. {
  33. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  34. {
  35. if (cardSource.HasCardColor(CardColor.Purple))
  36. {
  37. if (cardSource.Level == 5)
  38. {
  39. if (cardSource.HasLevel)
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. if (card.Owner.TrashCards.Count >= 10)
  46. {
  47. if (cardSource.ContainsCardName("Lucemon"))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. }
  54. }
  55. }
  56. }
  57. return false;
  58. }
  59. bool CanUseCondition(Hashtable hashtable)
  60. {
  61. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  62. }
  63. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  64. {
  65. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardCondition(cardSource)))
  66. {
  67. int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  68. List<CardSource> selectedCards = new List<CardSource>();
  69. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  70. selectCardEffect.SetUp(
  71. canTargetCondition: CanSelectCardCondition,
  72. canTargetCondition_ByPreSelecetedList: null,
  73. canEndSelectCondition: null,
  74. canNoSelect: () => false,
  75. selectCardCoroutine: SelectCardCoroutine,
  76. afterSelectCardCoroutine: null,
  77. message: "Select 1 card to play.",
  78. maxCount: maxCount,
  79. canEndNotMax: false,
  80. isShowOpponent: true,
  81. mode: SelectCardEffect.Mode.Custom,
  82. root: SelectCardEffect.Root.Trash,
  83. customRootCardList: null,
  84. canLookReverseCard: true,
  85. selectPlayer: card.Owner,
  86. cardEffect: activateClass);
  87. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  88. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  89. yield return StartCoroutine(selectCardEffect.Activate());
  90. IEnumerator SelectCardCoroutine(CardSource cardSource)
  91. {
  92. selectedCards.Add(cardSource);
  93. yield return null;
  94. }
  95. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true));
  96. }
  97. }
  98. }
  99. if (timing == EffectTiming.SecuritySkill)
  100. {
  101. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Play 1 Digimon from trash");
  102. }
  103. return cardEffects;
  104. }
  105. }