ExLaser_BT12_101.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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 ExLaser_BT12_101 : 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 digivolution cards of 1 of your opponent's Digimon. Then, if you have a green Digimon in play, you may play 1 level 4 or lower blue Digimon card with a [Free] trait from your hand without paying the cost.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. return true;
  28. }
  29. return false;
  30. }
  31. bool CanSelectPermanentCondition1(Permanent permanent)
  32. {
  33. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  34. {
  35. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanSelectCardCondition(CardSource cardSource)
  43. {
  44. if (cardSource.IsDigimon)
  45. {
  46. if (cardSource.CardColors.Contains(CardColor.Blue))
  47. {
  48. if (cardSource.Level <= 4)
  49. {
  50. if (cardSource.CardTraits.Contains("Free"))
  51. {
  52. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  53. {
  54. if (cardSource.HasLevel)
  55. {
  56. return true;
  57. }
  58. }
  59. }
  60. }
  61. }
  62. }
  63. return false;
  64. }
  65. bool CanUseCondition(Hashtable hashtable)
  66. {
  67. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  72. {
  73. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  74. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  75. selectPermanentEffect.SetUp(
  76. selectPlayer: card.Owner,
  77. canTargetCondition: CanSelectPermanentCondition,
  78. canTargetCondition_ByPreSelecetedList: null,
  79. canEndSelectCondition: null,
  80. maxCount: maxCount,
  81. canNoSelect: false,
  82. canEndNotMax: false,
  83. selectPermanentCoroutine: SelectPermanentCoroutine,
  84. afterSelectPermanentCoroutine: null,
  85. mode: SelectPermanentEffect.Mode.Custom,
  86. cardEffect: activateClass);
  87. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will trash digivolution cards.", "The opponent is selecting 1 Digimon that will trash digivolution cards.");
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  90. {
  91. Permanent selectedPermanent = permanent;
  92. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.TrashDigivolutionCardsFromTopOrBottom(targetPermanent: selectedPermanent, trashCount: 3, isFromTop: true, activateClass: activateClass));
  93. }
  94. }
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  96. {
  97. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  98. {
  99. List<CardSource> selectedCards = new List<CardSource>();
  100. int maxCount = 1;
  101. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  102. selectHandEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectCardCondition,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: maxCount,
  108. canNoSelect: true,
  109. canEndNotMax: false,
  110. isShowOpponent: true,
  111. selectCardCoroutine: SelectCardCoroutine,
  112. afterSelectCardCoroutine: null,
  113. mode: SelectHandEffect.Mode.Custom,
  114. cardEffect: activateClass);
  115. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  116. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  117. yield return StartCoroutine(selectHandEffect.Activate());
  118. IEnumerator SelectCardCoroutine(CardSource cardSource)
  119. {
  120. selectedCards.Add(cardSource);
  121. yield return null;
  122. }
  123. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  124. cardSources: selectedCards,
  125. activateClass: activateClass,
  126. payCost: false,
  127. isTapped: false,
  128. root: SelectCardEffect.Root.Hand,
  129. activateETB: true));
  130. }
  131. }
  132. }
  133. }
  134. if (timing == EffectTiming.SecuritySkill)
  135. {
  136. CardEffectCommons.AddActivateMainOptionSecurityEffect(
  137. card: card,
  138. cardEffects: ref cardEffects,
  139. effectName: $"Trash digivolution cards and play 1 Digimon from hand");
  140. }
  141. return cardEffects;
  142. }
  143. }