AD1_025.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. // Omnimon
  5. namespace DCGO.CardEffects.AD1
  6. {
  7. public class AD1_025 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region DNA Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. cardEffects.Add(CardEffectFactory.GetJogressConditionClass(
  16. PermanentCondition1,
  17. "Lv.6 w/[Greymon] in name",
  18. PermanentCondition2,
  19. "Lv.6 w/[Garurumon] in name",
  20. card
  21. ));
  22. bool PermanentCondition1(Permanent permanent)
  23. {
  24. return permanent.TopCard.ContainsCardName("Greymon")
  25. && permanent.Levels_ForJogress(card).Contains(6);
  26. }
  27. bool PermanentCondition2(Permanent permanent)
  28. {
  29. return permanent.TopCard.ContainsCardName("Garurumon")
  30. && permanent.Levels_ForJogress(card).Contains(6);
  31. }
  32. }
  33. #endregion
  34. #region Raid
  35. if (timing == EffectTiming.OnAllyAttack)
  36. {
  37. cardEffects.Add(CardEffectFactory.RaidSelfEffect(isInheritedEffect: false, card: card, condition: null));
  38. }
  39. #endregion
  40. #region Blocker
  41. if (timing == EffectTiming.None)
  42. {
  43. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  44. }
  45. #endregion
  46. #region Partition
  47. List<PartitionCondition> partitionConditions = new List<PartitionCondition>
  48. {
  49. new PartitionCondition("WarGreymon"),
  50. new PartitionCondition("MetalGarurumon")
  51. };
  52. if (timing == EffectTiming.WhenRemoveField)
  53. {
  54. cardEffects.Add(CardEffectFactory.PartitionSelfEffect(
  55. isInheritedEffect: false,
  56. card: card,
  57. condition: null,
  58. cardSourceConditions: partitionConditions));
  59. }
  60. #endregion
  61. #region Common Methods
  62. bool IsOpponentsDigimon(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  63. #endregion
  64. #region Shared OP / WD
  65. string SharedEffectName = "Bottom deck all enemy Digimon with as many or fewer sources as this, then delete 1 enemy Digimon";
  66. string SharedEffectDescription(string tag)
  67. => $"[{tag}] Return all of your opponent's Digimon with as many or fewer digivolution cards as this Digimon to the bottom of the deck. Then, delete 1 of your opponent's Digimon.";
  68. bool SharedCanActivateCondition(Hashtable hashtable) => CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  69. bool IsEnemyWithLessSources(Permanent permanent)
  70. {
  71. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  72. && permanent.DigivolutionCards.Count <= card.PermanentOfThisCard().DigivolutionCards.Count;
  73. }
  74. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  75. {
  76. List<Permanent> bottomDeckTargets = card.Owner.Enemy.GetBattleAreaDigimons().Filter(IsEnemyWithLessSources);
  77. yield return ContinuousController.instance.StartCoroutine(new DeckBottomBounceClass(bottomDeckTargets, CardEffectCommons.CardEffectHashtable(activateClass)).DeckBounce());
  78. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsOpponentsDigimon))
  79. {
  80. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  81. selectPermanentEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: IsOpponentsDigimon,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: 1,
  87. canNoSelect: false,
  88. canEndNotMax: false,
  89. selectPermanentCoroutine: null,
  90. afterSelectPermanentCoroutine: null,
  91. mode: SelectPermanentEffect.Mode.Destroy,
  92. cardEffect: activateClass);
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. }
  95. }
  96. #endregion
  97. #region On Play
  98. if (timing == EffectTiming.OnEnterFieldAnyone)
  99. {
  100. ActivateClass activateClass = new ActivateClass();
  101. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  102. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDescription("On Play"));
  103. cardEffects.Add(activateClass);
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  107. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  108. }
  109. }
  110. #endregion
  111. #region When Digivolving
  112. if (timing == EffectTiming.OnEnterFieldAnyone)
  113. {
  114. ActivateClass activateClass = new ActivateClass();
  115. activateClass.SetUpICardEffect(SharedEffectName, CanUseCondition, card);
  116. activateClass.SetUpActivateClass(SharedCanActivateCondition, hashtable => SharedActivateCoroutine(hashtable, activateClass), -1, false, SharedEffectDescription("When Digivolving"));
  117. cardEffects.Add(activateClass);
  118. bool CanUseCondition(Hashtable hashtable)
  119. {
  120. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  121. && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  122. }
  123. }
  124. #endregion
  125. #region All Turns
  126. if (timing == EffectTiming.OnLeaveFieldAnyone)
  127. {
  128. ActivateClass activateClass = new ActivateClass();
  129. activateClass.SetUpICardEffect("Trash 1 enemy option card in the battle area and 1 card from their security.", CanUseCondition, card);
  130. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  131. activateClass.SetHashString("AD1-025_AT");
  132. cardEffects.Add(activateClass);
  133. string EffectDescription()
  134. => "[All Turns] [Once Per Turn] When any of your opponent's Digimon leave the battle area, trash 1 of their Option cards in the battle area and trash their top security card.";
  135. bool CanUseCondition(Hashtable hashtable)
  136. {
  137. return CardEffectCommons.IsExistOnBattleArea(card)
  138. && CardEffectCommons.CanTriggerOnPermanentLeave(hashtable, IsOpponentsDigimon);
  139. }
  140. bool IsEnemyOptionPermanent(Permanent permanent)
  141. {
  142. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  143. && permanent.IsOption;
  144. }
  145. bool CanActivateCondition(Hashtable hashtable)
  146. {
  147. return CardEffectCommons.IsExistOnBattleArea(card);
  148. }
  149. IEnumerator ActivateCoroutine(Hashtable hashtable)
  150. {
  151. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, IsEnemyOptionPermanent))
  152. {
  153. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  154. selectPermanentEffect.SetUp(
  155. selectPlayer: card.Owner,
  156. canTargetCondition: IsEnemyOptionPermanent,
  157. canTargetCondition_ByPreSelecetedList: null,
  158. canEndSelectCondition: null,
  159. maxCount: 1,
  160. canNoSelect: false,
  161. canEndNotMax: false,
  162. selectPermanentCoroutine: null,
  163. afterSelectPermanentCoroutine: null,
  164. mode: SelectPermanentEffect.Mode.Destroy,
  165. cardEffect: activateClass);
  166. selectPermanentEffect.SetUpCustomMessage("Select option to trash.", "The opponent is selecting 1 option to trash.");
  167. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  168. }
  169. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  170. player: card.Owner.Enemy,
  171. destroySecurityCount: 1,
  172. cardEffect: activateClass,
  173. fromTop: true).DestroySecurity());
  174. }
  175. }
  176. #endregion
  177. #region Assembly
  178. if (timing == EffectTiming.None)
  179. {
  180. AddAssemblyConditionClass addAssemblyConditionClass = new AddAssemblyConditionClass();
  181. addAssemblyConditionClass.SetUpICardEffect($"Assembly", CanUseCondition, card);
  182. addAssemblyConditionClass.SetUpAddAssemblyConditionClass(getAssemblyCondition: GetAssembly);
  183. addAssemblyConditionClass.SetNotShowUI(true);
  184. cardEffects.Add(addAssemblyConditionClass);
  185. bool CanUseCondition(Hashtable hashtable)
  186. {
  187. return true;
  188. }
  189. AssemblyCondition GetAssembly(CardSource cardSource)
  190. {
  191. if (cardSource == card)
  192. {
  193. AssemblyConditionElement element1 = new AssemblyConditionElement(CanSelectCardCondition1, selectMessage: "[WarGreymon]", elementCount: 1);
  194. AssemblyConditionElement element2 = new AssemblyConditionElement(CanSelectCardCondition2, selectMessage: "[MetalGarurumon]", elementCount: 1);
  195. bool CanSelectCardCondition1(CardSource cardSource)
  196. {
  197. return cardSource != null &&
  198. cardSource.Owner == card.Owner &&
  199. cardSource.IsDigimon &&
  200. cardSource.EqualsCardName("WarGreymon");
  201. }
  202. bool CanSelectCardCondition2(CardSource cardSource)
  203. {
  204. return cardSource != null &&
  205. cardSource.Owner == card.Owner &&
  206. cardSource.IsDigimon &&
  207. cardSource.EqualsCardName("MetalGarurumon");
  208. }
  209. AssemblyCondition assemblyCondition = new AssemblyCondition(
  210. elements:new List<AssemblyConditionElement>() { element1, element2 },
  211. reduceCost: 6);
  212. return assemblyCondition;
  213. }
  214. return null;
  215. }
  216. }
  217. #endregion
  218. return cardEffects;
  219. }
  220. }
  221. }