EX6_023.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  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_023 : 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 [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("Sanzomon") ||
  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 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, delete 1 of your opponent's Digimon with 6000 DP or less.",
  76. CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  78. EffectDescription());
  79. activateClass.SetHashString("SecurityAttack-1Delete_EX6-023");
  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, delete 1 of your opponent's Digimon with 6000 DP or less.";
  85. }
  86. bool CanUseCondition(Hashtable hashtable)
  87. {
  88. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  89. }
  90. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  91. {
  92. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  93. {
  94. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(6000, activateClass))
  95. {
  96. return true;
  97. }
  98. }
  99. return false;
  100. }
  101. bool CanActivateCondition(Hashtable hashtable)
  102. {
  103. if (CardEffectCommons.IsExistOnBattleArea(card))
  104. {
  105. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  106. {
  107. return true;
  108. }
  109. if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
  110. {
  111. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  112. {
  113. return true;
  114. }
  115. }
  116. }
  117. return false;
  118. }
  119. IEnumerator ActivateCoroutine(Hashtable hashtable)
  120. {
  121. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  122. {
  123. int maxCount = Math.Min(1,
  124. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  125. SelectPermanentEffect selectPermanentEffect =
  126. GManager.instance.GetComponent<SelectPermanentEffect>();
  127. selectPermanentEffect.SetUp(
  128. selectPlayer: card.Owner,
  129. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  130. canTargetCondition_ByPreSelecetedList: null,
  131. canEndSelectCondition: null,
  132. maxCount: maxCount,
  133. canNoSelect: true,
  134. canEndNotMax: false,
  135. selectPermanentCoroutine: SelectPermanentCoroutine,
  136. afterSelectPermanentCoroutine: null,
  137. mode: SelectPermanentEffect.Mode.Custom,
  138. cardEffect: activateClass);
  139. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  140. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  141. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  142. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  143. {
  144. yield return ContinuousController.instance.StartCoroutine(
  145. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  146. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  147. }
  148. }
  149. if (CardEffectCommons.IsDijiXros(hashtable, card, count => count >= 1))
  150. {
  151. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  152. {
  153. int maxCount = Math.Min(1,
  154. CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  155. SelectPermanentEffect selectPermanentEffect =
  156. GManager.instance.GetComponent<SelectPermanentEffect>();
  157. selectPermanentEffect.SetUp(
  158. selectPlayer: card.Owner,
  159. canTargetCondition: CanSelectOpponentPermanentCondition,
  160. canTargetCondition_ByPreSelecetedList: null,
  161. canEndSelectCondition: null,
  162. maxCount: maxCount,
  163. canNoSelect: false,
  164. canEndNotMax: false,
  165. selectPermanentCoroutine: null,
  166. afterSelectPermanentCoroutine: null,
  167. mode: SelectPermanentEffect.Mode.Destroy,
  168. cardEffect: activateClass);
  169. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  170. }
  171. }
  172. }
  173. }
  174. #endregion
  175. #region When Attacking
  176. if (timing == EffectTiming.OnAllyAttack)
  177. {
  178. ActivateClass activateClass = new ActivateClass();
  179. activateClass.SetUpICardEffect(
  180. "1 Digimon may gain [Security Attack -1] until the end of your opponent's turn",
  181. CanUseCondition, card);
  182. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  183. EffectDescription());
  184. activateClass.SetHashString("SecurityAttack-1_EX6-023");
  185. cardEffects.Add(activateClass);
  186. string EffectDescription()
  187. {
  188. return
  189. "[When Attacking] [Once Per Turn] 1 Digimon may gain [Security Attack -1] until the end of your opponent's turn. Then, if DigiXrosing, delete 1 of your opponent's Digimon with 6000 DP or less.";
  190. }
  191. bool CanUseCondition(Hashtable hashtable)
  192. {
  193. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  194. }
  195. bool CanActivateCondition(Hashtable hashtable)
  196. {
  197. if (CardEffectCommons.IsExistOnBattleArea(card))
  198. {
  199. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  200. {
  201. return true;
  202. }
  203. }
  204. return false;
  205. }
  206. IEnumerator ActivateCoroutine(Hashtable hashtable)
  207. {
  208. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  209. {
  210. int maxCount = Math.Min(1,
  211. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  212. SelectPermanentEffect selectPermanentEffect =
  213. GManager.instance.GetComponent<SelectPermanentEffect>();
  214. selectPermanentEffect.SetUp(
  215. selectPlayer: card.Owner,
  216. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  217. canTargetCondition_ByPreSelecetedList: null,
  218. canEndSelectCondition: null,
  219. maxCount: maxCount,
  220. canNoSelect: true,
  221. canEndNotMax: false,
  222. selectPermanentCoroutine: SelectPermanentCoroutine,
  223. afterSelectPermanentCoroutine: null,
  224. mode: SelectPermanentEffect.Mode.Custom,
  225. cardEffect: activateClass);
  226. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  227. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  228. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  229. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  230. {
  231. yield return ContinuousController.instance.StartCoroutine(
  232. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  233. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  234. }
  235. }
  236. }
  237. }
  238. #endregion
  239. #region All Turns
  240. if (timing == EffectTiming.WhenRemoveField)
  241. {
  242. ActivateClass activateClass = new ActivateClass();
  243. activateClass.SetUpICardEffect(
  244. "Return 1 yellow Digimon card from this Digimon's digivolution cards to the hand",
  245. CanUseCondition, card);
  246. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false,
  247. EffectDescription());
  248. activateClass.SetHashString("AllTurns_EX6_023");
  249. cardEffects.Add(activateClass);
  250. string EffectDescription()
  251. {
  252. return
  253. "[All Turns] When this Digimon would leave the battle area, return 1 yellow Digimon card from this Digimon's digivolution cards to the hand.";
  254. }
  255. bool CanSelectCardCondition(CardSource cardSource)
  256. {
  257. if (cardSource.IsDigimon)
  258. {
  259. if (cardSource.HasCardColor(CardColor.Yellow))
  260. {
  261. return true;
  262. }
  263. }
  264. return false;
  265. }
  266. bool CanUseCondition(Hashtable hashtable)
  267. {
  268. if (CardEffectCommons.IsExistOnBattleArea(card))
  269. {
  270. if (CardEffectCommons.CanTriggerWhenRemoveField(hashtable, card))
  271. {
  272. return true;
  273. }
  274. }
  275. return false;
  276. }
  277. bool CanActivateCondition(Hashtable hashtable)
  278. {
  279. if (CardEffectCommons.IsExistOnBattleArea(card))
  280. {
  281. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  282. {
  283. return true;
  284. }
  285. }
  286. return false;
  287. }
  288. IEnumerator ActivateCoroutine(Hashtable hashtable)
  289. {
  290. if (CardEffectCommons.IsExistOnBattleArea(card))
  291. {
  292. Permanent cardPermanent = card.PermanentOfThisCard();
  293. if (cardPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  294. {
  295. int maxCount = Math.Min(1, cardPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  296. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  297. selectCardEffect.SetUp(
  298. canTargetCondition: CanSelectCardCondition,
  299. canTargetCondition_ByPreSelecetedList: null,
  300. canEndSelectCondition: null,
  301. canNoSelect: () => false,
  302. selectCardCoroutine: null,
  303. afterSelectCardCoroutine: null,
  304. message: "Select 1 card to return to hand.",
  305. maxCount: maxCount,
  306. canEndNotMax: false,
  307. isShowOpponent: true,
  308. mode: SelectCardEffect.Mode.AddHand,
  309. root: SelectCardEffect.Root.Custom,
  310. customRootCardList: cardPermanent.DigivolutionCards,
  311. canLookReverseCard: true,
  312. selectPlayer: card.Owner,
  313. cardEffect: activateClass);
  314. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  315. }
  316. }
  317. }
  318. }
  319. #endregion
  320. #region When Attacking - ESS
  321. if (timing == EffectTiming.OnAllyAttack)
  322. {
  323. ActivateClass activateClass = new ActivateClass();
  324. activateClass.SetUpICardEffect("Security Attack -1", CanUseCondition, card);
  325. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  326. EffectDescription());
  327. activateClass.SetIsInheritedEffect(true);
  328. activateClass.SetHashString("SecurityAttack-1_EX6-023");
  329. cardEffects.Add(activateClass);
  330. string EffectDescription()
  331. {
  332. return
  333. "[When Attacking][Once Per Turn] 1 Digimon may gain [Security Attack -1] until the end of your opponent's turn.";
  334. }
  335. bool CanUseCondition(Hashtable hashtable)
  336. {
  337. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  338. }
  339. bool CanActivateCondition(Hashtable hashtable)
  340. {
  341. if (CardEffectCommons.IsExistOnBattleArea(card))
  342. {
  343. return true;
  344. }
  345. return false;
  346. }
  347. IEnumerator ActivateCoroutine(Hashtable hashtable)
  348. {
  349. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectSecMinusPermanentSharedCondition))
  350. {
  351. int maxCount = Math.Min(1,
  352. CardEffectCommons.MatchConditionPermanentCount(CanSelectSecMinusPermanentSharedCondition));
  353. SelectPermanentEffect selectPermanentEffect =
  354. GManager.instance.GetComponent<SelectPermanentEffect>();
  355. selectPermanentEffect.SetUp(
  356. selectPlayer: card.Owner,
  357. canTargetCondition: CanSelectSecMinusPermanentSharedCondition,
  358. canTargetCondition_ByPreSelecetedList: null,
  359. canEndSelectCondition: null,
  360. maxCount: maxCount,
  361. canNoSelect: true,
  362. canEndNotMax: false,
  363. selectPermanentCoroutine: SelectPermanentCoroutine,
  364. afterSelectPermanentCoroutine: null,
  365. mode: SelectPermanentEffect.Mode.Custom,
  366. cardEffect: activateClass);
  367. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack -1.",
  368. "The opponent is selecting 1 Digimon that will get Security Attack -1.");
  369. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  370. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  371. {
  372. yield return ContinuousController.instance.StartCoroutine(
  373. CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: -1,
  374. effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  375. }
  376. }
  377. }
  378. }
  379. #endregion
  380. return cardEffects;
  381. }
  382. }
  383. }