BT21_044.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT21
  6. {
  7. public class BT21_044 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternative Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("GeoGreymon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. #endregion
  22. #region On Play
  23. if (timing == EffectTiming.OnEnterFieldAnyone)
  24. {
  25. ActivateClass activateClass = new ActivateClass();
  26. activateClass.SetUpICardEffect("[Marcus Damon] becomes a Digimon", CanUseCondition, card);
  27. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  28. cardEffects.Add(activateClass);
  29. string EffectDiscription()
  30. {
  31. return "[On Play] For the turn, 1 of your [Marcus Damon]s is also treated as a 3000 DP Digimon, can't digivolve, and gains <Rush> and <Alliance>. Then, 1 of your Digimon may attack.";
  32. }
  33. bool CanSelectPermanentCondition(Permanent permanent)
  34. {
  35. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  36. {
  37. if (permanent.TopCard.EqualsCardName("Marcus Damon"))
  38. {
  39. return true;
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  47. }
  48. bool CanSelectOwnerPermanentCondition(Permanent permanent)
  49. {
  50. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  51. }
  52. bool CanActivateCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  59. {
  60. int maxCount = Math.Min(1, card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  61. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  62. selectPermanentEffect1.SetUp(
  63. selectPlayer: card.Owner,
  64. canTargetCondition: CanSelectPermanentCondition,
  65. canTargetCondition_ByPreSelecetedList: null,
  66. canEndSelectCondition: null,
  67. maxCount: maxCount,
  68. canNoSelect: false,
  69. canEndNotMax: false,
  70. selectPermanentCoroutine: SelectPermanentCoroutine1,
  71. afterSelectPermanentCoroutine: null,
  72. mode: SelectPermanentEffect.Mode.Custom,
  73. cardEffect: activateClass);
  74. selectPermanentEffect1.SetUpCustomMessage("Select 1 [Marcus Damon].", "The opponent is selecting 1 [Marcus Damon].");
  75. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  76. IEnumerator SelectPermanentCoroutine1(Permanent selectedPermanent)
  77. {
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BecomeDigimonThatCantDigivolve(targetPermanent: selectedPermanent, DP: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  79. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  80. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  81. }
  82. }
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentCondition))
  84. {
  85. Permanent selectedPermanent = null;
  86. SelectPermanentEffect selectPermanentEffect2 = GManager.instance.GetComponent<SelectPermanentEffect>();
  87. selectPermanentEffect2.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectOwnerPermanentCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: 1,
  93. canNoSelect: true,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: SelectPermanentCoroutine2,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Custom,
  98. cardEffect: activateClass);
  99. selectPermanentEffect2.SetUpCustomMessage("Select 1 Digimon that will attack.",
  100. "The opponent is selecting 1 Digimon that will attack.");
  101. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect2.Activate());
  102. IEnumerator SelectPermanentCoroutine2(Permanent permanent)
  103. {
  104. selectedPermanent = permanent;
  105. yield return null;
  106. }
  107. if (selectedPermanent != null && selectedPermanent.CanAttack(activateClass))
  108. {
  109. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  110. selectAttackEffect.SetUp(
  111. attacker: selectedPermanent,
  112. canAttackPlayerCondition: () => true,
  113. defenderCondition: _ => true,
  114. cardEffect: activateClass);
  115. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  116. }
  117. }
  118. }
  119. }
  120. #endregion
  121. #region When Digivolving
  122. if (timing == EffectTiming.OnEnterFieldAnyone)
  123. {
  124. ActivateClass activateClass = new ActivateClass();
  125. activateClass.SetUpICardEffect("[Marcus Damon] becomes a Digimon", CanUseCondition, card);
  126. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  127. cardEffects.Add(activateClass);
  128. string EffectDiscription()
  129. {
  130. return "[When Digivolving] For the turn, 1 of your [Marcus Damon]s is also treated as a 3000 DP Digimon, can't digivolve, and gains <Rush> and <Alliance>. Then, 1 of your Digimon may attack.";
  131. }
  132. bool CanSelectPermanentCondition(Permanent permanent)
  133. {
  134. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  135. {
  136. if (permanent.TopCard.EqualsCardName("Marcus Damon"))
  137. {
  138. return true;
  139. }
  140. }
  141. return false;
  142. }
  143. bool CanUseCondition(Hashtable hashtable)
  144. {
  145. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) && CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  146. }
  147. bool CanSelectOwnerPermanentCondition(Permanent permanent)
  148. {
  149. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  150. }
  151. bool CanActivateCondition(Hashtable hashtable)
  152. {
  153. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  154. }
  155. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  156. {
  157. if (card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition) >= 1)
  158. {
  159. int maxCount = Math.Min(1, card.Owner.GetBattleAreaPermanents().Count(CanSelectPermanentCondition));
  160. SelectPermanentEffect selectPermanentEffect1 = GManager.instance.GetComponent<SelectPermanentEffect>();
  161. selectPermanentEffect1.SetUp(
  162. selectPlayer: card.Owner,
  163. canTargetCondition: CanSelectPermanentCondition,
  164. canTargetCondition_ByPreSelecetedList: null,
  165. canEndSelectCondition: null,
  166. maxCount: maxCount,
  167. canNoSelect: false,
  168. canEndNotMax: false,
  169. selectPermanentCoroutine: SelectPermanentCoroutine1,
  170. afterSelectPermanentCoroutine: null,
  171. mode: SelectPermanentEffect.Mode.Custom,
  172. cardEffect: activateClass);
  173. selectPermanentEffect1.SetUpCustomMessage("Select 1 [Marcus Damon].", "The opponent is selecting 1 [Marcus Damon].");
  174. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect1.Activate());
  175. IEnumerator SelectPermanentCoroutine1(Permanent selectedPermanent)
  176. {
  177. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BecomeDigimonThatCantDigivolve(targetPermanent: selectedPermanent, DP: 3000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  178. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  179. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainAlliance(targetPermanent: selectedPermanent, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  180. }
  181. }
  182. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentCondition))
  183. {
  184. Permanent selectedPermanent = null;
  185. SelectPermanentEffect selectPermanentEffect2 = GManager.instance.GetComponent<SelectPermanentEffect>();
  186. selectPermanentEffect2.SetUp(
  187. selectPlayer: card.Owner,
  188. canTargetCondition: CanSelectOwnerPermanentCondition,
  189. canTargetCondition_ByPreSelecetedList: null,
  190. canEndSelectCondition: null,
  191. maxCount: 1,
  192. canNoSelect: true,
  193. canEndNotMax: false,
  194. selectPermanentCoroutine: SelectPermanentCoroutine2,
  195. afterSelectPermanentCoroutine: null,
  196. mode: SelectPermanentEffect.Mode.Custom,
  197. cardEffect: activateClass);
  198. selectPermanentEffect2.SetUpCustomMessage("Select 1 Digimon that will attack.",
  199. "The opponent is selecting 1 Digimon that will attack.");
  200. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect2.Activate());
  201. IEnumerator SelectPermanentCoroutine2(Permanent permanent)
  202. {
  203. selectedPermanent = permanent;
  204. yield return null;
  205. }
  206. if (selectedPermanent != null && selectedPermanent.CanAttack(activateClass))
  207. {
  208. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  209. selectAttackEffect.SetUp(
  210. attacker: selectedPermanent,
  211. canAttackPlayerCondition: () => true,
  212. defenderCondition: _ => true,
  213. cardEffect: activateClass);
  214. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  215. }
  216. }
  217. }
  218. }
  219. #endregion
  220. #region All Turns
  221. if (timing == EffectTiming.OnDestroyedAnyone)
  222. {
  223. ActivateClass activateClass = new ActivateClass();
  224. activateClass.SetUpICardEffect("Place 1 [Marcus Damon] on the top of security from trash", CanUseCondition, card);
  225. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  226. activateClass.SetHashString("AddSecurity_BT21_044");
  227. cardEffects.Add(activateClass);
  228. string EffectDiscription()
  229. {
  230. return "[All Turns][Once Per Turn] When any of your yellow or red Tamers are deleted, you may place 1 [Marcus Damon] from your trash as the top security card.";
  231. }
  232. bool CanSelectCardCondition(CardSource cardSource)
  233. {
  234. if (cardSource.EqualsCardName("Marcus Damon"))
  235. {
  236. return true;
  237. }
  238. return false;
  239. }
  240. bool PermanentCondition(Permanent permanent)
  241. {
  242. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  243. {
  244. if (permanent.IsTamer)
  245. {
  246. return true;
  247. }
  248. }
  249. return false;
  250. }
  251. bool CanUseCondition(Hashtable hashtable)
  252. {
  253. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  254. {
  255. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
  256. {
  257. return true;
  258. }
  259. }
  260. return false;
  261. }
  262. bool CanActivateCondition(Hashtable hashtable)
  263. {
  264. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  265. {
  266. return true;
  267. }
  268. return false;
  269. }
  270. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  271. {
  272. if (card.Owner.CanAddSecurity(activateClass))
  273. {
  274. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  275. {
  276. int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  277. List<CardSource> selectedCards = new List<CardSource>();
  278. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  279. selectCardEffect.SetUp(
  280. canTargetCondition: CanSelectCardCondition,
  281. canTargetCondition_ByPreSelecetedList: null,
  282. canEndSelectCondition: null,
  283. canNoSelect: () => false,
  284. selectCardCoroutine: SelectCardCoroutine,
  285. afterSelectCardCoroutine: null,
  286. message: "Select 1 [Marcus Damon] to add to security.",
  287. maxCount: maxCount,
  288. canEndNotMax: false,
  289. isShowOpponent: true,
  290. mode: SelectCardEffect.Mode.Custom,
  291. root: SelectCardEffect.Root.Trash,
  292. customRootCardList: null,
  293. canLookReverseCard: true,
  294. selectPlayer: card.Owner,
  295. cardEffect: activateClass);
  296. selectCardEffect.SetUpCustomMessage("Select 1 card to add to security.", "The opponent is selecting 1 card to add to security.");
  297. selectCardEffect.SetUpCustomMessage_ShowCard("Security Card");
  298. yield return StartCoroutine(selectCardEffect.Activate());
  299. IEnumerator SelectCardCoroutine(CardSource cardSource)
  300. {
  301. selectedCards.Add(cardSource);
  302. yield return null;
  303. }
  304. if (selectedCards.Count >= 1)
  305. {
  306. foreach (CardSource selectedCard in selectedCards)
  307. {
  308. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(selectedCard));
  309. }
  310. }
  311. }
  312. }
  313. }
  314. }
  315. #endregion
  316. #region Inherit
  317. if (timing == EffectTiming.OnDestroyedAnyone)
  318. {
  319. ActivateClass activateClass = new ActivateClass();
  320. activateClass.SetUpICardEffect("Place 1 [Marcus Damon] on the top of security from trash", CanUseCondition, card);
  321. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  322. activateClass.SetIsInheritedEffect(true);
  323. activateClass.SetHashString("ESSAddSecurity_BT21_044");
  324. cardEffects.Add(activateClass);
  325. string EffectDiscription()
  326. {
  327. return "[All Turns][Once Per Turn] When any of your yellow or red Tamers are deleted, you may place 1 [Marcus Damon] from your trash as the top security card.";
  328. }
  329. bool CanSelectCardCondition(CardSource cardSource)
  330. {
  331. if (cardSource.EqualsCardName("Marcus Damon"))
  332. {
  333. return true;
  334. }
  335. return false;
  336. }
  337. bool PermanentCondition(Permanent permanent)
  338. {
  339. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  340. {
  341. if (permanent.IsTamer)
  342. {
  343. return true;
  344. }
  345. }
  346. return false;
  347. }
  348. bool CanUseCondition(Hashtable hashtable)
  349. {
  350. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  351. {
  352. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
  353. {
  354. return true;
  355. }
  356. }
  357. return false;
  358. }
  359. bool CanActivateCondition(Hashtable hashtable)
  360. {
  361. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  362. {
  363. return true;
  364. }
  365. return false;
  366. }
  367. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  368. {
  369. if (card.Owner.CanAddSecurity(activateClass))
  370. {
  371. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  372. {
  373. int maxCount = Math.Min(1, card.Owner.TrashCards.Count((cardSource) => CanSelectCardCondition(cardSource)));
  374. List<CardSource> selectedCards = new List<CardSource>();
  375. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  376. selectCardEffect.SetUp(
  377. canTargetCondition: CanSelectCardCondition,
  378. canTargetCondition_ByPreSelecetedList: null,
  379. canEndSelectCondition: null,
  380. canNoSelect: () => false,
  381. selectCardCoroutine: SelectCardCoroutine,
  382. afterSelectCardCoroutine: null,
  383. message: "Select 1 [Marcus Damon] to add to security.",
  384. maxCount: maxCount,
  385. canEndNotMax: false,
  386. isShowOpponent: true,
  387. mode: SelectCardEffect.Mode.Custom,
  388. root: SelectCardEffect.Root.Trash,
  389. customRootCardList: null,
  390. canLookReverseCard: true,
  391. selectPlayer: card.Owner,
  392. cardEffect: activateClass);
  393. selectCardEffect.SetUpCustomMessage("Select 1 card to add to security.", "The opponent is selecting 1 card to add to security.");
  394. selectCardEffect.SetUpCustomMessage_ShowCard("Security Card");
  395. yield return StartCoroutine(selectCardEffect.Activate());
  396. IEnumerator SelectCardCoroutine(CardSource cardSource)
  397. {
  398. selectedCards.Add(cardSource);
  399. yield return null;
  400. }
  401. if (selectedCards.Count >= 1)
  402. {
  403. foreach (CardSource selectedCard in selectedCards)
  404. {
  405. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddSecurityCard(selectedCard));
  406. }
  407. }
  408. }
  409. }
  410. }
  411. }
  412. #endregion
  413. return cardEffects;
  414. }
  415. }
  416. }