BT10_096.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_096 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OptionSkill)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  19. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[Main] Choose 1 of your level 4 or higher Digimon with [Shoutmon] in its name. Delete 1 of your opponent's Digimon with DP less than or equal to the chosen Digimon.";
  24. }
  25. bool CanSelectPermanentCondition(Permanent permanent)
  26. {
  27. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  28. {
  29. if (permanent.TopCard.ContainsCardName("Shoutmon"))
  30. {
  31. if (permanent.Level >= 4)
  32. {
  33. if (permanent.TopCard.HasLevel)
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. }
  40. return false;
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  45. }
  46. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  47. {
  48. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  49. {
  50. Permanent selectedPermanent = null;
  51. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  52. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  53. selectPermanentEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: CanSelectPermanentCondition,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: maxCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. selectPermanentCoroutine: SelectPermanentCoroutine,
  62. afterSelectPermanentCoroutine: null,
  63. mode: SelectPermanentEffect.Mode.Custom,
  64. cardEffect: activateClass);
  65. selectPermanentEffect.SetUpCustomMessage("Select 1 level 4 or higher Digimon with [Shoutmon] in its name.", "The opponent is selecting 1 level 4 or higher Digimon with [Shoutmon] in its name.");
  66. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  67. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  68. {
  69. selectedPermanent = permanent;
  70. yield return null;
  71. }
  72. if (selectedPermanent != null)
  73. {
  74. int maxDP = selectedPermanent.DP;
  75. bool CanSelectPermanentCondition1(Permanent permanent)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  78. {
  79. if (permanent.DP <= maxDP)
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  87. {
  88. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  89. selectPermanentEffect.SetUp(
  90. selectPlayer: card.Owner,
  91. canTargetCondition: CanSelectPermanentCondition1,
  92. canTargetCondition_ByPreSelecetedList: null,
  93. canEndSelectCondition: CanEndSelectCondition1,
  94. maxCount: maxCount,
  95. canNoSelect: false,
  96. canEndNotMax: false,
  97. selectPermanentCoroutine: null,
  98. afterSelectPermanentCoroutine: null,
  99. mode: SelectPermanentEffect.Mode.Destroy,
  100. cardEffect: activateClass);
  101. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  102. bool CanEndSelectCondition1(List<Permanent> permanents)
  103. {
  104. if (permanents.Count <= 0)
  105. {
  106. return false;
  107. }
  108. return true;
  109. }
  110. }
  111. }
  112. }
  113. }
  114. }
  115. if (timing == EffectTiming.SecuritySkill)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect($"Reveal the top 3 cards of deck", CanUseCondition, card);
  119. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  120. activateClass.SetIsSecurityEffect(true);
  121. cardEffects.Add(activateClass);
  122. string EffectDiscription()
  123. {
  124. return "[Security] Reveal the top 3 cards of your deck. You may add 1 Digimon card with [Xros Heart] in its traits among them to your hand and play 1 [Taiki Kudo] among them without paying its memory cost. Place the rest at the bottom of your deck in any order.";
  125. }
  126. bool CanSelectCardCondition(CardSource cardSource)
  127. {
  128. if (cardSource.IsDigimon)
  129. {
  130. if (cardSource.CardTraits.Contains("Xros Heart"))
  131. {
  132. return true;
  133. }
  134. if (cardSource.CardTraits.Contains("XrosHeart"))
  135. {
  136. return true;
  137. }
  138. }
  139. return false;
  140. }
  141. bool CanSelectCardCondition1(CardSource cardSource)
  142. {
  143. if (cardSource.CardNames.Contains("Taiki Kudo") || cardSource.CardNames.Contains("TaikiKudo"))
  144. {
  145. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  146. {
  147. return true;
  148. }
  149. }
  150. return false;
  151. }
  152. bool CanUseCondition(Hashtable hashtable)
  153. {
  154. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  155. }
  156. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  157. {
  158. List<CardSource> selectedCards = new List<CardSource>();
  159. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndSelect(
  160. revealCount: 3,
  161. selectCardConditions:
  162. new SelectCardConditionClass[]
  163. {
  164. new SelectCardConditionClass(
  165. canTargetCondition:CanSelectCardCondition,
  166. canTargetCondition_ByPreSelecetedList:null,
  167. canEndSelectCondition:null,
  168. canNoSelect:false,
  169. selectCardCoroutine: null,
  170. message: "Select 1 Digimon card with [Xros Heart] in its traits.",
  171. maxCount: 1,
  172. canEndNotMax:false,
  173. mode: SelectCardEffect.Mode.AddHand
  174. ),
  175. new SelectCardConditionClass(
  176. canTargetCondition:CanSelectCardCondition1,
  177. canTargetCondition_ByPreSelecetedList:null,
  178. canEndSelectCondition:null,
  179. canNoSelect:true,
  180. selectCardCoroutine: SelectCardCoroutine,
  181. message: "Select 1 [Taiki Kudo].",
  182. maxCount: 1,
  183. canEndNotMax:false,
  184. mode: SelectCardEffect.Mode.Custom
  185. ),
  186. },
  187. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  188. activateClass: activateClass,
  189. canNoAction: true
  190. ));
  191. IEnumerator SelectCardCoroutine(CardSource cardSource)
  192. {
  193. selectedCards.Add(cardSource);
  194. yield return null;
  195. }
  196. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  197. cardSources: selectedCards,
  198. activateClass: activateClass,
  199. payCost: false,
  200. isTapped: false,
  201. root: SelectCardEffect.Root.Library,
  202. activateETB: true));
  203. }
  204. }
  205. return cardEffects;
  206. }
  207. }
  208. }