BT3_110.cs 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 BT3_110 : 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. Any [On Play] effects on the Digimon played with this effect don't activate.";
  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 (cardSource.HasCardColor(CardColor.Purple))
  34. {
  35. if (cardSource.Level == 5)
  36. {
  37. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  38. {
  39. if (cardSource.HasLevel)
  40. {
  41. return true;
  42. }
  43. }
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardCondition(cardSource)))
  59. {
  60. int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  61. List<CardSource> selectedCards = new List<CardSource>();
  62. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  63. selectCardEffect.SetUp(
  64. canTargetCondition: CanSelectCardCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. canNoSelect: () => false,
  68. selectCardCoroutine: SelectCardCoroutine,
  69. afterSelectCardCoroutine: null,
  70. message: "Select 1 card to play.",
  71. maxCount: maxCount,
  72. canEndNotMax: false,
  73. isShowOpponent: true,
  74. mode: SelectCardEffect.Mode.Custom,
  75. root: SelectCardEffect.Root.Trash,
  76. customRootCardList: null,
  77. canLookReverseCard: true,
  78. selectPlayer: card.Owner,
  79. cardEffect: activateClass);
  80. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  81. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  82. yield return StartCoroutine(selectCardEffect.Activate());
  83. IEnumerator SelectCardCoroutine(CardSource cardSource)
  84. {
  85. selectedCards.Add(cardSource);
  86. yield return null;
  87. }
  88. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: false));
  89. }
  90. }
  91. }
  92. if (timing == EffectTiming.SecuritySkill)
  93. {
  94. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Play 1 Digimon from trash");
  95. }
  96. return cardEffects;
  97. }
  98. }