BT23_047.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. //Examon
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_047 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.IsLevel6 &&
  18. targetPermanent.TopCard.HasCSTraits;
  19. }
  20. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  21. permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false,
  22. card: card, condition: null));
  23. }
  24. #endregion
  25. #region DNA Digivolution - Green Lv.6 + Blue Lv.6: Cost 0
  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 (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  44. {
  45. if (permanent.TopCard.CardColors.Contains(CardColor.Green))
  46. {
  47. if (permanent.Levels_ForJogress(card).Contains(6))
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. return false;
  54. }
  55. bool PermanentCondition2(Permanent permanent)
  56. {
  57. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  58. {
  59. if (permanent.TopCard.CardColors.Contains(CardColor.Blue))
  60. {
  61. if (permanent.Levels_ForJogress(card).Contains(6))
  62. {
  63. return true;
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. JogressConditionElement[] elements = new JogressConditionElement[]
  70. {
  71. new JogressConditionElement(PermanentCondition1, "a level 6 green Digimon"),
  72. new JogressConditionElement(PermanentCondition2, "a level 6 blue Digimon"),
  73. };
  74. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  75. return jogressCondition;
  76. }
  77. return null;
  78. }
  79. }
  80. #endregion
  81. #region Static Effects
  82. #region Piercing
  83. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  84. {
  85. cardEffects.Add(CardEffectFactory.PierceSelfEffect(
  86. isInheritedEffect: false,
  87. card: card,
  88. condition: null));
  89. }
  90. #endregion
  91. #region Security Atk +1
  92. if (timing == EffectTiming.None)
  93. {
  94. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  95. }
  96. #endregion
  97. #region Partition
  98. List<PartitionCondition> partitionConditions = new List<PartitionCondition>();
  99. partitionConditions.Add(new PartitionCondition(5, CardColor.Green));
  100. partitionConditions.Add(new PartitionCondition(5, CardColor.Blue));
  101. if (timing == EffectTiming.WhenRemoveField)
  102. {
  103. cardEffects.Add(CardEffectFactory.PartitionSelfEffect(
  104. isInheritedEffect: false,
  105. card: card,
  106. condition: null,
  107. cardSourceConditions: partitionConditions)
  108. );
  109. }
  110. #endregion
  111. #endregion
  112. #region OP/WD Shared
  113. string SharedEffectDiscription(string tag)
  114. {
  115. return $"[{tag}] Suspend 5 of your opponent's Digimon or Tamers. None of your opponent's Digimon can unsuspend in their next unsuspend phase. Then, this Digimon may attack.";
  116. }
  117. bool SharedCanSelectOpponentsDigimon(Permanent permanent)
  118. {
  119. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  120. }
  121. bool SharedCanSelectOpponentsDigimonOrTamer(Permanent permanent)
  122. {
  123. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  124. (permanent.IsDigimon || permanent.IsTamer);
  125. }
  126. bool SharedCanActivateCondition(Hashtable hashtable)
  127. {
  128. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  129. }
  130. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  131. {
  132. if (CardEffectCommons.HasMatchConditionPermanent(SharedCanSelectOpponentsDigimonOrTamer))
  133. {
  134. int maxCount = Math.Min(5, CardEffectCommons.MatchConditionPermanentCount(SharedCanSelectOpponentsDigimonOrTamer));
  135. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  136. selectPermanentEffect.SetUp(
  137. selectPlayer: card.Owner,
  138. canTargetCondition: SharedCanSelectOpponentsDigimonOrTamer,
  139. canTargetCondition_ByPreSelecetedList: null,
  140. canEndSelectCondition: null,
  141. maxCount: maxCount,
  142. canNoSelect: false,
  143. canEndNotMax: false,
  144. selectPermanentCoroutine: null,
  145. afterSelectPermanentCoroutine: null,
  146. mode: SelectPermanentEffect.Mode.Tap,
  147. cardEffect: activateClass);
  148. selectPermanentEffect.SetUpCustomMessage($"Select {maxCount} Digimon/Tamer to suspend.", $"The opponent is selecting {maxCount} Digimon/Tamer to suspend.");
  149. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  150. }
  151. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspendPlayerEffect(
  152. permanentCondition: SharedCanSelectOpponentsDigimon,
  153. effectDuration: EffectDuration.UntilOwnerActivePhase,
  154. activateClass: activateClass,
  155. isOnlyActivePhase: true,
  156. effectName: "Your Digimon can't unsuspend"));
  157. if (card.PermanentOfThisCard().CanAttack(activateClass))
  158. {
  159. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  160. selectAttackEffect.SetUp(
  161. attacker: card.PermanentOfThisCard(),
  162. canAttackPlayerCondition: () => true,
  163. defenderCondition: (permanent) => true,
  164. cardEffect: activateClass);
  165. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  166. }
  167. }
  168. #endregion
  169. #region On Play
  170. if (timing == EffectTiming.OnEnterFieldAnyone)
  171. {
  172. ActivateClass activateClass = new ActivateClass();
  173. activateClass.SetUpICardEffect("Suspend 5 digimon/tamer, none can unsuspend. Then you may attack", CanUseCondition, card);
  174. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDiscription("On Play"));
  175. cardEffects.Add(activateClass);
  176. bool CanUseCondition(Hashtable hashtable)
  177. {
  178. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  179. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  180. }
  181. }
  182. #endregion
  183. #region When Digivolving
  184. if (timing == EffectTiming.OnEnterFieldAnyone)
  185. {
  186. ActivateClass activateClass = new ActivateClass();
  187. activateClass.SetUpICardEffect("Suspend 5 digimon/tamer, none can unsuspend. Then you may attack", CanUseCondition, card);
  188. activateClass.SetUpActivateClass(SharedCanActivateCondition, hash => SharedActivateCoroutine(hash, activateClass), -1, false, SharedEffectDiscription("When Digivolving"));
  189. cardEffects.Add(activateClass);
  190. bool CanUseCondition(Hashtable hashtable)
  191. {
  192. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  193. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  194. }
  195. }
  196. #endregion
  197. #region Your Turn - OPT
  198. if (timing == EffectTiming.OnLoseSecurity)
  199. {
  200. ActivateClass activateClass = new ActivateClass();
  201. activateClass.SetUpICardEffect("Trash 1 option card, then delete 1 suspended digimon/tamer", CanUseCondition, card);
  202. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  203. activateClass.SetHashString("YT_BT23_047");
  204. cardEffects.Add(activateClass);
  205. string EffectDiscription()
  206. {
  207. return "[Your Turn] [Once Per Turn] When your opponent's security stack is removed from, trash 1 of their Option cards in the battle area. Then, delete 1 of their suspended Digimon or Tamers.";
  208. }
  209. bool CanUseCondition(Hashtable hashtable)
  210. {
  211. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  212. CardEffectCommons.IsOwnerTurn(card) &&
  213. CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner.Enemy);
  214. }
  215. bool CanActivateCondition(Hashtable hashtable)
  216. {
  217. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  218. }
  219. bool CanSelectTrashPermanentCondition(Permanent permanent)
  220. {
  221. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  222. permanent.IsOption;
  223. }
  224. bool CanSelectDeletionPermanentCondition(Permanent permanent)
  225. {
  226. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  227. permanent.IsSuspended &&
  228. (permanent.IsDigimon || permanent.IsTamer);
  229. }
  230. IEnumerator ActivateCoroutine(Hashtable hashtable)
  231. {
  232. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectTrashPermanentCondition))
  233. {
  234. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  235. selectPermanentEffect.SetUp(
  236. selectPlayer: card.Owner,
  237. canTargetCondition: CanSelectTrashPermanentCondition,
  238. canTargetCondition_ByPreSelecetedList: null,
  239. canEndSelectCondition: null,
  240. maxCount: 1,
  241. canNoSelect: false,
  242. canEndNotMax: false,
  243. selectPermanentCoroutine: null,
  244. afterSelectPermanentCoroutine: null,
  245. mode: SelectPermanentEffect.Mode.Destroy,
  246. cardEffect: activateClass);
  247. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  248. }
  249. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectDeletionPermanentCondition))
  250. {
  251. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  252. selectPermanentEffect.SetUp(
  253. selectPlayer: card.Owner,
  254. canTargetCondition: CanSelectDeletionPermanentCondition,
  255. canTargetCondition_ByPreSelecetedList: null,
  256. canEndSelectCondition: null,
  257. maxCount: 1,
  258. canNoSelect: false,
  259. canEndNotMax: false,
  260. selectPermanentCoroutine: null,
  261. afterSelectPermanentCoroutine: null,
  262. mode: SelectPermanentEffect.Mode.Destroy,
  263. cardEffect: activateClass);
  264. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  265. }
  266. }
  267. }
  268. #endregion
  269. return cardEffects;
  270. }
  271. }
  272. }