EX10_053.cs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. //Regulusmon
  6. namespace DCGO.CardEffects.EX10
  7. {
  8. public class EX10_053 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternate Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.ContainsCardName("Gammamon") &&
  19. targetPermanent.TopCard.IsLevel4;
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 5, ignoreDigivolutionRequirement: false, card: card, condition: null));
  22. }
  23. #endregion
  24. #region Static Effects
  25. //Rush/Blocker
  26. if (timing == EffectTiming.None)
  27. {
  28. cardEffects.Add(CardEffectFactory.RushSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  29. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  30. }
  31. #endregion
  32. #region On Play
  33. if (timing == EffectTiming.OnEnterFieldAnyone)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("Place up to 5 [Gammamon] Digimon from trash to digivolution cards, then delete 1 Digimon", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[On Play] You may place up to 5 differently named Digimon cards with [Gammamon] in their names from your trash as this Digimon's bottom digivolution cards. Then, delete 1 of your opponent's Digimon with as much or less DP as this Digimon.";
  42. }
  43. bool CanSelectCardCondition(CardSource cardSource)
  44. {
  45. return cardSource.IsDigimon &&
  46. cardSource.ContainsCardName("Gammamon");
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  51. CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  56. }
  57. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  58. {
  59. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  60. {
  61. List<CardSource> selectedCards = new List<CardSource>();
  62. int maxCount = Math.Min(5, card.Owner.TrashCards.Count(CanSelectCardCondition));
  63. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  64. selectCardEffect.SetUp(
  65. canTargetCondition: CanSelectCardCondition,
  66. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  67. canEndSelectCondition: null,
  68. canNoSelect: () => true,
  69. selectCardCoroutine: SelectCardCoroutine,
  70. afterSelectCardCoroutine: null,
  71. message: "Select [Gammamon] in name to place on bottom of digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  72. maxCount: maxCount,
  73. canEndNotMax: true,
  74. isShowOpponent: true,
  75. mode: SelectCardEffect.Mode.Custom,
  76. root: SelectCardEffect.Root.Trash,
  77. customRootCardList: null,
  78. canLookReverseCard: true,
  79. selectPlayer: card.Owner,
  80. cardEffect: activateClass);
  81. IEnumerator SelectCardCoroutine(CardSource cardSource)
  82. {
  83. selectedCards.Add(cardSource);
  84. yield return null;
  85. }
  86. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  87. {
  88. var allSources = (cardSources ?? Enumerable.Empty<CardSource>())
  89. .Concat(selectedCards ?? Enumerable.Empty<CardSource>());
  90. var nameSet = new HashSet<string>(
  91. allSources.SelectMany(s => s.CardNames ?? Enumerable.Empty<string>())
  92. .Where(n => !string.IsNullOrWhiteSpace(n)));
  93. var idSet = new HashSet<string>(
  94. allSources.Select(s => s.CardID)
  95. .Where(id => !string.IsNullOrWhiteSpace(id)));
  96. if (cardSource.CardNames.Exists(nameSet.Contains) || idSet.Contains(cardSource.CardID)) return false;
  97. return true;
  98. }
  99. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards");
  100. selectCardEffect.SetUpCustomMessage("Select cards to place on bottom of digivolution cards.", "The opponent is selecting cards to place on bottom of digivolution cards.");
  101. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  102. if (selectedCards.Count >= 1)
  103. {
  104. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  105. }
  106. }
  107. bool CanSelectForDeletion(Permanent permanent)
  108. {
  109. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  110. {
  111. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(card.PermanentOfThisCard().DP, activateClass))
  112. {
  113. return true;
  114. }
  115. }
  116. return false;
  117. }
  118. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectForDeletion))
  119. {
  120. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  121. selectPermanentEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectForDeletion,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: 1,
  127. canNoSelect: false,
  128. canEndNotMax: false,
  129. selectPermanentCoroutine: null,
  130. afterSelectPermanentCoroutine: null,
  131. mode: SelectPermanentEffect.Mode.Destroy,
  132. cardEffect: activateClass);
  133. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  134. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  135. }
  136. }
  137. }
  138. #endregion
  139. #region When Digivolving
  140. if (timing == EffectTiming.OnEnterFieldAnyone)
  141. {
  142. ActivateClass activateClass = new ActivateClass();
  143. activateClass.SetUpICardEffect("Place up to 5 [Gammamon] Digimon from trash to digivolution cards, then delete 1 Digimon", CanUseCondition, card);
  144. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  145. cardEffects.Add(activateClass);
  146. string EffectDiscription()
  147. {
  148. return "[When Digivolving] You may place up to 5 differently named Digimon cards with [Gammamon] in their names from your trash as this Digimon's bottom digivolution cards. Then, delete 1 of your opponent's Digimon with as much or less DP as this Digimon.";
  149. }
  150. bool CanSelectCardCondition(CardSource cardSource)
  151. {
  152. return cardSource.IsDigimon &&
  153. cardSource.ContainsCardName("Gammamon");
  154. }
  155. bool CanUseCondition(Hashtable hashtable)
  156. {
  157. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  158. CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  159. }
  160. bool CanActivateCondition(Hashtable hashtable)
  161. {
  162. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  163. }
  164. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  165. {
  166. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  167. {
  168. List<CardSource> selectedCards = new List<CardSource>();
  169. int maxCount = Math.Min(5, card.Owner.TrashCards.Count(CanSelectCardCondition));
  170. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  171. selectCardEffect.SetUp(
  172. canTargetCondition: CanSelectCardCondition,
  173. canTargetCondition_ByPreSelecetedList: CanTargetCondition_ByPreSelecetedList,
  174. canEndSelectCondition: null,
  175. canNoSelect: () => true,
  176. selectCardCoroutine: SelectCardCoroutine,
  177. afterSelectCardCoroutine: null,
  178. message: "Select [Gammamon] in name to place on bottom of digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  179. maxCount: maxCount,
  180. canEndNotMax: true,
  181. isShowOpponent: true,
  182. mode: SelectCardEffect.Mode.Custom,
  183. root: SelectCardEffect.Root.Trash,
  184. customRootCardList: null,
  185. canLookReverseCard: true,
  186. selectPlayer: card.Owner,
  187. cardEffect: activateClass);
  188. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards");
  189. selectCardEffect.SetUpCustomMessage("Select cards to place on bottom of digivolution cards.", "The opponent is selecting cards to place on bottom of digivolution cards.");
  190. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  191. IEnumerator SelectCardCoroutine(CardSource cardSource)
  192. {
  193. selectedCards.Add(cardSource);
  194. yield return null;
  195. }
  196. bool CanTargetCondition_ByPreSelecetedList(List<CardSource> cardSources, CardSource cardSource)
  197. {
  198. var allSources = (cardSources ?? Enumerable.Empty<CardSource>())
  199. .Concat(selectedCards ?? Enumerable.Empty<CardSource>());
  200. var nameSet = new HashSet<string>(
  201. allSources.SelectMany(s => s.CardNames ?? Enumerable.Empty<string>())
  202. .Where(n => !string.IsNullOrWhiteSpace(n)));
  203. var idSet = new HashSet<string>(
  204. allSources.Select(s => s.CardID)
  205. .Where(id => !string.IsNullOrWhiteSpace(id)));
  206. if (cardSource.CardNames.Exists(nameSet.Contains) || idSet.Contains(cardSource.CardID)) return false;
  207. return true;
  208. }
  209. if (selectedCards.Count >= 1)
  210. {
  211. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  212. }
  213. }
  214. bool CanSelectForDeletion(Permanent permanent)
  215. {
  216. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  217. {
  218. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(card.PermanentOfThisCard().DP, activateClass))
  219. {
  220. return true;
  221. }
  222. }
  223. return false;
  224. }
  225. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectForDeletion))
  226. {
  227. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  228. selectPermanentEffect.SetUp(
  229. selectPlayer: card.Owner,
  230. canTargetCondition: CanSelectForDeletion,
  231. canTargetCondition_ByPreSelecetedList: null,
  232. canEndSelectCondition: null,
  233. maxCount: 1,
  234. canNoSelect: false,
  235. canEndNotMax: false,
  236. selectPermanentCoroutine: null,
  237. afterSelectPermanentCoroutine: null,
  238. mode: SelectPermanentEffect.Mode.Destroy,
  239. cardEffect: activateClass);
  240. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to delete.", "The opponent is selecting 1 Digimon to delete.");
  241. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  242. }
  243. }
  244. }
  245. #endregion
  246. #region End of Turn
  247. if (timing == EffectTiming.OnEndTurn)
  248. {
  249. ActivateClass activateClass = new ActivateClass();
  250. activateClass.SetUpICardEffect("Attack without suspending", CanUseCondition, card);
  251. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDescription());
  252. activateClass.SetHashString("EOT_EX10-053");
  253. cardEffects.Add(activateClass);
  254. string EffectDescription()
  255. {
  256. return "[End of Your Turn] [Once Per Turn] If this Digimon has 5 or more digivolution cards, it may attack without suspending.";
  257. }
  258. bool CanUseCondition(Hashtable hashtable)
  259. {
  260. return CardEffectCommons.IsOwnerTurn(card) &&
  261. CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  262. }
  263. bool CanActivateCondition(Hashtable hashtable)
  264. {
  265. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  266. card.PermanentOfThisCard().DigivolutionCards.Count >= 5;
  267. }
  268. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  269. {
  270. SelectAttackEffect selectAttackEffect = GManager.instance.GetComponent<SelectAttackEffect>();
  271. selectAttackEffect.SetUp(
  272. attacker: card.PermanentOfThisCard(),
  273. canAttackPlayerCondition: () => true,
  274. defenderCondition: (permanent) => true,
  275. cardEffect: activateClass);
  276. selectAttackEffect.SetWithoutTap();
  277. yield return ContinuousController.instance.StartCoroutine(selectAttackEffect.Activate());
  278. }
  279. }
  280. #endregion
  281. #region ESS
  282. if (timing == EffectTiming.OnDestroyedAnyone)
  283. {
  284. ActivateClass activateClass = new ActivateClass();
  285. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  286. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  287. activateClass.SetIsInheritedEffect(true);
  288. activateClass.SetHashString("Memory+1_EX10_053");
  289. cardEffects.Add(activateClass);
  290. string EffectDiscription()
  291. {
  292. return "[Your Turn] [Once Per Turn] When any of your opponent's Digimon are deleted, gain 1 memory.";
  293. }
  294. bool PermanentCondition(Permanent permanent)
  295. {
  296. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  297. }
  298. bool CanUseCondition(Hashtable hashtable)
  299. {
  300. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  301. {
  302. if (CardEffectCommons.IsOwnerTurn(card))
  303. {
  304. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition))
  305. {
  306. return true;
  307. }
  308. }
  309. }
  310. return false;
  311. }
  312. bool CanActivateCondition(Hashtable hashtable)
  313. {
  314. if (CardEffectCommons.IsExistOnBattleAreaDigimon(card))
  315. {
  316. return true;
  317. }
  318. return false;
  319. }
  320. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  321. {
  322. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  323. }
  324. }
  325. #endregion
  326. return cardEffects;
  327. }
  328. }
  329. }