EX6_025.cs 22 KB

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