EX3_061.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX3
  6. {
  7. public class EX3_061 : 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. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  15. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  16. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  17. addJogressConditionClass.SetNotShowUI(true);
  18. cardEffects.Add(addJogressConditionClass);
  19. bool CanUseCondition(Hashtable hashtable)
  20. {
  21. return true;
  22. }
  23. JogressCondition GetJogress(CardSource cardSource)
  24. {
  25. if (cardSource == card)
  26. {
  27. bool PermanentCondition1(Permanent permanent)
  28. {
  29. if (permanent != null)
  30. {
  31. if (permanent.TopCard != null)
  32. {
  33. if (permanent.TopCard.Owner == card.Owner)
  34. {
  35. if (permanent.IsDigimon)
  36. {
  37. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  38. {
  39. if (permanent.TopCard.CardColors.Contains(CardColor.Purple))
  40. {
  41. if (permanent.Levels_ForJogress(card).Contains(4))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. }
  49. }
  50. }
  51. return false;
  52. }
  53. bool PermanentCondition2(Permanent permanent)
  54. {
  55. if (permanent != null)
  56. {
  57. if (permanent.TopCard != null)
  58. {
  59. if (permanent.TopCard.Owner == card.Owner)
  60. {
  61. if (permanent.IsDigimon)
  62. {
  63. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  64. {
  65. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  66. {
  67. if (permanent.Levels_ForJogress(card).Contains(4))
  68. {
  69. return true;
  70. }
  71. }
  72. }
  73. }
  74. }
  75. }
  76. }
  77. return false;
  78. }
  79. JogressConditionElement[] elements = new JogressConditionElement[]
  80. {
  81. new JogressConditionElement(PermanentCondition1, "a level 4 purple Digimon"),
  82. new JogressConditionElement(PermanentCondition2, "a level 4 red Digimon"),
  83. };
  84. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  85. return jogressCondition;
  86. }
  87. return null;
  88. }
  89. }
  90. if (timing == EffectTiming.OnEnterFieldAnyone)
  91. {
  92. ActivateClass activateClass = new ActivateClass();
  93. activateClass.SetUpICardEffect("Play 1 [Paildramon] from trash", CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. return "[When Digivolving] When DNA digivolving, you may play 1 [Paildramon] from your trash without paying the cost.";
  99. }
  100. bool CanSelectCardCondition(CardSource cardSource)
  101. {
  102. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  103. {
  104. if (cardSource.CardNames.Contains("Paildramon"))
  105. {
  106. return true;
  107. }
  108. }
  109. return false;
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  114. {
  115. if (CardEffectCommons.IsJogress(hashtable))
  116. {
  117. return true;
  118. }
  119. }
  120. return false;
  121. }
  122. bool CanActivateCondition(Hashtable hashtable)
  123. {
  124. if (CardEffectCommons.IsExistOnBattleArea(card))
  125. {
  126. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardCondition(cardSource)))
  127. {
  128. return true;
  129. }
  130. }
  131. return false;
  132. }
  133. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  134. {
  135. int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  136. List<CardSource> selectedCards = new List<CardSource>();
  137. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  138. selectCardEffect.SetUp(
  139. canTargetCondition: CanSelectCardCondition,
  140. canTargetCondition_ByPreSelecetedList: null,
  141. canEndSelectCondition: null,
  142. canNoSelect: () => true,
  143. selectCardCoroutine: SelectCardCoroutine,
  144. afterSelectCardCoroutine: null,
  145. message: "Select 1 card to play.",
  146. maxCount: maxCount,
  147. canEndNotMax: false,
  148. isShowOpponent: true,
  149. mode: SelectCardEffect.Mode.Custom,
  150. root: SelectCardEffect.Root.Trash,
  151. customRootCardList: null,
  152. canLookReverseCard: true,
  153. selectPlayer: card.Owner,
  154. cardEffect: activateClass);
  155. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  156. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  157. yield return StartCoroutine(selectCardEffect.Activate());
  158. IEnumerator SelectCardCoroutine(CardSource cardSource)
  159. {
  160. selectedCards.Add(cardSource);
  161. yield return null;
  162. }
  163. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  164. cardSources: selectedCards,
  165. activateClass: activateClass,
  166. payCost: false,
  167. isTapped: false,
  168. root: SelectCardEffect.Root.Trash,
  169. activateETB: true));
  170. }
  171. }
  172. if (timing == EffectTiming.OnDestroyedAnyone)
  173. {
  174. ActivateClass activateClass = new ActivateClass();
  175. activateClass.SetUpICardEffect("Play 1 [Wormmon] from trash", CanUseCondition, card);
  176. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  177. cardEffects.Add(activateClass);
  178. string EffectDiscription()
  179. {
  180. return "[On Deletion] You may play 1 [Wormmon] from your trash without paying the cost.";
  181. }
  182. bool CanSelectCardCondition(CardSource cardSource)
  183. {
  184. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  185. {
  186. if (cardSource.CardNames.Contains("Wormmon"))
  187. {
  188. return true;
  189. }
  190. }
  191. return false;
  192. }
  193. bool CanUseCondition(Hashtable hashtable)
  194. {
  195. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  196. }
  197. bool CanActivateCondition(Hashtable hashtable)
  198. {
  199. if (CardEffectCommons.IsExistOnTrash(card))
  200. {
  201. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardCondition(cardSource)))
  202. {
  203. return true;
  204. }
  205. }
  206. return false;
  207. }
  208. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  209. {
  210. int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  211. List<CardSource> selectedCards = new List<CardSource>();
  212. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  213. selectCardEffect.SetUp(
  214. canTargetCondition: CanSelectCardCondition,
  215. canTargetCondition_ByPreSelecetedList: null,
  216. canEndSelectCondition: null,
  217. canNoSelect: () => true,
  218. selectCardCoroutine: SelectCardCoroutine,
  219. afterSelectCardCoroutine: null,
  220. message: "Select 1 card to play.",
  221. maxCount: maxCount,
  222. canEndNotMax: false,
  223. isShowOpponent: true,
  224. mode: SelectCardEffect.Mode.Custom,
  225. root: SelectCardEffect.Root.Trash,
  226. customRootCardList: null,
  227. canLookReverseCard: true,
  228. selectPlayer: card.Owner,
  229. cardEffect: activateClass);
  230. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  231. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  232. yield return StartCoroutine(selectCardEffect.Activate());
  233. IEnumerator SelectCardCoroutine(CardSource cardSource)
  234. {
  235. selectedCards.Add(cardSource);
  236. yield return null;
  237. }
  238. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  239. cardSources: selectedCards,
  240. activateClass: activateClass,
  241. payCost: false,
  242. isTapped: false,
  243. root: SelectCardEffect.Root.Trash,
  244. activateETB: true));
  245. }
  246. }
  247. if (timing == EffectTiming.None)
  248. {
  249. CanAttackTargetDefendingPermanentClass canAttackTargetDefendingPermanentClass = new CanAttackTargetDefendingPermanentClass();
  250. canAttackTargetDefendingPermanentClass.SetUpICardEffect($"Can attack to unsuspended Digimon", CanUseCondition, card);
  251. canAttackTargetDefendingPermanentClass.SetUpCanAttackTargetDefendingPermanentClass(
  252. attackerCondition: AttackerCondition,
  253. defenderCondition: DefenderCondition,
  254. cardEffectCondition: CardEffectCondition);
  255. canAttackTargetDefendingPermanentClass.SetIsInheritedEffect(true);
  256. cardEffects.Add(canAttackTargetDefendingPermanentClass);
  257. bool CanUseCondition(Hashtable hashtable)
  258. {
  259. if (CardEffectCommons.IsExistOnBattleArea(card))
  260. {
  261. if (CardEffectCommons.IsOwnerTurn(card))
  262. {
  263. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Imperialdramon"))
  264. {
  265. return true;
  266. }
  267. }
  268. }
  269. return false;
  270. }
  271. bool AttackerCondition(Permanent permanent)
  272. {
  273. return permanent == card.PermanentOfThisCard();
  274. }
  275. bool DefenderCondition(Permanent permanent)
  276. {
  277. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  278. {
  279. if (!permanent.IsSuspended)
  280. {
  281. return true;
  282. }
  283. }
  284. return false;
  285. }
  286. bool CardEffectCondition(ICardEffect cardEffect)
  287. {
  288. return true;
  289. }
  290. }
  291. return cardEffects;
  292. }
  293. }
  294. }