BT20_044.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Diagnostics;
  5. namespace DCGO.CardEffects.BT20
  6. {
  7. public class BT20_044 : 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.EqualsCardName("Groundramon") || targetPermanent.TopCard.EqualsCardName("Wingdramon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition,
  20. digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  21. }
  22. #endregion
  23. #region Blocker
  24. if (timing == EffectTiming.None)
  25. {
  26. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(
  27. isInheritedEffect: false,
  28. card: card,
  29. condition: null));
  30. }
  31. #endregion
  32. #region On Play/ When Digivolving Shared
  33. bool CanSelectOpponentPermanentConditionShared(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  36. (permanent.IsDigimon || permanent.IsTamer);
  37. }
  38. bool CanSelectOwnerPermanentConditionShared(Permanent permanent)
  39. {
  40. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  41. }
  42. bool CanActivateConditionShared(Hashtable hashtable)
  43. {
  44. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  45. (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentConditionShared) ||
  46. CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentConditionShared));
  47. }
  48. #endregion
  49. #region On Play
  50. if (timing == EffectTiming.OnEnterFieldAnyone)
  51. {
  52. ActivateClass activateClass = new ActivateClass();
  53. activateClass.SetUpICardEffect("Suspend 2 Digimon or Tamers and 1 of your Digimon can attack", CanUseCondition, card);
  54. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  55. cardEffects.Add(activateClass);
  56. string EffectDescription()
  57. {
  58. return
  59. "[On Play] Suspend 2 of your opponent's Digimon or Tamers. Then, 1 of your Digimon may attack.";
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  64. }
  65. IEnumerator ActivateCoroutine(Hashtable hashtable)
  66. {
  67. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentConditionShared))
  68. {
  69. int maxCount = Math.Min(2,
  70. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentConditionShared));
  71. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  72. selectPermanentEffect.SetUp(
  73. selectPlayer: card.Owner,
  74. canTargetCondition: CanSelectOpponentPermanentConditionShared,
  75. canTargetCondition_ByPreSelecetedList: null,
  76. canEndSelectCondition: null,
  77. maxCount: maxCount,
  78. canNoSelect: false,
  79. canEndNotMax: false,
  80. selectPermanentCoroutine: null,
  81. afterSelectPermanentCoroutine: null,
  82. mode: SelectPermanentEffect.Mode.Tap,
  83. cardEffect: activateClass);
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. }
  86. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentConditionShared))
  87. {
  88. Permanent selectedPermanent = null;
  89. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  90. selectPermanentEffect.SetUp(
  91. selectPlayer: card.Owner,
  92. canTargetCondition: CanSelectOwnerPermanentConditionShared,
  93. canTargetCondition_ByPreSelecetedList: null,
  94. canEndSelectCondition: null,
  95. maxCount: 1,
  96. canNoSelect: true,
  97. canEndNotMax: false,
  98. selectPermanentCoroutine: SelectPermanentCoroutine,
  99. afterSelectPermanentCoroutine: null,
  100. mode: SelectPermanentEffect.Mode.Custom,
  101. cardEffect: activateClass);
  102. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.",
  103. "The opponent is selecting 1 Digimon that will attack.");
  104. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  105. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  106. {
  107. selectedPermanent = permanent;
  108. yield return null;
  109. }
  110. if (selectedPermanent != null && selectedPermanent.CanAttack(activateClass))
  111. {
  112. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  113. selectAttackEffect.SetUp(
  114. attacker: selectedPermanent,
  115. canAttackPlayerCondition: () => true,
  116. defenderCondition: _ => true,
  117. cardEffect: activateClass);
  118. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  119. }
  120. }
  121. }
  122. }
  123. #endregion
  124. #region When Digivolving
  125. if (timing == EffectTiming.OnEnterFieldAnyone)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect("Suspend 2 Digimon or Tamers and 1 of your Digimon can attack", CanUseCondition, card);
  129. activateClass.SetUpActivateClass(CanActivateConditionShared, ActivateCoroutine, -1, false, EffectDescription());
  130. cardEffects.Add(activateClass);
  131. string EffectDescription()
  132. {
  133. return
  134. "[When Digivolving] Suspend 2 of your opponent's Digimon or Tamers. Then, 1 of your Digimon may attack.";
  135. }
  136. bool CanUseCondition(Hashtable hashtable)
  137. {
  138. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  139. }
  140. IEnumerator ActivateCoroutine(Hashtable hashtable)
  141. {
  142. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentConditionShared))
  143. {
  144. int maxCount = Math.Min(2,
  145. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentConditionShared));
  146. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  147. selectPermanentEffect.SetUp(
  148. selectPlayer: card.Owner,
  149. canTargetCondition: CanSelectOpponentPermanentConditionShared,
  150. canTargetCondition_ByPreSelecetedList: null,
  151. canEndSelectCondition: null,
  152. maxCount: maxCount,
  153. canNoSelect: false,
  154. canEndNotMax: false,
  155. selectPermanentCoroutine: null,
  156. afterSelectPermanentCoroutine: null,
  157. mode: SelectPermanentEffect.Mode.Tap,
  158. cardEffect: activateClass);
  159. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  160. }
  161. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentConditionShared))
  162. {
  163. Permanent selectedPermanent = null;
  164. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  165. selectPermanentEffect.SetUp(
  166. selectPlayer: card.Owner,
  167. canTargetCondition: CanSelectOwnerPermanentConditionShared,
  168. canTargetCondition_ByPreSelecetedList: null,
  169. canEndSelectCondition: null,
  170. maxCount: 1,
  171. canNoSelect: true,
  172. canEndNotMax: false,
  173. selectPermanentCoroutine: SelectPermanentCoroutine,
  174. afterSelectPermanentCoroutine: null,
  175. mode: SelectPermanentEffect.Mode.Custom,
  176. cardEffect: activateClass);
  177. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.",
  178. "The opponent is selecting 1 Digimon that will attack.");
  179. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  180. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  181. {
  182. selectedPermanent = permanent;
  183. yield return null;
  184. }
  185. if (selectedPermanent != null && selectedPermanent.CanAttack(activateClass))
  186. {
  187. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  188. selectAttackEffect.SetUp(
  189. attacker: selectedPermanent,
  190. canAttackPlayerCondition: () => true,
  191. defenderCondition: _ => true,
  192. cardEffect: activateClass);
  193. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  194. }
  195. }
  196. }
  197. }
  198. #endregion
  199. #region All Turns
  200. if (timing == EffectTiming.OnEndBattle)
  201. {
  202. ActivateClass activateClass = new ActivateClass();
  203. activateClass.SetUpICardEffect("Delete 1 of your opponent's suspended Digimon or Tamers", CanUseCondition, card);
  204. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  205. activateClass.SetHashString("Delete_BT20_044");
  206. cardEffects.Add(activateClass);
  207. string EffectDescription()
  208. {
  209. return
  210. "[All Turns] (Once Per Turn) When any of your Digimon with [Dracomon]/[Examon] in their texts delete 1 your opponent's Digimon in battle, delete 1 of their suspended Digimon or Tamers.";
  211. }
  212. bool CanUseCondition(Hashtable hashtable)
  213. {
  214. bool WinnerCondition(Permanent permanent) => PermanentCondition(permanent);
  215. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  216. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  217. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(
  218. hashtable: hashtable,
  219. winnerCondition: WinnerCondition,
  220. loserCondition: LoserCondition,
  221. isOnlyWinnerSurvive: false);
  222. }
  223. bool PermanentCondition(Permanent permanent)
  224. {
  225. return permanent.TopCard.Owner == card.Owner &&
  226. (permanent.TopCard.HasText("Dracomon") || permanent.TopCard.HasText("Examon"));
  227. }
  228. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  229. {
  230. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  231. (permanent.IsDigimon || permanent.IsTamer) &&
  232. permanent.IsSuspended;
  233. }
  234. bool CanActivateCondition(Hashtable hashtable)
  235. {
  236. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  237. CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition);
  238. }
  239. IEnumerator ActivateCoroutine(Hashtable hashtable)
  240. {
  241. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  242. selectPermanentEffect.SetUp(
  243. selectPlayer: card.Owner,
  244. canTargetCondition: CanSelectOpponentPermanentCondition,
  245. canTargetCondition_ByPreSelecetedList: null,
  246. canEndSelectCondition: null,
  247. maxCount: 1,
  248. canNoSelect: false,
  249. canEndNotMax: false,
  250. selectPermanentCoroutine: null,
  251. afterSelectPermanentCoroutine: null,
  252. mode: SelectPermanentEffect.Mode.Destroy,
  253. cardEffect: activateClass);
  254. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  255. }
  256. }
  257. #endregion
  258. #region All Turns - ESS
  259. if (timing == EffectTiming.OnEndBattle)
  260. {
  261. ActivateClass activateClass = new ActivateClass();
  262. activateClass.SetUpICardEffect("Delete 1 of your opponent's suspended Digimon or Tamers", CanUseCondition, card);
  263. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  264. activateClass.SetIsInheritedEffect(true);
  265. activateClass.SetHashString("Delete_ESS_BT20_044");
  266. cardEffects.Add(activateClass);
  267. string EffectDescription()
  268. {
  269. return
  270. "[All Turns] (Once Per Turn) When any of your Digimon with [Dracomon]/[Examon] in their texts delete 1 your opponent's Digimon in battle, delete 1 of their suspended Digimon or Tamers.";
  271. }
  272. bool CanUseCondition(Hashtable hashtable)
  273. {
  274. bool WinnerCondition(Permanent permanent) => PermanentCondition(permanent);
  275. bool LoserCondition(Permanent permanent) => CardEffectCommons.IsOpponentPermanent(permanent, card);
  276. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  277. CardEffectCommons.CanTriggerWhenDeleteOpponentDigimonByBattle(
  278. hashtable: hashtable,
  279. winnerCondition: WinnerCondition,
  280. loserCondition: LoserCondition,
  281. isOnlyWinnerSurvive: false);
  282. }
  283. bool PermanentCondition(Permanent permanent)
  284. {
  285. return permanent.TopCard.Owner == card.Owner &&
  286. (permanent.TopCard.HasText("Dracomon") || permanent.TopCard.HasText("Examon"));
  287. }
  288. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  289. {
  290. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card) &&
  291. (permanent.IsDigimon || permanent.IsTamer) &&
  292. permanent.IsSuspended;
  293. }
  294. bool CanActivateCondition(Hashtable hashtable)
  295. {
  296. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  297. CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition);
  298. }
  299. IEnumerator ActivateCoroutine(Hashtable hashtable)
  300. {
  301. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  302. selectPermanentEffect.SetUp(
  303. selectPlayer: card.Owner,
  304. canTargetCondition: CanSelectOpponentPermanentCondition,
  305. canTargetCondition_ByPreSelecetedList: null,
  306. canEndSelectCondition: null,
  307. maxCount: 1,
  308. canNoSelect: false,
  309. canEndNotMax: false,
  310. selectPermanentCoroutine: null,
  311. afterSelectPermanentCoroutine: null,
  312. mode: SelectPermanentEffect.Mode.Destroy,
  313. cardEffect: activateClass);
  314. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  315. }
  316. }
  317. #endregion
  318. return cardEffects;
  319. }
  320. }
  321. }