EX6_062.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_062 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Partition
  13. if (timing == EffectTiming.WhenRemoveField)
  14. {
  15. List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
  16. partitionConditions.Add(new PartitionCondition(6, CardColor.Black, CardColor.Yellow));
  17. partitionConditions.Add(new PartitionCondition(6, CardColor.Green, CardColor.Purple));
  18. cardEffects.Add(CardEffectFactory.PartitionSelfEffect(
  19. isInheritedEffect: false,
  20. card: card,
  21. condition: null,
  22. cardSourceConditions: partitionConditions));
  23. }
  24. #endregion
  25. #region DNA
  26. if (timing == EffectTiming.None)
  27. {
  28. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  29. addJogressConditionClass.SetUpICardEffect($"DNA Digivolution", CanUseCondition, card);
  30. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  31. addJogressConditionClass.SetNotShowUI(true);
  32. cardEffects.Add(addJogressConditionClass);
  33. bool CanUseCondition(Hashtable hashtable)
  34. {
  35. return true;
  36. }
  37. JogressCondition GetJogress(CardSource cardSource)
  38. {
  39. if (cardSource == card)
  40. {
  41. bool PermanentCondition1(Permanent permanent)
  42. {
  43. if (permanent != null)
  44. {
  45. if (permanent.TopCard != null)
  46. {
  47. if (permanent.TopCard.Owner == card.Owner)
  48. {
  49. if (permanent.IsDigimon)
  50. {
  51. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  52. {
  53. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow) || permanent.TopCard.CardColors.Contains(CardColor.Black))
  54. {
  55. if (permanent.Levels_ForJogress(card).Contains(6))
  56. {
  57. return true;
  58. }
  59. }
  60. }
  61. }
  62. }
  63. }
  64. }
  65. return false;
  66. }
  67. bool PermanentCondition2(Permanent permanent)
  68. {
  69. if (permanent != null)
  70. {
  71. if (permanent.TopCard != null)
  72. {
  73. if (permanent.TopCard.Owner == card.Owner)
  74. {
  75. if (permanent.IsDigimon)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  78. {
  79. if (permanent.TopCard.CardColors.Contains(CardColor.Green) || permanent.TopCard.CardColors.Contains(CardColor.Purple))
  80. {
  81. if (permanent.Levels_ForJogress(card).Contains(6))
  82. {
  83. return true;
  84. }
  85. }
  86. }
  87. }
  88. }
  89. }
  90. }
  91. return false;
  92. }
  93. JogressConditionElement[] elements = new JogressConditionElement[]
  94. {
  95. new JogressConditionElement(PermanentCondition1, "a level 6 Yellow/Black Digimon"),
  96. new JogressConditionElement(PermanentCondition2, "a level 6 Green/Purple Digimon"),
  97. };
  98. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  99. return jogressCondition;
  100. }
  101. return null;
  102. }
  103. }
  104. #endregion
  105. #region When Digivolving
  106. if (timing == EffectTiming.OnEnterFieldAnyone)
  107. {
  108. ActivateClass activateClass = new ActivateClass();
  109. activateClass.SetUpICardEffect("Place lvl 6 cards from trash to digivolution cards", CanUseCondition, card);
  110. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  111. cardEffects.Add(activateClass);
  112. string EffectDiscription()
  113. {
  114. return "[When Digivolving] If DNA digivolving, you may place up to 2 level 6 cards from your trash as this Digimon's bottom digivolution cards. Then, for each of this Digimon's level 6 digivolution cards, return 1 of your opponent's Digimon to the bottom of the deck.";
  115. }
  116. bool CanSelectCardCondition(CardSource cardSource)
  117. {
  118. return (cardSource.HasLevel && cardSource.Level == 6);
  119. }
  120. bool CanSelectPermanentCondition(Permanent permanent)
  121. {
  122. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  123. }
  124. bool CanUseCondition(Hashtable hashtable)
  125. {
  126. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleArea(card))
  131. {
  132. return true;
  133. }
  134. return false;
  135. }
  136. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  137. {
  138. if (CardEffectCommons.IsJogress(_hashtable))
  139. {
  140. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  141. {
  142. List<CardSource> selectedCards = new List<CardSource>();
  143. int maxCount = Math.Min(2, card.Owner.TrashCards.Count(CanSelectCardCondition));
  144. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  145. selectCardEffect.SetUp(
  146. canTargetCondition: CanSelectCardCondition,
  147. canTargetCondition_ByPreSelecetedList: null,
  148. canEndSelectCondition: null,
  149. canNoSelect: () => true,
  150. selectCardCoroutine: SelectCardCoroutine,
  151. afterSelectCardCoroutine: null,
  152. message: "Select level 6 cards to place on bottom of digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  153. maxCount: maxCount,
  154. canEndNotMax: true,
  155. isShowOpponent: true,
  156. mode: SelectCardEffect.Mode.Custom,
  157. root: SelectCardEffect.Root.Trash,
  158. customRootCardList: null,
  159. canLookReverseCard: true,
  160. selectPlayer: card.Owner,
  161. cardEffect: activateClass);
  162. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards");
  163. selectCardEffect.SetUpCustomMessage("Select cards to place on bottom of digivolution cards.", "The opponent is selecting cards to place on bottom of digivolution cards.");
  164. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  165. IEnumerator SelectCardCoroutine(CardSource cardSource)
  166. {
  167. selectedCards.Add(cardSource);
  168. yield return null;
  169. }
  170. if (selectedCards.Count >= 1)
  171. {
  172. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  173. }
  174. }
  175. }
  176. int count = card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition);
  177. if (count >= 1)
  178. {
  179. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  180. {
  181. int maxCount = Math.Min(count, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  182. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  183. selectPermanentEffect.SetUp(
  184. selectPlayer: card.Owner,
  185. canTargetCondition: CanSelectPermanentCondition,
  186. canTargetCondition_ByPreSelecetedList: null,
  187. canEndSelectCondition: CanEndSelectCondition,
  188. maxCount: maxCount,
  189. canNoSelect: false,
  190. canEndNotMax: false,
  191. selectPermanentCoroutine: null,
  192. afterSelectPermanentCoroutine: null,
  193. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  194. cardEffect: activateClass);
  195. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  196. bool CanEndSelectCondition(List<Permanent> permanents)
  197. {
  198. return (permanents.Count > 0);
  199. }
  200. }
  201. }
  202. }
  203. }
  204. #endregion
  205. #region All Turns
  206. if (timing == EffectTiming.None)
  207. {
  208. bool Condition()
  209. {
  210. int count = card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.HasLevel && cardSource.Level == 6);
  211. if (CardEffectCommons.IsExistOnBattleArea(card))
  212. {
  213. if (CardEffectCommons.IsOwnerTurn(card))
  214. {
  215. if (count >= 4)
  216. {
  217. return true;
  218. }
  219. }
  220. }
  221. return false;
  222. }
  223. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 3, isInheritedEffect: false, card: card, condition: Condition));
  224. }
  225. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  226. {
  227. bool Condition()
  228. {
  229. int count = card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.HasLevel && cardSource.Level == 6);
  230. if (CardEffectCommons.IsExistOnBattleArea(card))
  231. {
  232. if (CardEffectCommons.IsOwnerTurn(card))
  233. {
  234. if (count >= 4)
  235. {
  236. return true;
  237. }
  238. }
  239. }
  240. return false;
  241. }
  242. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: Condition));
  243. }
  244. #endregion
  245. return cardEffects;
  246. }
  247. }
  248. }