EX6_024.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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.ContainsCardName("Sanzomon") ||
  39. xrosCardSource.ContainsCardName("Gokuumon") ||
  40. xrosCardSource.ContainsCardName("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, 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, 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 CanSelectOpponentPermanentCondition(Permanent permanent)
  229. {
  230. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  231. {
  232. return permanent.IsDigimon || permanent.IsTamer;
  233. }
  234. return false;
  235. }
  236. bool CanActivateCondition(Hashtable hashtable)
  237. {
  238. if (CardEffectCommons.IsExistOnBattleArea(card))
  239. {
  240. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  241. {
  242. return true;
  243. }
  244. }
  245. return false;
  246. }
  247. IEnumerator ActivateCoroutine(Hashtable hashtable)
  248. {
  249. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  250. {
  251. int maxCount = Math.Min(1,
  252. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  253. SelectPermanentEffect selectPermanentEffect =
  254. GManager.instance.GetComponent<SelectPermanentEffect>();
  255. selectPermanentEffect.SetUp(
  256. selectPlayer: card.Owner,
  257. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  258. canTargetCondition_ByPreSelecetedList: null,
  259. canEndSelectCondition: null,
  260. maxCount: maxCount,
  261. canNoSelect: true,
  262. canEndNotMax: false,
  263. selectPermanentCoroutine: SelectPermanentCoroutine,
  264. afterSelectPermanentCoroutine: null,
  265. mode: SelectPermanentEffect.Mode.Custom,
  266. cardEffect: activateClass);
  267. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  268. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  269. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  270. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  271. {
  272. yield return ContinuousController.instance.StartCoroutine(
  273. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  274. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  275. }
  276. }
  277. }
  278. }
  279. #endregion
  280. #region All Turns
  281. if (timing == EffectTiming.WhenRemoveField)
  282. {
  283. ActivateClass activateClass = new ActivateClass();
  284. activateClass.SetUpICardEffect(
  285. "Return 1 yellow Digimon card from this Digimon's digivolution cards to the hand",
  286. CanUseCondition, card);
  287. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  288. EffectDescription());
  289. activateClass.SetHashString("AllTurns_EX6_024");
  290. cardEffects.Add(activateClass);
  291. string EffectDescription()
  292. {
  293. return
  294. "[All Turns] When this Digimon would leave the battle area, return 1 yellow Digimon card from this Digimon's digivolution cards to the hand.";
  295. }
  296. bool CanSelectCardCondition(CardSource cardSource)
  297. {
  298. if (cardSource.IsDigimon)
  299. {
  300. if (cardSource.HasCardColor(CardColor.Yellow))
  301. {
  302. return true;
  303. }
  304. }
  305. return false;
  306. }
  307. bool CanUseCondition(Hashtable hashtable)
  308. {
  309. if (CardEffectCommons.IsExistOnBattleArea(card))
  310. {
  311. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  312. {
  313. return true;
  314. }
  315. }
  316. return false;
  317. }
  318. bool CanActivateCondition(Hashtable hashtable)
  319. {
  320. if (CardEffectCommons.IsExistOnBattleArea(card))
  321. {
  322. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  323. {
  324. return true;
  325. }
  326. }
  327. return false;
  328. }
  329. IEnumerator ActivateCoroutine(Hashtable hashtable)
  330. {
  331. if (CardEffectCommons.IsExistOnBattleArea(card))
  332. {
  333. Permanent cardPermanent = card.PermanentOfThisCard();
  334. if (cardPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  335. {
  336. int maxCount = Math.Min(1, cardPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  337. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  338. selectCardEffect.SetUp(
  339. canTargetCondition: CanSelectCardCondition,
  340. canTargetCondition_ByPreSelecetedList: null,
  341. canEndSelectCondition: null,
  342. canNoSelect: () => false,
  343. selectCardCoroutine: null,
  344. afterSelectCardCoroutine: null,
  345. message: "Select 1 card to return to hand.",
  346. maxCount: maxCount,
  347. canEndNotMax: false,
  348. isShowOpponent: true,
  349. mode: SelectCardEffect.Mode.AddHand,
  350. root: SelectCardEffect.Root.Custom,
  351. customRootCardList: cardPermanent.DigivolutionCards,
  352. canLookReverseCard: true,
  353. selectPlayer: card.Owner,
  354. cardEffect: activateClass);
  355. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  356. }
  357. }
  358. }
  359. }
  360. #endregion
  361. #region When Attacking - ESS
  362. if (timing == EffectTiming.OnAllyAttack)
  363. {
  364. ActivateClass activateClass = new ActivateClass();
  365. activateClass.SetUpICardEffect("Security Attack -1", CanUseCondition, card);
  366. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  367. EffectDescription());
  368. activateClass.SetIsInheritedEffect(true);
  369. activateClass.SetHashString("SecurityAttack-1_EX6-024");
  370. cardEffects.Add(activateClass);
  371. string EffectDescription()
  372. {
  373. return
  374. "[When Attacking][Once Per Turn] 1 Digimon may gain [Security Attack -1] until the end of your opponent's turn.";
  375. }
  376. bool CanUseCondition(Hashtable hashtable)
  377. {
  378. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  379. }
  380. bool CanActivateCondition(Hashtable hashtable)
  381. {
  382. if (CardEffectCommons.IsExistOnBattleArea(card))
  383. {
  384. return true;
  385. }
  386. return false;
  387. }
  388. IEnumerator ActivateCoroutine(Hashtable hashtable)
  389. {
  390. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  391. {
  392. int maxCount = Math.Min(1,
  393. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  394. SelectPermanentEffect selectPermanentEffect =
  395. GManager.instance.GetComponent<SelectPermanentEffect>();
  396. selectPermanentEffect.SetUp(
  397. selectPlayer: card.Owner,
  398. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  399. canTargetCondition_ByPreSelecetedList: null,
  400. canEndSelectCondition: null,
  401. maxCount: maxCount,
  402. canNoSelect: true,
  403. canEndNotMax: false,
  404. selectPermanentCoroutine: SelectPermanentCoroutine,
  405. afterSelectPermanentCoroutine: null,
  406. mode: SelectPermanentEffect.Mode.Custom,
  407. cardEffect: activateClass);
  408. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  409. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  410. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  411. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  412. {
  413. yield return ContinuousController.instance.StartCoroutine(
  414. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  415. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  416. }
  417. }
  418. }
  419. }
  420. #endregion
  421. return cardEffects;
  422. }
  423. }
  424. }