BT9_105.cs 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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 BT9_105 : 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] Reveal the top 3 cards of your deck. Choose 1 Digimon card with [X Antibody] in its traits among them, and delete 1 of your opponent's Digimon whose play cost is less than or equal to the chosen card's play cost. Trash the revealed cards. Then, place 1 card with [X Antibody] in its traits from your trash under 1 of your Digimon with [X Antibody] in its traits as its bottom digivolution card.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.HasXAntibodyTraits)
  26. {
  27. if (cardSource.IsDigimon)
  28. {
  29. if (cardSource.HasPlayCost)
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanSelectCardCondition1(CardSource cardSource)
  38. {
  39. return cardSource.HasXAntibodyTraits;
  40. }
  41. bool CanSelectPermanentCondition1(Permanent permanent)
  42. {
  43. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  44. {
  45. if (permanent.TopCard.HasXAntibodyTraits)
  46. {
  47. if (!permanent.IsToken)
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. return false;
  54. }
  55. bool CanUseCondition(Hashtable hashtable)
  56. {
  57. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. CardSource selectedCard = null;
  62. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  63. revealCount: 3,
  64. simplifiedSelectCardConditions:
  65. new SimplifiedSelectCardConditionClass[]
  66. {
  67. new SimplifiedSelectCardConditionClass(
  68. canTargetCondition:CanSelectCardCondition,
  69. message: "Select 1 Digimon card with [X Antibody] in its traits.",
  70. mode: SelectCardEffect.Mode.Custom,
  71. maxCount: 1,
  72. selectCardCoroutine: SelectCardCoroutine),
  73. },
  74. remainingCardsPlace: RemainingCardsPlace.Trash,
  75. activateClass: activateClass,
  76. canNoSelect: true,
  77. isSendAllCardsToSamePlace: true
  78. ));
  79. IEnumerator SelectCardCoroutine(CardSource cardSource)
  80. {
  81. selectedCard = cardSource;
  82. yield return null;
  83. }
  84. if (selectedCard != null)
  85. {
  86. bool CanSelectPermanentCondition(Permanent permanent)
  87. {
  88. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  89. {
  90. if (permanent.TopCard.GetCostItself <= selectedCard.GetCostItself)
  91. {
  92. if (permanent.TopCard.HasPlayCost)
  93. {
  94. return true;
  95. }
  96. }
  97. }
  98. return false;
  99. }
  100. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  101. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  102. selectPermanentEffect.SetUp(
  103. selectPlayer: card.Owner,
  104. canTargetCondition: CanSelectPermanentCondition,
  105. canTargetCondition_ByPreSelecetedList: null,
  106. canEndSelectCondition: null,
  107. maxCount: maxCount,
  108. canNoSelect: false,
  109. canEndNotMax: false,
  110. selectPermanentCoroutine: null,
  111. afterSelectPermanentCoroutine: null,
  112. mode: SelectPermanentEffect.Mode.Destroy,
  113. cardEffect: activateClass);
  114. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  115. }
  116. if (card.Owner.TrashCards.Count(CanSelectCardCondition1) >= 1 && card.Owner.GetBattleAreaDigimons().Count(CanSelectPermanentCondition1) >= 1)
  117. {
  118. List<CardSource> selectedCards = new List<CardSource>();
  119. int maxCount = 1;
  120. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  121. selectCardEffect.SetUp(
  122. canTargetCondition: CanSelectCardCondition1,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. canNoSelect: () => false,
  126. selectCardCoroutine: SelectCardCoroutine1,
  127. afterSelectCardCoroutine: null,
  128. message: "Select 1 card to place on bottom of digivolution cards.",
  129. maxCount: maxCount,
  130. canEndNotMax: false,
  131. isShowOpponent: true,
  132. mode: SelectCardEffect.Mode.Custom,
  133. root: SelectCardEffect.Root.Trash,
  134. customRootCardList: null,
  135. canLookReverseCard: true,
  136. selectPlayer: card.Owner,
  137. cardEffect: activateClass);
  138. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  139. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  140. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  141. IEnumerator SelectCardCoroutine1(CardSource cardSource)
  142. {
  143. selectedCards.Add(cardSource);
  144. yield return null;
  145. }
  146. if (selectedCards.Count >= 1)
  147. {
  148. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  149. {
  150. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  151. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  152. selectPermanentEffect.SetUp(
  153. selectPlayer: card.Owner,
  154. canTargetCondition: CanSelectPermanentCondition1,
  155. canTargetCondition_ByPreSelecetedList: null,
  156. canEndSelectCondition: null,
  157. maxCount: maxCount,
  158. canNoSelect: false,
  159. canEndNotMax: false,
  160. selectPermanentCoroutine: SelectPermanentCoroutine,
  161. afterSelectPermanentCoroutine: null,
  162. mode: SelectPermanentEffect.Mode.Custom,
  163. cardEffect: activateClass);
  164. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get a digivolution card.", "The opponent is selecting 1 Digimon that will get a digivolution card.");
  165. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  166. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  167. {
  168. Permanent selectedPermanent = permanent;
  169. if (selectedPermanent != null)
  170. {
  171. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(selectedCards, activateClass));
  172. }
  173. }
  174. }
  175. }
  176. }
  177. }
  178. }
  179. if (timing == EffectTiming.SecuritySkill)
  180. {
  181. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Reveal the top 3 cards of deck and your Digimon gets digivolution card");
  182. }
  183. return cardEffects;
  184. }
  185. }