EX8_073.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.EX8
  6. {
  7. public class EX8_073 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Gallantmon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 1,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null)
  25. );
  26. }
  27. #endregion
  28. #region When Digivolving
  29. if (timing == EffectTiming.OnEnterFieldAnyone)
  30. {
  31. ActivateClass activateClass = new ActivateClass();
  32. activateClass.SetUpICardEffect("This Digimon gets +4000 DP and gives -4000 DP to an opponent's Digimon", CanUseCondition, card);
  33. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  34. cardEffects.Add(activateClass);
  35. string EffectDiscription()
  36. {
  37. return "[When Digivolving] If [Gallantmon]/[X Antibody] is in this Digimon's digivolution cards, this Digimon gets +4000 DP and 1 of your opponent's Digimon gets -4000 DP until the end of their turn.";
  38. }
  39. bool CanSelectPermanentCondition(Permanent permanent)
  40. {
  41. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  42. {
  43. return true;
  44. }
  45. return false;
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  50. {
  51. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  61. {
  62. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("Gallantmon") || cardSource.EqualsCardName("X Antibody")) >= 1)
  63. {
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  70. {
  71. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 4000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  73. {
  74. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  75. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: CanSelectPermanentCondition,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: maxCount,
  82. canNoSelect: false,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: SelectPermanentCoroutine,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Custom,
  87. cardEffect: activateClass);
  88. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.", "The opponent is selecting 1 Digimon that will get DP -4000.");
  89. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  90. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  91. {
  92. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -4000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  93. }
  94. }
  95. }
  96. }
  97. #endregion
  98. #region When Attacking
  99. if (timing == EffectTiming.OnAllyAttack)
  100. {
  101. ActivateClass activateClass = new ActivateClass();
  102. activateClass.SetUpICardEffect("This Digimon gets +4000 DP and gives -4000 DP to an opponent's Digimon", CanUseCondition, card);
  103. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  104. cardEffects.Add(activateClass);
  105. string EffectDiscription()
  106. {
  107. return "[When Attacking] If [Gallantmon]/[X Antibody] is in this Digimon's digivolution cards, this Digimon gets +4000 DP and 1 of your opponent's Digimon gets -4000 DP until the end of their turn.";
  108. }
  109. bool CanSelectPermanentCondition(Permanent permanent)
  110. {
  111. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  112. {
  113. return true;
  114. }
  115. return false;
  116. }
  117. bool CanUseCondition(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  120. {
  121. if (CardEffectCommons.CanTriggerOnAttack(hashtable, card))
  122. {
  123. return true;
  124. }
  125. }
  126. return false;
  127. }
  128. bool CanActivateCondition(Hashtable hashtable)
  129. {
  130. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  131. {
  132. if (card.PermanentOfThisCard().DigivolutionCards.Count((cardSource) => cardSource.EqualsCardName("Gallantmon") || cardSource.EqualsCardName("X Antibody")) >= 1)
  133. {
  134. return true;
  135. }
  136. }
  137. return false;
  138. }
  139. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  140. {
  141. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: card.PermanentOfThisCard(), changeValue: 4000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  142. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  143. {
  144. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  145. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  146. selectPermanentEffect.SetUp(
  147. selectPlayer: card.Owner,
  148. canTargetCondition: CanSelectPermanentCondition,
  149. canTargetCondition_ByPreSelecetedList: null,
  150. canEndSelectCondition: null,
  151. maxCount: maxCount,
  152. canNoSelect: false,
  153. canEndNotMax: false,
  154. selectPermanentCoroutine: SelectPermanentCoroutine,
  155. afterSelectPermanentCoroutine: null,
  156. mode: SelectPermanentEffect.Mode.Custom,
  157. cardEffect: activateClass);
  158. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -4000.", "The opponent is selecting 1 Digimon that will get DP -4000.");
  159. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  160. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  161. {
  162. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -4000, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  163. }
  164. }
  165. }
  166. }
  167. #endregion
  168. #region When Digivolving - Once Per Turn
  169. if (timing == EffectTiming.OnEnterFieldAnyone)
  170. {
  171. ActivateClass activateClass = new ActivateClass();
  172. activateClass.SetUpICardEffect("Delete 1 Digimon with 10000 DP or less, or trash the opponent's top security and unsuspend", CanUseCondition, card);
  173. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  174. activateClass.SetHashString("Delete_EX8_073");
  175. cardEffects.Add(activateClass);
  176. string EffectDescription()
  177. {
  178. return "[When Digivolving] [Once Per Turn] Delete 1 of your opponent's Digimon with 10000 DP or less. If this didn't delete, trash your opponent's top security card and this Digimon unsuspends.";
  179. }
  180. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  181. {
  182. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  183. {
  184. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(10000, activateClass))
  185. {
  186. return true;
  187. }
  188. }
  189. return false;
  190. }
  191. bool CanUseCondition(Hashtable hashtable)
  192. {
  193. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  194. {
  195. if (CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card))
  196. {
  197. return true;
  198. }
  199. }
  200. return false;
  201. }
  202. bool CanActivateCondition(Hashtable hashtable)
  203. {
  204. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  205. }
  206. IEnumerator ActivateCoroutine(Hashtable hashtable)
  207. {
  208. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  209. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  210. {
  211. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  212. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  213. selectPermanentEffect.SetUp(
  214. selectPlayer: card.Owner,
  215. canTargetCondition: CanSelectOpponentPermanentCondition,
  216. canTargetCondition_ByPreSelecetedList: null,
  217. canEndSelectCondition: null,
  218. maxCount: maxCount,
  219. canNoSelect: false,
  220. canEndNotMax: false,
  221. selectPermanentCoroutine: null,
  222. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  223. mode: SelectPermanentEffect.Mode.Custom,
  224. cardEffect: activateClass);
  225. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  226. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  227. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  228. {
  229. deleteTargetPermanents = permanents.Clone();
  230. yield return null;
  231. }
  232. }
  233. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  234. IEnumerator FailureProcess()
  235. {
  236. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  237. {
  238. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  239. player: card.Owner.Enemy,
  240. destroySecurityCount: 1,
  241. cardEffect: activateClass,
  242. fromTop: true).DestroySecurity());
  243. }
  244. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  245. }
  246. UnityEngine.Debug.Log($"ACTIVATE: Effect Done");
  247. }
  248. }
  249. #endregion
  250. #region End of Attack - Once Per Turn
  251. if (timing == EffectTiming.OnEndAttack)
  252. {
  253. ActivateClass activateClass = new ActivateClass();
  254. activateClass.SetUpICardEffect("Delete 1 Digimon with 10000 DP or less, or trash the opponent's top security and unsuspend", CanUseCondition, card);
  255. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  256. activateClass.SetHashString("Delete_EX8_073");
  257. cardEffects.Add(activateClass);
  258. string EffectDescription()
  259. {
  260. return "[End of Attack] [Once Per Turn] Delete 1 of your opponent's Digimon with 10000 DP or less. If this didn't delete, trash your opponent's top security card and this Digimon unsuspends.";
  261. }
  262. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  263. {
  264. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  265. {
  266. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(10000, activateClass))
  267. {
  268. return true;
  269. }
  270. }
  271. return false;
  272. }
  273. bool CanUseCondition(Hashtable hashtable)
  274. {
  275. return CardEffectCommons.CanTriggerOnEndAttack(hashtable, card);
  276. }
  277. bool CanActivateCondition(Hashtable hashtable)
  278. {
  279. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  280. }
  281. IEnumerator ActivateCoroutine(Hashtable hashtable)
  282. {
  283. List<Permanent> deleteTargetPermanents = new List<Permanent>();
  284. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  285. {
  286. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectOpponentPermanentCondition));
  287. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  288. selectPermanentEffect.SetUp(
  289. selectPlayer: card.Owner,
  290. canTargetCondition: CanSelectOpponentPermanentCondition,
  291. canTargetCondition_ByPreSelecetedList: null,
  292. canEndSelectCondition: null,
  293. maxCount: maxCount,
  294. canNoSelect: false,
  295. canEndNotMax: false,
  296. selectPermanentCoroutine: null,
  297. afterSelectPermanentCoroutine: AfterSelectPermanentCoroutine,
  298. mode: SelectPermanentEffect.Mode.Custom,
  299. cardEffect: activateClass);
  300. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  301. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  302. IEnumerator AfterSelectPermanentCoroutine(List<Permanent> permanents)
  303. {
  304. deleteTargetPermanents = permanents.Clone();
  305. yield return null;
  306. }
  307. }
  308. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.DeletePeremanentAndProcessAccordingToResult(targetPermanents: deleteTargetPermanents, activateClass: activateClass, successProcess: null, failureProcess: FailureProcess));
  309. IEnumerator FailureProcess()
  310. {
  311. if (card.Owner.Enemy.SecurityCards.Count >= 1)
  312. {
  313. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  314. player: card.Owner.Enemy,
  315. destroySecurityCount: 1,
  316. cardEffect: activateClass,
  317. fromTop: true).DestroySecurity());
  318. }
  319. yield return ContinuousController.instance.StartCoroutine(new IUnsuspendPermanents(new List<Permanent>() { card.PermanentOfThisCard() }, activateClass).Unsuspend());
  320. }
  321. }
  322. }
  323. #endregion
  324. #region All Turns
  325. if (timing == EffectTiming.None)
  326. {
  327. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  328. canNotAffectedClass.SetUpICardEffect("Not affected by opponent's Digimon's effects if you have 0 or less memory", CanUseCondition, card);
  329. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  330. cardEffects.Add(canNotAffectedClass);
  331. bool CanUseCondition(Hashtable hashtable)
  332. {
  333. if (card.Owner.MemoryForPlayer <= 0)
  334. {
  335. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  336. {
  337. return true;
  338. }
  339. }
  340. return false;
  341. }
  342. bool CardCondition(CardSource cardSource)
  343. {
  344. if (cardSource == card)
  345. {
  346. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  347. {
  348. if (cardSource == card.PermanentOfThisCard().TopCard)
  349. {
  350. return true;
  351. }
  352. }
  353. }
  354. return false;
  355. }
  356. bool SkillCondition(ICardEffect cardEffect)
  357. {
  358. if (CardEffectCommons.IsOpponentEffect(cardEffect, card))
  359. {
  360. if (cardEffect.IsDigimonEffect)
  361. {
  362. return true;
  363. }
  364. if (cardEffect.IsDigimonEffect && cardEffect.IsSecurityEffect)
  365. {
  366. return true;
  367. }
  368. }
  369. return false;
  370. }
  371. }
  372. #endregion
  373. return cardEffects;
  374. }
  375. }
  376. }