BT20_042.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_042 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.EqualsCardName("Coredramon");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  18. digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. #endregion
  21. #region On Play/ When Digivolving Shared
  22. bool CanSelectPermanentConditionShared(Permanent permanent)
  23. {
  24. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  25. (permanent.IsDigimon || permanent.IsTamer);
  26. }
  27. bool CanActivateConditionShared(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  30. CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentConditionShared);
  31. }
  32. #endregion
  33. #region On Play
  34. if (timing == EffectTiming.OnEnterFieldAnyone)
  35. {
  36. ActivateClass activateClass = new ActivateClass();
  37. activateClass.SetUpICardEffect("Suspend 1 Digimon or Tamer and 1 Digimon or Tamer cannot unsuspend", CanUseCondition, card);
  38. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  39. cardEffects.Add(activateClass);
  40. string EffectDescription()
  41. {
  42. return
  43. "[On Play] Suspend 1 of your opponent's Digimon or Tamers. Then, 1 of their Digimon or Tamers can't unsuspend until the end of their turn.";
  44. }
  45. bool CanUseCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. Permanent selectedPermanent = null;
  52. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  53. selectPermanentEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: CanSelectPermanentConditionShared,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: 1,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. selectPermanentCoroutine: null,
  62. afterSelectPermanentCoroutine: null,
  63. mode: SelectPermanentEffect.Mode.Tap,
  64. cardEffect: activateClass);
  65. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  66. selectPermanentEffect.SetUp(
  67. selectPlayer: card.Owner,
  68. canTargetCondition: CanSelectPermanentConditionShared,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. maxCount: 1,
  72. canNoSelect: false,
  73. canEndNotMax: false,
  74. selectPermanentCoroutine: SelectPermanentCoroutine,
  75. afterSelectPermanentCoroutine: null,
  76. mode: SelectPermanentEffect.Mode.Custom,
  77. cardEffect: activateClass);
  78. selectPermanentEffect.SetUpCustomMessage(
  79. "Select 1 Digimon that will be unable to activate [When Digivolving] effects or unsuspend.",
  80. "The opponent is selecting 1 Digimon that will be unable to activate [When Digivolving] effects or unsuspend.");
  81. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  82. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  83. {
  84. selectedPermanent = permanent;
  85. yield return null;
  86. }
  87. if (selectedPermanent != null)
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  90. targetPermanent: selectedPermanent,
  91. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  92. activateClass: activateClass,
  93. condition: null,
  94. effectName: "Can't unsuspend"
  95. ));
  96. }
  97. }
  98. }
  99. #endregion
  100. #region When Digivolving
  101. if (timing == EffectTiming.OnEnterFieldAnyone)
  102. {
  103. ActivateClass activateClass = new ActivateClass();
  104. activateClass.SetUpICardEffect("Suspend 1 Digimon or Tamer and 1 Digimon or Tamer cannot unsuspend", CanUseCondition, card);
  105. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  106. cardEffects.Add(activateClass);
  107. string EffectDescription()
  108. {
  109. return
  110. "[When Digivolving] Suspend 1 of your opponent's Digimon or Tamers. Then, 1 of their Digimon or Tamers can't unsuspend until the end of their turn.";
  111. }
  112. bool CanUseCondition(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  115. }
  116. IEnumerator ActivateCoroutine(Hashtable hashtable)
  117. {
  118. Permanent selectedPermanent = null;
  119. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  120. selectPermanentEffect.SetUp(
  121. selectPlayer: card.Owner,
  122. canTargetCondition: CanSelectPermanentConditionShared,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. maxCount: 1,
  126. canNoSelect: false,
  127. canEndNotMax: false,
  128. selectPermanentCoroutine: null,
  129. afterSelectPermanentCoroutine: null,
  130. mode: SelectPermanentEffect.Mode.Tap,
  131. cardEffect: activateClass);
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. selectPermanentEffect.SetUp(
  134. selectPlayer: card.Owner,
  135. canTargetCondition: CanSelectPermanentConditionShared,
  136. canTargetCondition_ByPreSelecetedList: null,
  137. canEndSelectCondition: null,
  138. maxCount: 1,
  139. canNoSelect: false,
  140. canEndNotMax: false,
  141. selectPermanentCoroutine: SelectPermanentCoroutine,
  142. afterSelectPermanentCoroutine: null,
  143. mode: SelectPermanentEffect.Mode.Custom,
  144. cardEffect: activateClass);
  145. selectPermanentEffect.SetUpCustomMessage(
  146. "Select 1 Digimon that will be unable to activate [When Digivolving] effects or unsuspend.",
  147. "The opponent is selecting 1 Digimon that will be unable to activate [When Digivolving] effects or unsuspend.");
  148. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  149. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  150. {
  151. selectedPermanent = permanent;
  152. yield return null;
  153. }
  154. if (selectedPermanent != null)
  155. {
  156. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotUnsuspend(
  157. targetPermanent: selectedPermanent,
  158. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  159. activateClass: activateClass,
  160. condition: null,
  161. effectName: "Can't unsuspend"
  162. ));
  163. }
  164. }
  165. }
  166. #endregion
  167. #region All Turns
  168. if (timing == EffectTiming.None)
  169. {
  170. AddJogressLevelsClass addJogressLevelsClass = new AddJogressLevelsClass();
  171. addJogressLevelsClass.SetUpICardEffect("Also treated as level 6 for DNA Digivolution", CanUseCondition, card);
  172. addJogressLevelsClass.SetUpAddJogressLevelsClass(AddJogressLevels);
  173. cardEffects.Add(addJogressLevelsClass);
  174. bool CanUseCondition(Hashtable hashtable)
  175. {
  176. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  177. }
  178. List<int> AddJogressLevels(CardSource cardSource, Permanent permanent)
  179. {
  180. List<int> levels = new List<int>();
  181. if (permanent == card.PermanentOfThisCard())
  182. {
  183. if (cardSource != null)
  184. {
  185. if (cardSource.Owner == card.Owner)
  186. {
  187. if (cardSource.Owner.HandCards.Contains(cardSource))
  188. {
  189. if (cardSource.CardNames.Contains("Examon"))
  190. {
  191. levels.Add(6);
  192. }
  193. }
  194. }
  195. }
  196. }
  197. return levels;
  198. }
  199. }
  200. if (timing == EffectTiming.None)
  201. {
  202. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  203. changeCardNamesClass.SetUpICardEffect("Also treated as [Breakdramon]", CanUseCondition, card);
  204. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: ChangeCardNames);
  205. cardEffects.Add(changeCardNamesClass);
  206. bool CanUseCondition(Hashtable hashtable)
  207. {
  208. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  209. }
  210. List<string> ChangeCardNames(CardSource cardSource, List<string> cardNames)
  211. {
  212. if (cardSource == card)
  213. {
  214. cardNames.Add("Breakdramon");
  215. }
  216. return cardNames;
  217. }
  218. }
  219. #endregion
  220. #region All Turns - ESS
  221. if (timing == EffectTiming.OnEndBattle)
  222. {
  223. ActivateClass activateClass = new ActivateClass();
  224. activateClass.SetUpICardEffect("Trash the top card of opponent's security", CanUseCondition, card);
  225. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  226. activateClass.SetIsInheritedEffect(true);
  227. activateClass.SetHashString("TrashSecurity_BT20_042");
  228. cardEffects.Add(activateClass);
  229. string EffectDescription()
  230. {
  231. return
  232. "[All Turns] (Once Per Turn) When this Digimon deletes an opponent's Digimon in battle, trash the top card of your opponent's security stack.";
  233. }
  234. bool WinnerCondition(Permanent permanent) => permanent.cardSources.Contains(card);
  235. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  236. bool CanUseCondition(Hashtable hashtable)
  237. {
  238. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  239. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(hashtable: hashtable,
  240. winnerCondition: WinnerCondition, loserCondition: LoserCondition, isOnlyWinnerSurvive: false);
  241. }
  242. bool CanActivateCondition(Hashtable hashtable)
  243. {
  244. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  245. card.Owner.Enemy.SecurityCards.Count >= 1;
  246. }
  247. IEnumerator ActivateCoroutine(Hashtable hashtable)
  248. {
  249. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  250. player: card.Owner.Enemy,
  251. destroySecurityCount: 1,
  252. cardEffect: activateClass,
  253. fromTop: true).DestroySecurity());
  254. }
  255. }
  256. #endregion
  257. return cardEffects;
  258. }
  259. }
  260. }