BT12_073.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_073 : 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. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.CardNames.Contains("Impmon");
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  19. permanentCondition: PermanentCondition,
  20. digivolutionCost: 0,
  21. ignoreDigivolutionRequirement: false,
  22. card: card,
  23. condition: null));
  24. }
  25. if (timing == EffectTiming.OnEnterFieldAnyone)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Trash 1 option card from hand to return 1 Digimon card from trash to hand", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[On Play] By trashing 1 Option card in your hand, you may return 1 Digimon card with an [Evil], [Wizard], or [Demon Lord] trait from your trash to your hand.";
  34. }
  35. bool CanSelectCardCondition(CardSource cardSource)
  36. {
  37. return cardSource.IsOption;
  38. }
  39. bool CanSelectCardCondition1(CardSource cardSource)
  40. {
  41. if (cardSource.IsDigimon)
  42. {
  43. if (cardSource.CardTraits.Contains("Evil"))
  44. {
  45. return true;
  46. }
  47. if (cardSource.CardTraits.Contains("Wizard"))
  48. {
  49. return true;
  50. }
  51. if (cardSource.CardTraits.Contains("Demon Lord"))
  52. {
  53. return true;
  54. }
  55. if (cardSource.CardTraits.Contains("DemonLord"))
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanUseCondition(Hashtable hashtable)
  63. {
  64. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  65. }
  66. bool CanActivateCondition(Hashtable hashtable)
  67. {
  68. if (CardEffectCommons.IsExistOnBattleArea(card))
  69. {
  70. if (card.Owner.HandCards.Count >= 1)
  71. {
  72. return true;
  73. }
  74. }
  75. return false;
  76. }
  77. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  78. {
  79. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  80. {
  81. bool discarded = false;
  82. int discardCount = 1;
  83. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  84. selectHandEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectCardCondition,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: discardCount,
  90. canNoSelect: true,
  91. canEndNotMax: false,
  92. isShowOpponent: true,
  93. selectCardCoroutine: null,
  94. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  95. mode: SelectHandEffect.Mode.Discard,
  96. cardEffect: activateClass);
  97. selectHandEffect.SetUpCustomMessage(
  98. "Select 1 option card to trash.",
  99. "The opponent is selecting 1 option card to trash."
  100. );
  101. yield return StartCoroutine(selectHandEffect.Activate());
  102. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  103. {
  104. if (cardSources.Count >= 1)
  105. {
  106. discarded = true;
  107. yield return null;
  108. }
  109. }
  110. if (discarded)
  111. {
  112. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition1))
  113. {
  114. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition1));
  115. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  116. selectCardEffect.SetUp(
  117. canTargetCondition: CanSelectCardCondition1,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. canNoSelect: () => true,
  121. selectCardCoroutine: null,
  122. afterSelectCardCoroutine: null,
  123. message: "Select 1 Digimon card to add to your hand.",
  124. maxCount: maxCount,
  125. canEndNotMax: false,
  126. isShowOpponent: true,
  127. mode: SelectCardEffect.Mode.AddHand,
  128. root: SelectCardEffect.Root.Trash,
  129. customRootCardList: null,
  130. canLookReverseCard: true,
  131. selectPlayer: card.Owner,
  132. cardEffect: activateClass);
  133. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  134. }
  135. }
  136. }
  137. }
  138. }
  139. if (timing == EffectTiming.OnEnterFieldAnyone)
  140. {
  141. ActivateClass activateClass = new ActivateClass();
  142. activateClass.SetUpICardEffect("Trash 1 option card from hand to return 1 Digimon card from trash to hand", CanUseCondition, card);
  143. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  144. cardEffects.Add(activateClass);
  145. string EffectDiscription()
  146. {
  147. return "[When Digivolving] By trashing 1 Option card in your hand, you may return 1 Digimon card with an [Evil], [Wizard], or [Demon Lord] trait from your trash to your hand.";
  148. }
  149. bool CanSelectCardCondition(CardSource cardSource)
  150. {
  151. return cardSource.IsOption;
  152. }
  153. bool CanSelectCardCondition1(CardSource cardSource)
  154. {
  155. if (cardSource.IsDigimon)
  156. {
  157. if (cardSource.CardTraits.Contains("Evil"))
  158. {
  159. return true;
  160. }
  161. if (cardSource.CardTraits.Contains("Wizard"))
  162. {
  163. return true;
  164. }
  165. if (cardSource.CardTraits.Contains("Demon Lord"))
  166. {
  167. return true;
  168. }
  169. if (cardSource.CardTraits.Contains("DemonLord"))
  170. {
  171. return true;
  172. }
  173. }
  174. return false;
  175. }
  176. bool CanUseCondition(Hashtable hashtable)
  177. {
  178. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  179. }
  180. bool CanActivateCondition(Hashtable hashtable)
  181. {
  182. if (CardEffectCommons.IsExistOnBattleArea(card))
  183. {
  184. if (card.Owner.HandCards.Count >= 1)
  185. {
  186. return true;
  187. }
  188. }
  189. return false;
  190. }
  191. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  192. {
  193. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  194. {
  195. bool discarded = false;
  196. int discardCount = 1;
  197. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  198. selectHandEffect.SetUp(
  199. selectPlayer: card.Owner,
  200. canTargetCondition: CanSelectCardCondition,
  201. canTargetCondition_ByPreSelecetedList: null,
  202. canEndSelectCondition: null,
  203. maxCount: discardCount,
  204. canNoSelect: true,
  205. canEndNotMax: false,
  206. isShowOpponent: true,
  207. selectCardCoroutine: null,
  208. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  209. mode: SelectHandEffect.Mode.Discard,
  210. cardEffect: activateClass);
  211. selectHandEffect.SetUpCustomMessage(
  212. "Select 1 option card to trash.",
  213. "The opponent is selecting 1 option card to trash."
  214. );
  215. yield return StartCoroutine(selectHandEffect.Activate());
  216. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  217. {
  218. if (cardSources.Count >= 1)
  219. {
  220. discarded = true;
  221. yield return null;
  222. }
  223. }
  224. if (discarded)
  225. {
  226. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition1))
  227. {
  228. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition1));
  229. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  230. selectCardEffect.SetUp(
  231. canTargetCondition: CanSelectCardCondition1,
  232. canTargetCondition_ByPreSelecetedList: null,
  233. canEndSelectCondition: null,
  234. canNoSelect: () => true,
  235. selectCardCoroutine: null,
  236. afterSelectCardCoroutine: null,
  237. message: "Select 1 Digimon card to add to your hand.",
  238. maxCount: maxCount,
  239. canEndNotMax: false,
  240. isShowOpponent: true,
  241. mode: SelectCardEffect.Mode.AddHand,
  242. root: SelectCardEffect.Root.Trash,
  243. customRootCardList: null,
  244. canLookReverseCard: true,
  245. selectPlayer: card.Owner,
  246. cardEffect: activateClass);
  247. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  248. }
  249. }
  250. }
  251. }
  252. }
  253. if (timing == EffectTiming.OnAllyAttack)
  254. {
  255. ActivateClass activateClass = new ActivateClass();
  256. activateClass.SetUpICardEffect("Trash 2 cards from deck top", CanUseCondition, card);
  257. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  258. activateClass.SetIsInheritedEffect(true);
  259. activateClass.SetHashString("TrashDeck_BT12_073");
  260. cardEffects.Add(activateClass);
  261. string EffectDiscription()
  262. {
  263. return "[When Attacking][Once Per Turn] Trash the top 2 cards of your deck.";
  264. }
  265. bool CanUseCondition(Hashtable hashtable)
  266. {
  267. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  268. }
  269. bool CanActivateCondition(Hashtable hashtable)
  270. {
  271. if (CardEffectCommons.IsExistOnBattleArea(card))
  272. {
  273. return true;
  274. }
  275. return false;
  276. }
  277. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  278. {
  279. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(2, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  280. }
  281. }
  282. return cardEffects;
  283. }
  284. }
  285. }