EX6_024.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_024 : 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. "[Sanzomon] or [Gokuumon] 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("Sanzomon") ||
  39. xrosCardSource.EqualsCardNameDigiXros("Gokuumon") ||
  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 CanSelectSecMinusPermanentSharedCondition(Permanent permanent)
  59. {
  60. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  61. {
  62. if (permanent.IsDigimon)
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. #endregion
  70. #region On Play
  71. if (timing == EffectTiming.OnEnterFieldAnyone)
  72. {
  73. ActivateClass activateClass = new ActivateClass();
  74. activateClass.SetUpICardEffect(
  75. "1 Digimon may gain [Security Attack -1] until the end of your opponent's turn. Then, if DigiXrosing, 1 of your opponent's Digimon or Tamers can't suspend until the end of their turn.",
  76. CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  78. EffectDescription());
  79. activateClass.SetHashString("SecurityAttack-1CantSuspend_EX6-024");
  80. cardEffects.Add(activateClass);
  81. string EffectDescription()
  82. {
  83. return
  84. "[On Play] [Once Per Turn] 1 Digimon may gain [Security Attack -1] until the end of your opponent's turn. Then, if DigiXrosing, 1 of your opponent's Digimon or Tamers can't suspend until the end of their turn.";
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  89. }
  90. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  91. {
  92. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  93. {
  94. return permanent.IsDigimon || permanent.IsTamer;
  95. }
  96. return false;
  97. }
  98. bool CanActivateCondition(Hashtable hashtable)
  99. {
  100. if (CardEffectCommons.IsExistOnBattleArea(card))
  101. {
  102. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  103. {
  104. return true;
  105. }
  106. if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
  107. {
  108. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  109. {
  110. return true;
  111. }
  112. }
  113. }
  114. return false;
  115. }
  116. IEnumerator ActivateCoroutine(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  119. {
  120. int maxCount = Math.Min(1,
  121. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  122. SelectPermanentEffect selectPermanentEffect =
  123. GManager.instance.GetComponent<SelectPermanentEffect>();
  124. selectPermanentEffect.SetUp(
  125. selectPlayer: card.Owner,
  126. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  127. canTargetCondition_ByPreSelecetedList: null,
  128. canEndSelectCondition: null,
  129. maxCount: maxCount,
  130. canNoSelect: true,
  131. canEndNotMax: false,
  132. selectPermanentCoroutine: SelectPermanentCoroutine,
  133. afterSelectPermanentCoroutine: null,
  134. mode: SelectPermanentEffect.Mode.Custom,
  135. cardEffect: activateClass);
  136. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  137. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  138. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  139. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  140. {
  141. yield return ContinuousController.instance.StartCoroutine(
  142. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  143. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  144. }
  145. }
  146. if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
  147. {
  148. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectOpponentPermanentCondition))
  149. {
  150. int maxCount = Math.Min(1,
  151. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  152. SelectPermanentEffect selectPermanentEffect =
  153. GManager.instance.GetComponent<SelectPermanentEffect>();
  154. selectPermanentEffect.SetUp(
  155. selectPlayer: card.Owner,
  156. canTargetCondition_ByPreSelecetedList: null,
  157. canTargetCondition: CanSelectOpponentPermanentCondition,
  158. canEndSelectCondition: null,
  159. maxCount: maxCount,
  160. canNoSelect: false,
  161. canEndNotMax: false,
  162. selectPermanentCoroutine: SelectPermanentCoroutine,
  163. afterSelectPermanentCoroutine: null,
  164. mode: SelectPermanentEffect.Mode.Custom,
  165. cardEffect: activateClass);
  166. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon/Tamer that will be unable to suspend.",
  167. "The opponent is selecting 1 Digimon/Tamer that will be unable to suspend.");
  168. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  169. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  170. {
  171. Permanent selectedPermanent = permanent;
  172. if (selectedPermanent != null)
  173. {
  174. CanNotSuspendClass canNotSuspendClass = new CanNotSuspendClass();
  175. canNotSuspendClass.SetUpICardEffect("Can't Suspend", CanUseCanNotSuspendCondition, card);
  176. canNotSuspendClass.SetUpCanNotSuspendClass(PermanentCondition: PermanentCanNotSuspendCondition);
  177. selectedPermanent.UntilOwnerTurnEndEffects.Add(_ => canNotSuspendClass);
  178. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  179. {
  180. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(selectedPermanent));
  181. }
  182. bool CanUseCanNotSuspendCondition(Hashtable hashtableCanNotSuspend)
  183. {
  184. if (selectedPermanent.TopCard != null)
  185. {
  186. if (!selectedPermanent.TopCard.CanNotBeAffected(activateClass))
  187. {
  188. return true;
  189. }
  190. }
  191. return false;
  192. }
  193. bool PermanentCanNotSuspendCondition(Permanent permanentCanNotSuspend)
  194. {
  195. if (permanentCanNotSuspend == selectedPermanent)
  196. {
  197. return true;
  198. }
  199. return false;
  200. }
  201. }
  202. }
  203. }
  204. }
  205. }
  206. }
  207. #endregion
  208. #region When Attacking
  209. if (timing == EffectTiming.OnAllyAttack)
  210. {
  211. ActivateClass activateClass = new ActivateClass();
  212. activateClass.SetUpICardEffect(
  213. "1 Digimon may gain [Security Attack -1] until the end of your opponent's turn",
  214. CanUseCondition, card);
  215. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  216. EffectDescription());
  217. activateClass.SetHashString("SecurityAttack-1_EX6-024");
  218. cardEffects.Add(activateClass);
  219. string EffectDescription()
  220. {
  221. return
  222. "[When Attacking] [Once Per Turn] 1 Digimon may gain [Security Attack -1] until the end of your opponent's turn. Then, if DigiXrosing, 1 of your opponent's Digimon or Tamers can't suspend until the end of their turn.";
  223. }
  224. bool CanUseCondition(Hashtable hashtable)
  225. {
  226. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  227. }
  228. bool CanActivateCondition(Hashtable hashtable)
  229. {
  230. if (CardEffectCommons.IsExistOnBattleArea(card))
  231. {
  232. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  233. {
  234. return true;
  235. }
  236. }
  237. return false;
  238. }
  239. IEnumerator ActivateCoroutine(Hashtable hashtable)
  240. {
  241. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  242. {
  243. int maxCount = Math.Min(1,
  244. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  245. SelectPermanentEffect selectPermanentEffect =
  246. GManager.instance.GetComponent<SelectPermanentEffect>();
  247. selectPermanentEffect.SetUp(
  248. selectPlayer: card.Owner,
  249. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  250. canTargetCondition_ByPreSelecetedList: null,
  251. canEndSelectCondition: null,
  252. maxCount: maxCount,
  253. canNoSelect: true,
  254. canEndNotMax: false,
  255. selectPermanentCoroutine: SelectPermanentCoroutine,
  256. afterSelectPermanentCoroutine: null,
  257. mode: SelectPermanentEffect.Mode.Custom,
  258. cardEffect: activateClass);
  259. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  260. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  261. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  262. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  263. {
  264. yield return ContinuousController.instance.StartCoroutine(
  265. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  266. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  267. }
  268. }
  269. }
  270. }
  271. #endregion
  272. #region All Turns
  273. if (timing == EffectTiming.WhenRemoveField)
  274. {
  275. ActivateClass activateClass = new ActivateClass();
  276. activateClass.SetUpICardEffect(
  277. "Return 1 yellow Digimon card from this Digimon's digivolution cards to the hand",
  278. CanUseCondition, card);
  279. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  280. EffectDescription());
  281. activateClass.SetHashString("AllTurns_EX6_024");
  282. cardEffects.Add(activateClass);
  283. string EffectDescription()
  284. {
  285. return
  286. "[All Turns] When this Digimon would leave the battle area, return 1 yellow Digimon card from this Digimon's digivolution cards to the hand.";
  287. }
  288. bool CanSelectCardCondition(CardSource cardSource)
  289. {
  290. if (cardSource.IsDigimon)
  291. {
  292. if (cardSource.HasCardColor(CardColor.Yellow))
  293. {
  294. return true;
  295. }
  296. }
  297. return false;
  298. }
  299. bool CanUseCondition(Hashtable hashtable)
  300. {
  301. if (CardEffectCommons.IsExistOnBattleArea(card))
  302. {
  303. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  304. {
  305. return true;
  306. }
  307. }
  308. return false;
  309. }
  310. bool CanActivateCondition(Hashtable hashtable)
  311. {
  312. if (CardEffectCommons.IsExistOnBattleArea(card))
  313. {
  314. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  315. {
  316. return true;
  317. }
  318. }
  319. return false;
  320. }
  321. IEnumerator ActivateCoroutine(Hashtable hashtable)
  322. {
  323. if (CardEffectCommons.IsExistOnBattleArea(card))
  324. {
  325. Permanent cardPermanent = card.PermanentOfThisCard();
  326. if (cardPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  327. {
  328. int maxCount = Math.Min(1, cardPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  329. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  330. selectCardEffect.SetUp(
  331. canTargetCondition: CanSelectCardCondition,
  332. canTargetCondition_ByPreSelecetedList: null,
  333. canEndSelectCondition: null,
  334. canNoSelect: () => false,
  335. selectCardCoroutine: null,
  336. afterSelectCardCoroutine: null,
  337. message: "Select 1 card to return to hand.",
  338. maxCount: maxCount,
  339. canEndNotMax: false,
  340. isShowOpponent: true,
  341. mode: SelectCardEffect.Mode.AddHand,
  342. root: SelectCardEffect.Root.Custom,
  343. customRootCardList: cardPermanent.DigivolutionCards,
  344. canLookReverseCard: true,
  345. selectPlayer: card.Owner,
  346. cardEffect: activateClass);
  347. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  348. }
  349. }
  350. }
  351. }
  352. #endregion
  353. #region When Attacking - ESS
  354. if (timing == EffectTiming.OnAllyAttack)
  355. {
  356. ActivateClass activateClass = new ActivateClass();
  357. activateClass.SetUpICardEffect("Security Attack -1", CanUseCondition, card);
  358. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  359. EffectDescription());
  360. activateClass.SetIsInheritedEffect(true);
  361. activateClass.SetHashString("SecurityAttack-1_EX6-024");
  362. cardEffects.Add(activateClass);
  363. string EffectDescription()
  364. {
  365. return
  366. "[When Attacking][Once Per Turn] 1 Digimon may gain [Security Attack -1] until the end of your opponent's turn.";
  367. }
  368. bool CanUseCondition(Hashtable hashtable)
  369. {
  370. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  371. }
  372. bool CanActivateCondition(Hashtable hashtable)
  373. {
  374. if (CardEffectCommons.IsExistOnBattleArea(card))
  375. {
  376. return true;
  377. }
  378. return false;
  379. }
  380. IEnumerator ActivateCoroutine(Hashtable hashtable)
  381. {
  382. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  383. {
  384. int maxCount = Math.Min(1,
  385. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  386. SelectPermanentEffect selectPermanentEffect =
  387. GManager.instance.GetComponent<SelectPermanentEffect>();
  388. selectPermanentEffect.SetUp(
  389. selectPlayer: card.Owner,
  390. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  391. canTargetCondition_ByPreSelecetedList: null,
  392. canEndSelectCondition: null,
  393. maxCount: maxCount,
  394. canNoSelect: true,
  395. canEndNotMax: false,
  396. selectPermanentCoroutine: SelectPermanentCoroutine,
  397. afterSelectPermanentCoroutine: null,
  398. mode: SelectPermanentEffect.Mode.Custom,
  399. cardEffect: activateClass);
  400. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  401. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  402. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  403. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  404. {
  405. yield return ContinuousController.instance.StartCoroutine(
  406. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  407. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  408. }
  409. }
  410. }
  411. }
  412. #endregion
  413. return cardEffects;
  414. }
  415. }
  416. }