ST17_11.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  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.ST17
  9. {
  10. public class ST17_11 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. #region Option Skill
  16. if (timing == EffectTiming.OptionSkill)
  17. {
  18. ActivateClass activateClass = new ActivateClass();
  19. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  20. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  21. cardEffects.Add(activateClass);
  22. string EffectDiscription()
  23. {
  24. return "[Main] Reveal the top 3 cards of your deck. Add 1 green Digimon card and 1 green Tamer card from among them to your hand. Place the remaining cards at the bottom of your deck in any order. Then, place this card in your battle area.";
  25. }
  26. bool CanSelectDigimonCondition(CardSource cardSource)
  27. {
  28. if (cardSource.IsDigimon)
  29. {
  30. if (cardSource.HasCardColor(CardColor.Green))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanSelectTamerCondition(CardSource cardSource)
  38. {
  39. if(cardSource.IsTamer)
  40. {
  41. if (cardSource.HasCardColor(CardColor.Green))
  42. {
  43. return true;
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. List<CardSource> selectedCards = new List<CardSource>();
  55. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndSelect(
  56. revealCount: 3,
  57. selectCardConditions:
  58. new SelectCardConditionClass[]
  59. {
  60. new SelectCardConditionClass(
  61. canTargetCondition:CanSelectDigimonCondition,
  62. canTargetCondition_ByPreSelecetedList:null,
  63. canEndSelectCondition:null,
  64. canNoSelect:false,
  65. selectCardCoroutine: null,
  66. message: "Select 1 Green Digimon card.",
  67. maxCount: 1,
  68. canEndNotMax:false,
  69. mode: SelectCardEffect.Mode.AddHand
  70. ),
  71. new SelectCardConditionClass(
  72. canTargetCondition:CanSelectTamerCondition,
  73. canTargetCondition_ByPreSelecetedList:null,
  74. canEndSelectCondition:null,
  75. canNoSelect:false,
  76. selectCardCoroutine: null,
  77. message: "Select 1 Green Tamer card.",
  78. maxCount: 1,
  79. canEndNotMax:false,
  80. mode: SelectCardEffect.Mode.AddHand
  81. ),
  82. },
  83. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  84. activateClass: activateClass,
  85. canNoAction: false));
  86. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(card: card, cardEffect: activateClass));
  87. }
  88. }
  89. #endregion
  90. #region Delay Effect
  91. if (timing == EffectTiming.OnDeclaration)
  92. {
  93. ActivateClass activateClass = new ActivateClass();
  94. activateClass.SetUpICardEffect("Play 1 [Terriermon] or [Lopmon]", CanUseCondition, card);
  95. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  96. cardEffects.Add(activateClass);
  97. string EffectDiscription()
  98. {
  99. return "[Main] <Delay> You may play 1 [Terriermon] or [Lopmon] from you hand without paying the cost.";
  100. }
  101. bool CanUseCondition(Hashtable hashtable)
  102. {
  103. return CardEffectCommons.CanDeclareOptionDelayEffect(card);
  104. }
  105. bool CanSelectCardCondition(CardSource cardSource)
  106. {
  107. if (cardSource.IsDigimon)
  108. {
  109. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  110. {
  111. if (cardSource.CardNames.Contains("Terriermon"))
  112. {
  113. return true;
  114. }
  115. if (cardSource.CardNames.Contains("Lopmon"))
  116. {
  117. return true;
  118. }
  119. }
  120. }
  121. return false;
  122. }
  123. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  124. {
  125. bool deleted = false;
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() }, activateClass: activateClass, successProcess: permanents => SuccessProcess(), failureProcess: null));
  127. IEnumerator SuccessProcess()
  128. {
  129. deleted = true;
  130. yield return null;
  131. }
  132. if (deleted)
  133. {
  134. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  135. {
  136. List<CardSource> selectedCards = new List<CardSource>();
  137. int maxCount = 1;
  138. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  139. selectHandEffect.SetUp(
  140. selectPlayer: card.Owner,
  141. canTargetCondition: CanSelectCardCondition,
  142. canTargetCondition_ByPreSelecetedList: null,
  143. canEndSelectCondition: null,
  144. maxCount: maxCount,
  145. canNoSelect: true,
  146. canEndNotMax: false,
  147. isShowOpponent: true,
  148. selectCardCoroutine: SelectCardCoroutine,
  149. afterSelectCardCoroutine: null,
  150. mode: SelectHandEffect.Mode.Custom,
  151. cardEffect: activateClass);
  152. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  153. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  154. yield return StartCoroutine(selectHandEffect.Activate());
  155. IEnumerator SelectCardCoroutine(CardSource cardSource)
  156. {
  157. selectedCards.Add(cardSource);
  158. yield return null;
  159. }
  160. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  161. cardSources: selectedCards,
  162. activateClass: activateClass,
  163. payCost: false,
  164. isTapped: false,
  165. root: SelectCardEffect.Root.Hand,
  166. activateETB: true));
  167. }
  168. }
  169. }
  170. }
  171. #endregion
  172. #region Security Skill
  173. if (timing == EffectTiming.SecuritySkill)
  174. {
  175. ActivateClass activateClass = new ActivateClass();
  176. activateClass.SetUpICardEffect($"Suspend 2 Digimon", CanUseCondition, card);
  177. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  178. activateClass.SetIsSecurityEffect(true);
  179. cardEffects.Add(activateClass);
  180. string EffectDiscription()
  181. {
  182. return "[Security] Suspend 2 of your opponent's Digimon. Then, place this card in the battle area.";
  183. }
  184. bool CanSelectPermanentCondition(Permanent permanent)
  185. {
  186. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  187. {
  188. if (permanent.CanSelectBySkill(activateClass))
  189. {
  190. return true;
  191. }
  192. }
  193. return false;
  194. }
  195. bool CanUseCondition(Hashtable hashtable)
  196. {
  197. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  198. }
  199. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  200. {
  201. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  202. {
  203. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  204. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  205. selectPermanentEffect.SetUp(
  206. selectPlayer: card.Owner,
  207. canTargetCondition: CanSelectPermanentCondition,
  208. canTargetCondition_ByPreSelecetedList: null,
  209. canEndSelectCondition: null,
  210. maxCount: maxCount,
  211. canNoSelect: false,
  212. canEndNotMax: false,
  213. selectPermanentCoroutine: null,
  214. afterSelectPermanentCoroutine: null,
  215. mode: SelectPermanentEffect.Mode.Tap,
  216. cardEffect: activateClass);
  217. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  218. }
  219. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlaceDelayOptionCards(
  220. card: card,
  221. cardEffect: activateClass));
  222. }
  223. }
  224. #endregion
  225. return cardEffects;
  226. }
  227. }
  228. }