EX3_010.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  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_010 : 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.Red))
  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.Purple))
  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 red Digimon"),
  82. new JogressConditionElement(PermanentCondition2, "a level 4 purple 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 [Dinobeemon] 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 [Dinobeemon] 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("Dinobeemon"))
  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(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true));
  164. }
  165. }
  166. if (timing == EffectTiming.OnDestroyedAnyone)
  167. {
  168. ActivateClass activateClass = new ActivateClass();
  169. activateClass.SetUpICardEffect("Play 1 [Veemon] from trash", CanUseCondition, card);
  170. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  171. cardEffects.Add(activateClass);
  172. string EffectDiscription()
  173. {
  174. return "[On Deletion] You may play 1 [Veemon] from your trash without paying the cost.";
  175. }
  176. bool CanSelectCardCondition(CardSource cardSource)
  177. {
  178. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  179. {
  180. if (cardSource.CardNames.Contains("Veemon"))
  181. {
  182. return true;
  183. }
  184. }
  185. return false;
  186. }
  187. bool CanUseCondition(Hashtable hashtable)
  188. {
  189. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  190. }
  191. bool CanActivateCondition(Hashtable hashtable)
  192. {
  193. if (CardEffectCommons.IsExistOnTrash(card))
  194. {
  195. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, (cardSource) => CanSelectCardCondition(cardSource)))
  196. {
  197. return true;
  198. }
  199. }
  200. return false;
  201. }
  202. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  203. {
  204. int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  205. List<CardSource> selectedCards = new List<CardSource>();
  206. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  207. selectCardEffect.SetUp(
  208. canTargetCondition: CanSelectCardCondition,
  209. canTargetCondition_ByPreSelecetedList: null,
  210. canEndSelectCondition: null,
  211. canNoSelect: () => true,
  212. selectCardCoroutine: SelectCardCoroutine,
  213. afterSelectCardCoroutine: null,
  214. message: "Select 1 card to play.",
  215. maxCount: maxCount,
  216. canEndNotMax: false,
  217. isShowOpponent: true,
  218. mode: SelectCardEffect.Mode.Custom,
  219. root: SelectCardEffect.Root.Trash,
  220. customRootCardList: null,
  221. canLookReverseCard: true,
  222. selectPlayer: card.Owner,
  223. cardEffect: activateClass);
  224. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  225. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  226. yield return StartCoroutine(selectCardEffect.Activate());
  227. IEnumerator SelectCardCoroutine(CardSource cardSource)
  228. {
  229. selectedCards.Add(cardSource);
  230. yield return null;
  231. }
  232. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true));
  233. }
  234. }
  235. if (timing == EffectTiming.None)
  236. {
  237. bool Condition()
  238. {
  239. if (CardEffectCommons.IsExistOnBattleArea(card))
  240. {
  241. if (CardEffectCommons.IsOwnerTurn(card))
  242. {
  243. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Imperialdramon"))
  244. {
  245. return true;
  246. }
  247. }
  248. }
  249. return false;
  250. }
  251. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: true, card: card, condition: Condition));
  252. }
  253. return cardEffects;
  254. }
  255. }
  256. }