EX6_025.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. using System.Diagnostics;
  6. namespace DCGO.CardEffects.EX6
  7. {
  8. public class EX6_025 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region DigiXros
  14. if (timing == EffectTiming.None)
  15. {
  16. AddDigiXrosConditionClass addDigiXrosConditionClass = new AddDigiXrosConditionClass();
  17. addDigiXrosConditionClass.SetUpICardEffect($"DigiXros -2", CanUseCondition, card);
  18. addDigiXrosConditionClass.SetUpAddDigiXrosConditionClass(getDigiXrosCondition: GetDigiXros);
  19. addDigiXrosConditionClass.SetNotShowUI(true);
  20. cardEffects.Add(addDigiXrosConditionClass);
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return true;
  24. }
  25. DigiXrosCondition GetDigiXros(CardSource cardSource)
  26. {
  27. if (cardSource == card)
  28. {
  29. DigiXrosConditionElement element = new DigiXrosConditionElement(CanSelectCardCondition,
  30. "[Gokuumon] or [Sagomon] or [Cho-Hakkaimon]");
  31. bool CanSelectCardCondition(CardSource xrosCardSource)
  32. {
  33. if (xrosCardSource != null)
  34. {
  35. if (xrosCardSource.Owner == card.Owner)
  36. {
  37. if (xrosCardSource.IsDigimon)
  38. {
  39. if (xrosCardSource.ContainsCardName("Gokuumon") ||
  40. xrosCardSource.ContainsCardName("Sagomon") ||
  41. xrosCardSource.ContainsCardName("Cho-Hakkaimon"))
  42. {
  43. return true;
  44. }
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. List<DigiXrosConditionElement> elements = new List<DigiXrosConditionElement>() { element };
  51. DigiXrosCondition digiXrosCondition = new DigiXrosCondition(elements, null, 2);
  52. return digiXrosCondition;
  53. }
  54. return null;
  55. }
  56. }
  57. #endregion
  58. #region On Play/ When Attacking/ ESS Shared
  59. bool HasGokuumonInName(CardSource cardSource)
  60. {
  61. return cardSource.ContainsCardName("Gokuumon");
  62. }
  63. bool HasSagomonInName(CardSource cardSource)
  64. {
  65. return cardSource.ContainsCardName("Sagomon");
  66. }
  67. bool HasChoHakkaimonInName(CardSource cardSource)
  68. {
  69. return cardSource.ContainsCardName("Cho-Hakkaimon");
  70. }
  71. bool HasShakamonInName(CardSource cardSource)
  72. {
  73. return cardSource.ContainsCardName("Shakamon");
  74. }
  75. bool CanSelectSecMinusPermanentSharedCondition(Permanent permanent)
  76. {
  77. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  78. {
  79. if (permanent.IsDigimon)
  80. {
  81. return true;
  82. }
  83. }
  84. return false;
  85. }
  86. #endregion
  87. #region On Play
  88. if (timing == EffectTiming.OnEnterFieldAnyone)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect(
  92. "1 Digimon may gain [Security Attack -1] until the end of your opponent's turn. Then, if DigiXrosing, reveal the top 4 cards of your deck. Add 1 [Gokuumon], 1 [Sagomon], 1 [Cho-Hakkaimon] and 1 [Shakamon] among them to the hand. Return the rest to the bottom of the deck.",
  93. CanUseCondition, card);
  94. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  95. EffectDescription());
  96. activateClass.SetHashString("SecurityAttack-1Search_EX6-025");
  97. cardEffects.Add(activateClass);
  98. string EffectDescription()
  99. {
  100. return "[On Play] [Once Per Turn] 1 Digimon may gain [Security Attack -1] until the end of your opponent's turn. Then, if DigiXrosing, reveal the top 4 cards of your deck. Add 1 of each [Gokuumon], [Sagomon], [Cho-Hakkaimon] and [Shakamon] among them to the hand. Return the rest to the bottom of the deck.";
  101. }
  102. bool CanUseCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. if (CardEffectCommons.IsExistOnBattleArea(card))
  109. {
  110. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  111. {
  112. return true;
  113. }
  114. if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
  115. {
  116. if (card.Owner.LibraryCards.Count >= 1)
  117. {
  118. return true;
  119. }
  120. }
  121. }
  122. return false;
  123. }
  124. IEnumerator ActivateCoroutine(Hashtable hashtable)
  125. {
  126. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  127. {
  128. int maxCount = Math.Min(1,
  129. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  130. SelectPermanentEffect selectPermanentEffect =
  131. GManager.instance.GetComponent<SelectPermanentEffect>();
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: maxCount,
  138. canNoSelect: true,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: SelectPermanentCoroutine,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.Custom,
  143. cardEffect: activateClass);
  144. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  145. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  146. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  147. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  148. {
  149. yield return ContinuousController.instance.StartCoroutine(
  150. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  151. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  152. }
  153. }
  154. if (CardEffectCommons.IsDijiXros(hashtable, count => count >= 1))
  155. {
  156. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.RevealDeckTopCardsAndSelect(
  157. revealCount: 4,
  158. selectCardConditions:
  159. new SelectCardConditionClass[]
  160. {
  161. new SelectCardConditionClass(
  162. canTargetCondition:HasGokuumonInName,
  163. canTargetCondition_ByPreSelecetedList:null,
  164. canEndSelectCondition:null,
  165. canNoSelect:false,
  166. selectCardCoroutine: null,
  167. message: "Select 1 card with [Gokuumon] in its name.",
  168. maxCount: 1,
  169. canEndNotMax:false,
  170. mode: SelectCardEffect.Mode.AddHand
  171. ),
  172. new SelectCardConditionClass(
  173. canTargetCondition:HasSagomonInName,
  174. canTargetCondition_ByPreSelecetedList:null,
  175. canEndSelectCondition:null,
  176. canNoSelect:false,
  177. selectCardCoroutine: null,
  178. message: "Select 1 card with [Sagomon] in its name.",
  179. maxCount: 1,
  180. canEndNotMax:false,
  181. mode: SelectCardEffect.Mode.AddHand
  182. ),
  183. new SelectCardConditionClass(
  184. canTargetCondition:HasChoHakkaimonInName,
  185. canTargetCondition_ByPreSelecetedList:null,
  186. canEndSelectCondition:null,
  187. canNoSelect:false,
  188. selectCardCoroutine: null,
  189. message: "Select 1 card with [Cho-Hakkaimon] in its name.",
  190. maxCount: 1,
  191. canEndNotMax:false,
  192. mode: SelectCardEffect.Mode.AddHand
  193. ),
  194. new SelectCardConditionClass(
  195. canTargetCondition:HasShakamonInName,
  196. canTargetCondition_ByPreSelecetedList:null,
  197. canEndSelectCondition:null,
  198. canNoSelect:false,
  199. selectCardCoroutine: null,
  200. message: "Select 1 card with [Shakamon] in its name.",
  201. maxCount: 1,
  202. canEndNotMax:false,
  203. mode: SelectCardEffect.Mode.AddHand
  204. ),
  205. },
  206. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  207. activateClass: activateClass,
  208. canNoAction: false
  209. ));
  210. }
  211. }
  212. }
  213. #endregion
  214. #region When Attacking
  215. if (timing == EffectTiming.OnAllyAttack)
  216. {
  217. ActivateClass activateClass = new ActivateClass();
  218. activateClass.SetUpICardEffect(
  219. "1 Digimon may gain [Security Attack -1] until the end of your opponent's turn",
  220. CanUseCondition, card);
  221. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  222. EffectDescription());
  223. activateClass.SetHashString("SecurityAttack-1_EX6-025");
  224. cardEffects.Add(activateClass);
  225. string EffectDescription()
  226. {
  227. return "[When Attacking] [Once Per Turn] 1 Digimon may gain [Security Attack -1] until the end of your opponent's turn. Then, if DigiXrosing, reveal the top 4 cards of your deck. Add 1 of each [Gokuumon], [Sagomon], [Cho-Hakkaimon] and [Shakamon] among them to the hand. Return the rest to the bottom of the deck.";
  228. }
  229. bool CanUseCondition(Hashtable hashtable)
  230. {
  231. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  232. }
  233. bool CanActivateCondition(Hashtable hashtable)
  234. {
  235. if (CardEffectCommons.IsExistOnBattleArea(card))
  236. {
  237. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  238. {
  239. return true;
  240. }
  241. }
  242. return false;
  243. }
  244. IEnumerator ActivateCoroutine(Hashtable hashtable)
  245. {
  246. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  247. {
  248. int maxCount = Math.Min(1,
  249. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  250. SelectPermanentEffect selectPermanentEffect =
  251. GManager.instance.GetComponent<SelectPermanentEffect>();
  252. selectPermanentEffect.SetUp(
  253. selectPlayer: card.Owner,
  254. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  255. canTargetCondition_ByPreSelecetedList: null,
  256. canEndSelectCondition: null,
  257. maxCount: maxCount,
  258. canNoSelect: true,
  259. canEndNotMax: false,
  260. selectPermanentCoroutine: SelectPermanentCoroutine,
  261. afterSelectPermanentCoroutine: null,
  262. mode: SelectPermanentEffect.Mode.Custom,
  263. cardEffect: activateClass);
  264. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  265. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  266. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  267. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  268. {
  269. yield return ContinuousController.instance.StartCoroutine(
  270. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  271. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  272. }
  273. }
  274. }
  275. }
  276. #endregion
  277. #region All Turns
  278. if (timing == EffectTiming.WhenRemoveField)
  279. {
  280. ActivateClass activateClass = new ActivateClass();
  281. activateClass.SetUpICardEffect(
  282. "Return 1 yellow Digimon card from this Digimon's digivolution cards to the hand",
  283. CanUseCondition, card);
  284. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  285. EffectDescription());
  286. activateClass.SetHashString("AllTurns_EX6_025");
  287. cardEffects.Add(activateClass);
  288. string EffectDescription()
  289. {
  290. return
  291. "[All Turns] When this Digimon would leave the battle area, return 1 yellow Digimon card from this Digimon's digivolution cards to the hand.";
  292. }
  293. bool CanSelectCardCondition(CardSource cardSource)
  294. {
  295. if (cardSource.IsDigimon)
  296. {
  297. if (cardSource.HasCardColor(CardColor.Yellow))
  298. {
  299. return true;
  300. }
  301. }
  302. return false;
  303. }
  304. bool CanUseCondition(Hashtable hashtable)
  305. {
  306. if (CardEffectCommons.IsExistOnBattleArea(card))
  307. {
  308. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  309. {
  310. return true;
  311. }
  312. }
  313. return false;
  314. }
  315. bool CanActivateCondition(Hashtable hashtable)
  316. {
  317. if (CardEffectCommons.IsExistOnBattleArea(card))
  318. {
  319. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  320. {
  321. return true;
  322. }
  323. }
  324. return false;
  325. }
  326. IEnumerator ActivateCoroutine(Hashtable hashtable)
  327. {
  328. if (CardEffectCommons.IsExistOnBattleArea(card))
  329. {
  330. Permanent cardPermanent = card.PermanentOfThisCard();
  331. if (cardPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  332. {
  333. int maxCount = Math.Min(1, cardPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  334. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  335. selectCardEffect.SetUp(
  336. canTargetCondition: CanSelectCardCondition,
  337. canTargetCondition_ByPreSelecetedList: null,
  338. canEndSelectCondition: null,
  339. canNoSelect: () => false,
  340. selectCardCoroutine: null,
  341. afterSelectCardCoroutine: null,
  342. message: "Select 1 card to return to hand.",
  343. maxCount: maxCount,
  344. canEndNotMax: false,
  345. isShowOpponent: true,
  346. mode: SelectCardEffect.Mode.AddHand,
  347. root: SelectCardEffect.Root.Custom,
  348. customRootCardList: cardPermanent.DigivolutionCards,
  349. canLookReverseCard: true,
  350. selectPlayer: card.Owner,
  351. cardEffect: activateClass);
  352. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  353. }
  354. }
  355. }
  356. }
  357. #endregion
  358. #region When Attacking - ESS
  359. if (timing == EffectTiming.OnAllyAttack)
  360. {
  361. ActivateClass activateClass = new ActivateClass();
  362. activateClass.SetUpICardEffect("Security Attack -1", CanUseCondition, card);
  363. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  364. EffectDescription());
  365. activateClass.SetIsInheritedEffect(true);
  366. activateClass.SetHashString("SecurityAttack-1_EX6-025");
  367. cardEffects.Add(activateClass);
  368. string EffectDescription()
  369. {
  370. return
  371. "[When Attacking][Once Per Turn] 1 Digimon may gain [Security Attack -1] until the end of your opponent's turn.";
  372. }
  373. bool CanUseCondition(Hashtable hashtable)
  374. {
  375. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  376. }
  377. bool CanActivateCondition(Hashtable hashtable)
  378. {
  379. if (CardEffectCommons.IsExistOnBattleArea(card))
  380. {
  381. return true;
  382. }
  383. return false;
  384. }
  385. IEnumerator ActivateCoroutine(Hashtable hashtable)
  386. {
  387. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  388. {
  389. int maxCount = Math.Min(1,
  390. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  391. SelectPermanentEffect selectPermanentEffect =
  392. GManager.instance.GetComponent<SelectPermanentEffect>();
  393. selectPermanentEffect.SetUp(
  394. selectPlayer: card.Owner,
  395. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  396. canTargetCondition_ByPreSelecetedList: null,
  397. canEndSelectCondition: null,
  398. maxCount: maxCount,
  399. canNoSelect: true,
  400. canEndNotMax: false,
  401. selectPermanentCoroutine: SelectPermanentCoroutine,
  402. afterSelectPermanentCoroutine: null,
  403. mode: SelectPermanentEffect.Mode.Custom,
  404. cardEffect: activateClass);
  405. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  406. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  407. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  408. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  409. {
  410. yield return ContinuousController.instance.StartCoroutine(
  411. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  412. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  413. }
  414. }
  415. }
  416. }
  417. #endregion
  418. return cardEffects;
  419. }
  420. }
  421. }