EX6_026.cs 20 KB

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