BT15_064.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_064 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. static bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. if (targetPermanent.TopCard.CardTraits.Contains("SoC"))
  17. {
  18. if (targetPermanent.TopCard.HasLevel)
  19. {
  20. if (targetPermanent.Level == 4)
  21. {
  22. return true;
  23. }
  24. }
  25. }
  26. return false;
  27. }
  28. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  29. }
  30. if (timing == EffectTiming.OnAllyAttack)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect("De-Digivolve 1 on 1 Digimon", CanUseCondition, card);
  34. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  35. activateClass.SetIsInheritedEffect(true);
  36. activateClass.SetHashString("AttackESS_BT15_064");
  37. cardEffects.Add(activateClass);
  38. string EffectDiscription()
  39. {
  40. return "[When Attacking] [Once Per Turn] <De-Digivolve 1> 1 of your opponent's Digimon.";
  41. }
  42. bool CanSelectPermanentCondition(Permanent permanent)
  43. {
  44. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. return true;
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  61. {
  62. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  63. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  64. selectPermanentEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectPermanentCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: false,
  71. canEndNotMax: false,
  72. selectPermanentCoroutine: SelectPermanentCoroutine,
  73. afterSelectPermanentCoroutine: null,
  74. mode: SelectPermanentEffect.Mode.Custom,
  75. cardEffect: activateClass);
  76. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  77. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  78. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  79. {
  80. Permanent selectedPermanent = permanent;
  81. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  82. }
  83. }
  84. }
  85. }
  86. if (timing == EffectTiming.OnAllyAttack)
  87. {
  88. ActivateClass activateClass = new ActivateClass();
  89. activateClass.SetUpICardEffect("Delete 1 Digimon or Tamer with play cost 3 or less", CanUseCondition, card);
  90. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  91. activateClass.SetHashString("Delete_BT15_064");
  92. cardEffects.Add(activateClass);
  93. string EffectDiscription()
  94. {
  95. return "[When Attacking] If this Digimon has a Tamer card with the [SoC] trait in it's digivolution cards, delete 1 of your opponent's Digimon or Tamers with a play cost of 3 or less.";
  96. }
  97. bool CanSelectPermanentCondition(Permanent permanent)
  98. {
  99. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  100. {
  101. if (permanent.TopCard.HasPlayCost && permanent.TopCard.GetCostItself <= 3)
  102. {
  103. if (permanent.IsDigimon || permanent.IsTamer)
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanSelectPermanentCondition1(Permanent permanent)
  112. {
  113. if (CardEffectCommons.IsExistOnBattleArea(card))
  114. {
  115. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => (cardSource.CardTraits.Contains("SoC") && cardSource.IsTamer)) >= 1)
  116. {
  117. return true;
  118. }
  119. }
  120. return false;
  121. }
  122. bool CanUseCondition(Hashtable hashtable)
  123. {
  124. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  125. }
  126. bool CanActivateCondition(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.IsExistOnBattleArea(card))
  129. {
  130. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  131. {
  132. return true;
  133. }
  134. }
  135. return false;
  136. }
  137. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  138. {
  139. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  140. {
  141. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  142. {
  143. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  144. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  145. selectPermanentEffect.SetUp(
  146. selectPlayer: card.Owner,
  147. canTargetCondition: CanSelectPermanentCondition,
  148. canTargetCondition_ByPreSelecetedList: null,
  149. canEndSelectCondition: null,
  150. maxCount: maxCount,
  151. canNoSelect: false,
  152. canEndNotMax: false,
  153. selectPermanentCoroutine: null,
  154. afterSelectPermanentCoroutine: null,
  155. mode: SelectPermanentEffect.Mode.Destroy,
  156. cardEffect: activateClass);
  157. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  158. }
  159. }
  160. }
  161. }
  162. if (timing == EffectTiming.OnEnterFieldAnyone)
  163. {
  164. ActivateClass activateClass = new ActivateClass();
  165. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  166. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  167. cardEffects.Add(activateClass);
  168. string EffectDiscription()
  169. {
  170. return "[On Play] Reveal the top 3 cards of your deck. Place 1 card with the [Machine],[Cyborg] or [SoC] trait among them as this Digimon's bottom digivolution card and add 1 such card to the hand. Trash the rest.";
  171. }
  172. bool CanSelectCardCondition(CardSource cardSource)
  173. {
  174. return cardSource.CardTraits.Contains("Cyborg") || cardSource.CardTraits.Contains("Machine") || cardSource.CardTraits.Contains("SoC");
  175. }
  176. bool CanSelectCardCondition1(CardSource cardSource)
  177. {
  178. return cardSource.CardTraits.Contains("Cyborg") || cardSource.CardTraits.Contains("Machine") || cardSource.CardTraits.Contains("SoC");
  179. }
  180. bool CanUseCondition(Hashtable hashtable)
  181. {
  182. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  183. }
  184. bool CanActivateCondition(Hashtable hashtable)
  185. {
  186. if (CardEffectCommons.IsExistOnBattleArea(card))
  187. {
  188. if (card.Owner.LibraryCards.Count >= 1)
  189. {
  190. return true;
  191. }
  192. }
  193. return false;
  194. }
  195. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  196. {
  197. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  198. revealCount: 3,
  199. simplifiedSelectCardConditions:
  200. new SimplifiedSelectCardConditionClass[]
  201. {
  202. new SimplifiedSelectCardConditionClass(
  203. canTargetCondition:CanSelectCardCondition,
  204. message: "Select 1 [Machine], [Cyborg] or [SoC] to place in sources.",
  205. mode: SelectCardEffect.Mode.Custom,
  206. maxCount: 1,
  207. selectCardCoroutine: SelectCardCoroutine),
  208. new SimplifiedSelectCardConditionClass(
  209. canTargetCondition:CanSelectCardCondition1,
  210. message: "Select 1 [Machine], [Cyborg] or [SoC] to add to hand.",
  211. mode: SelectCardEffect.Mode.AddHand,
  212. maxCount: 1,
  213. selectCardCoroutine: null),
  214. },
  215. remainingCardsPlace: RemainingCardsPlace.Trash,
  216. activateClass: activateClass
  217. ));
  218. IEnumerator SelectCardCoroutine(CardSource cardSource)
  219. {
  220. if (CardEffectCommons.IsExistOnBattleArea(card))
  221. {
  222. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { cardSource }, "Digivolution Card", true, true));
  223. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { cardSource }, activateClass));
  224. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(card.PermanentOfThisCard()));
  225. }
  226. }
  227. }
  228. }
  229. if (timing == EffectTiming.OnEnterFieldAnyone)
  230. {
  231. ActivateClass activateClass = new ActivateClass();
  232. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  233. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  234. cardEffects.Add(activateClass);
  235. string EffectDiscription()
  236. {
  237. return "[When Digivolving] Reveal the top 3 cards of your deck. Place 1 card with the [Machine],[Cyborg] or [SoC] trait among them as this Digimon's bottom digivolution card and add 1 such card to the hand. Trash the rest.";
  238. }
  239. bool CanSelectCardCondition(CardSource cardSource)
  240. {
  241. return cardSource.CardTraits.Contains("Cyborg") || cardSource.CardTraits.Contains("Machine") || cardSource.CardTraits.Contains("SoC");
  242. }
  243. bool CanSelectCardCondition1(CardSource cardSource)
  244. {
  245. return cardSource.CardTraits.Contains("Cyborg") || cardSource.CardTraits.Contains("Machine") || cardSource.CardTraits.Contains("SoC");
  246. }
  247. bool CanUseCondition(Hashtable hashtable)
  248. {
  249. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  250. }
  251. bool CanActivateCondition(Hashtable hashtable)
  252. {
  253. if (CardEffectCommons.IsExistOnBattleArea(card))
  254. {
  255. if (card.Owner.LibraryCards.Count >= 1)
  256. {
  257. return true;
  258. }
  259. }
  260. return false;
  261. }
  262. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  263. {
  264. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  265. revealCount: 3,
  266. simplifiedSelectCardConditions:
  267. new SimplifiedSelectCardConditionClass[]
  268. {
  269. new SimplifiedSelectCardConditionClass(
  270. canTargetCondition:CanSelectCardCondition,
  271. message: "Select 1 [Machine], [Cyborg] or [SoC] to place in sources.",
  272. mode: SelectCardEffect.Mode.Custom,
  273. maxCount: 1,
  274. selectCardCoroutine: SelectCardCoroutine),
  275. new SimplifiedSelectCardConditionClass(
  276. canTargetCondition:CanSelectCardCondition1,
  277. message: "Select 1 [Machine], [Cyborg] or [SoC] to add to hand.",
  278. mode: SelectCardEffect.Mode.AddHand,
  279. maxCount: 1,
  280. selectCardCoroutine: null),
  281. },
  282. remainingCardsPlace: RemainingCardsPlace.Trash,
  283. activateClass: activateClass
  284. ));
  285. IEnumerator SelectCardCoroutine(CardSource cardSource)
  286. {
  287. if (CardEffectCommons.IsExistOnBattleArea(card))
  288. {
  289. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect(new List<CardSource>() { cardSource }, "Digivolution Card", true, true));
  290. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { cardSource }, activateClass));
  291. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(card.PermanentOfThisCard()));
  292. }
  293. }
  294. }
  295. }
  296. return cardEffects;
  297. }
  298. }
  299. }