EX6_027.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX6
  6. {
  7. public class EX6_027 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Alternate Digivolution
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Angewomon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 3,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region Ace - Blast Digivolve
  29. if (timing == EffectTiming.OnCounterTiming)
  30. {
  31. cardEffects.Add(CardEffectFactory.BlastDigivolveEffect(card: card, condition: null));
  32. }
  33. #endregion
  34. #region On Play/ When Digivolving Shared
  35. bool CanSelectPermanentSharedCondition(Permanent permanent)
  36. {
  37. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  38. }
  39. bool CanActivateSharedCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (card.Owner.SecurityCards.Count >= 1)
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. #endregion
  51. #region On Play
  52. if (timing == EffectTiming.OnEnterFieldAnyone)
  53. {
  54. ActivateClass activateClass = new ActivateClass();
  55. activateClass.SetUpICardEffect(
  56. "By trashing the top or bottom card of your security stack, 1 of your opponent's Digimon gets -8000 DP until the end of your opponents turn.",
  57. CanUseCondition, card);
  58. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, true,
  59. EffectSharedDescription());
  60. cardEffects.Add(activateClass);
  61. string EffectSharedDescription()
  62. {
  63. return
  64. "[On Play] By trashing the top or bottom card of your security stack, 1 of your opponent's Digimon gets -8000 DP until the end of your opponents turn.";
  65. }
  66. bool CanUseCondition(Hashtable hashtable)
  67. {
  68. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  69. }
  70. IEnumerator ActivateCoroutine(Hashtable hashtable)
  71. {
  72. if (card.Owner.SecurityCards.Count >= 1)
  73. {
  74. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>()
  75. {
  76. new(message: "Security Top", value: 0, spriteIndex: 0),
  77. new(message: "Security Bottom", value: 1, spriteIndex: 0),
  78. new(message: "No Selection", value: 2, spriteIndex: 1),
  79. };
  80. string selectPlayerMessage = "Trash the top or bottom card of the security stack";
  81. string notSelectPlayerMessage =
  82. "The opponent is selecting whether to trash the top or bottom card of the security stack.";
  83. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements,
  84. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  85. notSelectPlayerMessage: notSelectPlayerMessage);
  86. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  87. .WaitForEndSelect());
  88. int selectionValue = GManager.instance.userSelectionManager.SelectedIntValue;
  89. if (selectionValue != 2)
  90. {
  91. bool fromTop = selectionValue.Equals(0);
  92. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  93. player: card.Owner,
  94. destroySecurityCount: 1,
  95. cardEffect: activateClass,
  96. fromTop: fromTop).DestroySecurity());
  97. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  98. {
  99. int maxCount = Math.Min(1,
  100. CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentSharedCondition));
  101. SelectPermanentEffect selectPermanentEffect =
  102. GManager.instance.GetComponent<SelectPermanentEffect>();
  103. selectPermanentEffect.SetUp(
  104. selectPlayer: card.Owner,
  105. canTargetCondition: CanSelectPermanentSharedCondition,
  106. canTargetCondition_ByPreSelecetedList: null,
  107. canEndSelectCondition: null,
  108. maxCount: maxCount,
  109. canNoSelect: false,
  110. canEndNotMax: false,
  111. selectPermanentCoroutine: SelectPermanentCoroutine,
  112. afterSelectPermanentCoroutine: null,
  113. mode: SelectPermanentEffect.Mode.Custom,
  114. cardEffect: activateClass);
  115. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -8000.",
  116. "The opponent is selecting 1 Digimon that will get DP -8000.");
  117. yield return ContinuousController.instance.StartCoroutine(
  118. selectPermanentEffect.Activate());
  119. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  120. {
  121. yield return ContinuousController.instance.StartCoroutine(
  122. CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent,
  123. changeValue: -8000, effectDuration: EffectDuration.UntilOpponentTurnEnd,
  124. activateClass: activateClass));
  125. }
  126. }
  127. }
  128. }
  129. }
  130. }
  131. #endregion
  132. #region When Digivolving
  133. if (timing == EffectTiming.OnEnterFieldAnyone)
  134. {
  135. ActivateClass activateClass = new ActivateClass();
  136. activateClass.SetUpICardEffect(
  137. " By trashing the top or bottom card of your security stack, 1 of your opponent's Digimon gets -8000 DP until the end of your opponents turn.",
  138. CanUseCondition, card);
  139. activateClass.SetUpActivateClass(CanActivateSharedCondition, ActivateCoroutine, -1, true,
  140. EffectSharedDescription());
  141. cardEffects.Add(activateClass);
  142. string EffectSharedDescription()
  143. {
  144. return
  145. "[When Digivolving] By trashing the top or bottom card of your security stack, 1 of your opponent's Digimon gets -8000 DP until the end of your opponents turn.";
  146. }
  147. bool CanUseCondition(Hashtable hashtable)
  148. {
  149. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  150. }
  151. IEnumerator ActivateCoroutine(Hashtable hashtable)
  152. {
  153. if (card.Owner.SecurityCards.Count >= 1)
  154. {
  155. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>()
  156. {
  157. new(message: "Security Top", value: 0, spriteIndex: 0),
  158. new(message: "Security Bottom", value: 1, spriteIndex: 0),
  159. new(message: "No Selection", value: 2, spriteIndex: 1),
  160. };
  161. string selectPlayerMessage = "Trash the top or bottom card of the security stack";
  162. string notSelectPlayerMessage =
  163. "The opponent is selecting whether to trash the top or bottom card of the security stack.";
  164. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements,
  165. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  166. notSelectPlayerMessage: notSelectPlayerMessage);
  167. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  168. .WaitForEndSelect());
  169. int selectionValue = GManager.instance.userSelectionManager.SelectedIntValue;
  170. if (selectionValue != 2)
  171. {
  172. bool fromTop = selectionValue.Equals(0);
  173. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  174. player: card.Owner,
  175. destroySecurityCount: 1,
  176. cardEffect: activateClass,
  177. fromTop: fromTop).DestroySecurity());
  178. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentSharedCondition))
  179. {
  180. int maxCount = Math.Min(1,
  181. CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentSharedCondition));
  182. SelectPermanentEffect selectPermanentEffect =
  183. GManager.instance.GetComponent<SelectPermanentEffect>();
  184. selectPermanentEffect.SetUp(
  185. selectPlayer: card.Owner,
  186. canTargetCondition: CanSelectPermanentSharedCondition,
  187. canTargetCondition_ByPreSelecetedList: null,
  188. canEndSelectCondition: null,
  189. maxCount: maxCount,
  190. canNoSelect: false,
  191. canEndNotMax: false,
  192. selectPermanentCoroutine: SelectPermanentCoroutine,
  193. afterSelectPermanentCoroutine: null,
  194. mode: SelectPermanentEffect.Mode.Custom,
  195. cardEffect: activateClass);
  196. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -8000.",
  197. "The opponent is selecting 1 Digimon that will get DP -8000.");
  198. yield return ContinuousController.instance.StartCoroutine(
  199. selectPermanentEffect.Activate());
  200. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  201. {
  202. yield return ContinuousController.instance.StartCoroutine(
  203. CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent,
  204. changeValue: -8000, effectDuration: EffectDuration.UntilOpponentTurnEnd,
  205. activateClass: activateClass));
  206. }
  207. }
  208. }
  209. }
  210. }
  211. }
  212. #endregion
  213. #region All Turns - Your Turn
  214. if (timing == EffectTiming.OnLoseSecurity)
  215. {
  216. ActivateClass activateClass = new ActivateClass();
  217. activateClass.SetUpICardEffect(
  218. "If it's your turn, this Digimon may gain [Security Attack +1] for the turn and attack",
  219. CanUseCondition, card);
  220. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true,
  221. EffectDescription());
  222. activateClass.SetHashString("AllTurnsYourTurn_EX6_027");
  223. cardEffects.Add(activateClass);
  224. string EffectDescription()
  225. {
  226. return
  227. "[All Turns][Once Per Turn] When a card is removed from your security stack, if it's your turn, this Digimon may gain [Security Attack +1] for the turn and attack. If it's your opponent's turn, [Recovery +1 <Deck>].";
  228. }
  229. bool CanUseCondition(Hashtable hashtable)
  230. {
  231. if (CardEffectCommons.IsExistOnBattleArea(card))
  232. {
  233. if (CardEffectCommons.IsOwnerTurn(card))
  234. {
  235. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  236. {
  237. return true;
  238. }
  239. }
  240. }
  241. return false;
  242. }
  243. bool CanActivateCondition(Hashtable hashtable)
  244. {
  245. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  246. }
  247. IEnumerator ActivateCoroutine(Hashtable hashtable)
  248. {
  249. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  250. {
  251. Permanent cardPermanent = card.PermanentOfThisCard();
  252. yield return ContinuousController.instance.StartCoroutine(
  253. CardEffectCommons.ChangeDigimonSAttack(
  254. targetPermanent: cardPermanent,
  255. changeValue: 1,
  256. effectDuration: EffectDuration.UntilEachTurnEnd,
  257. activateClass: activateClass));
  258. if (cardPermanent.CanAttack(activateClass))
  259. {
  260. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  261. selectAttackEffect.SetUp(
  262. attacker: cardPermanent,
  263. canAttackPlayerCondition: () => true,
  264. defenderCondition: (permanent) => true,
  265. cardEffect: activateClass);
  266. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  267. }
  268. }
  269. }
  270. }
  271. #endregion
  272. #region All Turns - Opponent's Turn
  273. if (timing == EffectTiming.OnLoseSecurity)
  274. {
  275. ActivateClass activateClass = new ActivateClass();
  276. activateClass.SetUpICardEffect(
  277. "If it's your opponent's turn, [Recovery +1 <Deck>]",
  278. CanUseCondition, card);
  279. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false,
  280. EffectDescription());
  281. activateClass.SetHashString("AllTurnsOpponentTurn_EX6_027");
  282. cardEffects.Add(activateClass);
  283. string EffectDescription()
  284. {
  285. return
  286. "[All Turns][Once Per Turn] When a card is removed from your security stack, if it's your turn, this Digimon may gain [Security Attack +1] for the turn and attack. If it's your opponent's turn, [Recovery +1 <Deck>].";
  287. }
  288. bool CanUseCondition(Hashtable hashtable)
  289. {
  290. if (CardEffectCommons.IsExistOnBattleArea(card))
  291. {
  292. if (CardEffectCommons.IsOpponentTurn(card))
  293. {
  294. if (CardEffectCommons.CanTriggerWhenLoseSecurity(hashtable, player => player == card.Owner))
  295. {
  296. return true;
  297. }
  298. }
  299. }
  300. return false;
  301. }
  302. bool CanActivateCondition(Hashtable hashtable)
  303. {
  304. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  305. {
  306. if (card.Owner.LibraryCards.Count >= 1)
  307. {
  308. if (card.Owner.CanAddSecurity(activateClass))
  309. {
  310. return true;
  311. }
  312. }
  313. }
  314. return false;
  315. }
  316. IEnumerator ActivateCoroutine(Hashtable hashtable)
  317. {
  318. yield return ContinuousController.instance.StartCoroutine(
  319. new IRecovery(card.Owner, 1, activateClass).Recovery());
  320. }
  321. }
  322. #endregion
  323. return cardEffects;
  324. }
  325. }
  326. }