BT13_075.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT13
  5. {
  6. public class BT13_075 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Place 1 card from trash to digivolution cards so that opponent Digimon can't attack", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[On Play] By placing 1 Digimon card with the [X Antibody] or [Royal Knight] trait from your trash as this Digimon's bottom digivolution card, all of your opponent's play cost 10 or higher Digimon can't attack players until the end of their turn.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.IsDigimon)
  24. {
  25. if (cardSource.HasXAntibodyTraits)
  26. {
  27. return true;
  28. }
  29. if (cardSource.HasRoyalKnightTraits)
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanUseCondition(Hashtable hashtable)
  37. {
  38. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnBattleArea(card))
  43. {
  44. if (!card.PermanentOfThisCard().IsToken)
  45. {
  46. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  47. {
  48. return true;
  49. }
  50. }
  51. }
  52. return false;
  53. }
  54. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  55. {
  56. if (CardEffectCommons.IsExistOnBattleArea(card))
  57. {
  58. bool added = false;
  59. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  60. {
  61. List<CardSource> selectedCards = new List<CardSource>();
  62. int maxCount = 1;
  63. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  64. selectCardEffect.SetUp(
  65. canTargetCondition: CanSelectCardCondition,
  66. canTargetCondition_ByPreSelecetedList: null,
  67. canEndSelectCondition: null,
  68. canNoSelect: () => true,
  69. selectCardCoroutine: SelectCardCoroutine,
  70. afterSelectCardCoroutine: null,
  71. message: "Select 1 card to place on bottom of digivolution cards.",
  72. maxCount: maxCount,
  73. canEndNotMax: false,
  74. isShowOpponent: true,
  75. mode: SelectCardEffect.Mode.Custom,
  76. root: SelectCardEffect.Root.Trash,
  77. customRootCardList: null,
  78. canLookReverseCard: true,
  79. selectPlayer: card.Owner,
  80. cardEffect: activateClass);
  81. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  82. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  83. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  84. IEnumerator SelectCardCoroutine(CardSource cardSource)
  85. {
  86. selectedCards.Add(cardSource);
  87. yield return null;
  88. }
  89. if (selectedCards.Count >= 1)
  90. {
  91. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  92. added = true;
  93. }
  94. }
  95. if (added)
  96. {
  97. bool AttackerCondition(Permanent Attacker)
  98. {
  99. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(Attacker, card))
  100. {
  101. if (Attacker.TopCard.GetCostItself >= 10)
  102. {
  103. if (Attacker.TopCard.HasPlayCost)
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. return false;
  110. }
  111. bool DefenderCondition(Permanent Defender)
  112. {
  113. return Defender == null;
  114. }
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttackPlayerEffect(
  116. attackerCondition: AttackerCondition,
  117. defenderCondition: DefenderCondition,
  118. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  119. activateClass: activateClass,
  120. effectName: "Can't Attack"));
  121. }
  122. }
  123. }
  124. }
  125. if (timing == EffectTiming.OnEnterFieldAnyone)
  126. {
  127. ActivateClass activateClass = new ActivateClass();
  128. activateClass.SetUpICardEffect("Place 1 card from trash to digivolution cards so that opponent Digimon can't attack", CanUseCondition, card);
  129. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  130. cardEffects.Add(activateClass);
  131. string EffectDiscription()
  132. {
  133. return "[When Digivolving] By placing 1 Digimon card with the [X Antibody] or [Royal Knight] trait from your trash as this Digimon's bottom digivolution card, all of your opponent's play cost 10 or higher Digimon can't attack players until the end of their turn.";
  134. }
  135. bool CanSelectCardCondition(CardSource cardSource)
  136. {
  137. if (cardSource.IsDigimon)
  138. {
  139. if (cardSource.HasXAntibodyTraits)
  140. {
  141. return true;
  142. }
  143. if (cardSource.HasRoyalKnightTraits)
  144. {
  145. return true;
  146. }
  147. }
  148. return false;
  149. }
  150. bool CanUseCondition(Hashtable hashtable)
  151. {
  152. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  153. }
  154. bool CanActivateCondition(Hashtable hashtable)
  155. {
  156. if (CardEffectCommons.IsExistOnBattleArea(card))
  157. {
  158. if (!card.PermanentOfThisCard().IsToken)
  159. {
  160. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  161. {
  162. return true;
  163. }
  164. }
  165. }
  166. return false;
  167. }
  168. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  169. {
  170. if (CardEffectCommons.IsExistOnBattleArea(card))
  171. {
  172. bool added = false;
  173. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  174. {
  175. List<CardSource> selectedCards = new List<CardSource>();
  176. int maxCount = 1;
  177. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  178. selectCardEffect.SetUp(
  179. canTargetCondition: CanSelectCardCondition,
  180. canTargetCondition_ByPreSelecetedList: null,
  181. canEndSelectCondition: null,
  182. canNoSelect: () => true,
  183. selectCardCoroutine: SelectCardCoroutine,
  184. afterSelectCardCoroutine: null,
  185. message: "Select 1 card to place on bottom of digivolution cards.",
  186. maxCount: maxCount,
  187. canEndNotMax: false,
  188. isShowOpponent: true,
  189. mode: SelectCardEffect.Mode.Custom,
  190. root: SelectCardEffect.Root.Trash,
  191. customRootCardList: null,
  192. canLookReverseCard: true,
  193. selectPlayer: card.Owner,
  194. cardEffect: activateClass);
  195. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  196. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  197. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  198. IEnumerator SelectCardCoroutine(CardSource cardSource)
  199. {
  200. selectedCards.Add(cardSource);
  201. yield return null;
  202. }
  203. if (selectedCards.Count >= 1)
  204. {
  205. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  206. added = true;
  207. }
  208. }
  209. if (added)
  210. {
  211. bool AttackerCondition(Permanent Attacker)
  212. {
  213. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(Attacker, card))
  214. {
  215. if (Attacker.TopCard.GetCostItself >= 10)
  216. {
  217. if (Attacker.TopCard.HasPlayCost)
  218. {
  219. return true;
  220. }
  221. }
  222. }
  223. return false;
  224. }
  225. bool DefenderCondition(Permanent Defender)
  226. {
  227. return Defender == null;
  228. }
  229. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttackPlayerEffect(
  230. attackerCondition: AttackerCondition,
  231. defenderCondition: DefenderCondition,
  232. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  233. activateClass: activateClass,
  234. effectName: "Can't Attack"));
  235. }
  236. }
  237. }
  238. }
  239. if (timing == EffectTiming.WhenRemoveField)
  240. {
  241. ActivateClass activateClass = new ActivateClass();
  242. activateClass.SetUpICardEffect("Prevent this Digimon from leaving play", CanUseCondition, card);
  243. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  244. activateClass.SetHashString("Substitute_BT13_075");
  245. cardEffects.Add(activateClass);
  246. string EffectDiscription()
  247. {
  248. return "[All Turns][Once Per Turn] When an effect would remove this Digimon from the battle area, by returning 1 card with the [X Antibody] or [Royal Knight] trait from this Digimon's digivolution cards to the bottom of the deck, prevent that removal.";
  249. }
  250. bool CanSelectCardCondition(CardSource cardSource)
  251. {
  252. if (cardSource.Owner == card.Owner)
  253. {
  254. if (cardSource.HasXAntibodyTraits)
  255. {
  256. return true;
  257. }
  258. if (cardSource.HasRoyalKnightTraits)
  259. {
  260. return true;
  261. }
  262. }
  263. return false;
  264. }
  265. bool CanUseCondition(Hashtable hashtable)
  266. {
  267. if (CardEffectCommons.IsExistOnBattleArea(card))
  268. {
  269. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  270. {
  271. if (CardEffectCommons.IsByEffect(hashtable, null))
  272. {
  273. return true;
  274. }
  275. }
  276. }
  277. return false;
  278. }
  279. bool CanActivateCondition(Hashtable hashtable)
  280. {
  281. if (CardEffectCommons.IsExistOnBattleArea(card))
  282. {
  283. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  284. {
  285. return true;
  286. }
  287. }
  288. return false;
  289. }
  290. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  291. {
  292. if (CardEffectCommons.IsExistOnBattleArea(card))
  293. {
  294. Permanent selectedPermanent = card.PermanentOfThisCard();
  295. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  296. {
  297. List<CardSource> selectedCards = new List<CardSource>();
  298. int maxCount = 1;
  299. bool returnedToLibrary = false;
  300. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  301. selectCardEffect.SetUp(
  302. canTargetCondition: CanSelectCardCondition,
  303. canTargetCondition_ByPreSelecetedList: null,
  304. canEndSelectCondition: CanEndSelectCondition,
  305. canNoSelect: () => true,
  306. selectCardCoroutine: SelectCardCoroutine,
  307. afterSelectCardCoroutine: null,
  308. message: "Select 1 digivolution card to return to the bottom of deck.",
  309. maxCount: maxCount,
  310. canEndNotMax: false,
  311. isShowOpponent: true,
  312. mode: SelectCardEffect.Mode.Custom,
  313. root: SelectCardEffect.Root.Custom,
  314. customRootCardList: card.PermanentOfThisCard().DigivolutionCards,
  315. canLookReverseCard: true,
  316. selectPlayer: card.Owner,
  317. cardEffect: null);
  318. selectCardEffect.SetUpCustomMessage("Select 1 digivolution card to return to the bottom of deck.", "The opponent is selecting 1 digivolution card to return to the bottom of deck.");
  319. selectCardEffect.SetNotShowCard();
  320. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  321. bool CanEndSelectCondition(List<CardSource> cardSources)
  322. {
  323. if (CardEffectCommons.HasNoElement(cardSources))
  324. {
  325. return false;
  326. }
  327. return true;
  328. }
  329. IEnumerator SelectCardCoroutine(CardSource cardSource)
  330. {
  331. selectedCards.Add(cardSource);
  332. yield return null;
  333. }
  334. if (selectedCards.Count == 1)
  335. {
  336. yield return ContinuousController.instance.StartCoroutine(new ReturnToLibraryBottomDigivolutionCardsClass(card.PermanentOfThisCard(), selectedCards, CardEffectCommons.CardEffectHashtable(activateClass)).ReturnToLibraryBottomDigivolutionCards());
  337. returnedToLibrary = true;
  338. }
  339. if (returnedToLibrary)
  340. {
  341. selectedPermanent.willBeRemoveField = false;
  342. selectedPermanent.HideDeleteEffect();
  343. selectedPermanent.HideHandBounceEffect();
  344. selectedPermanent.HideDeckBounceEffect();
  345. selectedPermanent.HideWillRemoveFieldEffect();
  346. }
  347. }
  348. }
  349. }
  350. }
  351. return cardEffects;
  352. }
  353. }
  354. }