EX12_077.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Proximamon
  6. namespace DCGO.CardEffects.EX12
  7. {
  8. public class EX12_077 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Alternative Digivolution Condition
  14. if (timing == EffectTiming.None)
  15. {
  16. bool PermanentCondition(Permanent targetPermanent)
  17. {
  18. return targetPermanent.TopCard.HasText("Gammamon")
  19. && targetPermanent.TopCard.EqualsTraits("VB");
  20. }
  21. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  22. permanentCondition: PermanentCondition,
  23. digivolutionCost: 5,
  24. ignoreDigivolutionRequirement: false,
  25. card: card,
  26. condition: null,
  27. level: 6)
  28. );
  29. }
  30. #endregion
  31. #region DNA Digivolution
  32. if (timing == EffectTiming.None)
  33. {
  34. AddJogressConditionClass addJogressConditionClass = new AddJogressConditionClass();
  35. addJogressConditionClass.SetUpICardEffect("DNA Digivolution", CanUseCondition, card);
  36. addJogressConditionClass.SetUpAddJogressConditionClass(getJogressCondition: GetJogress);
  37. addJogressConditionClass.SetNotShowUI(true);
  38. cardEffects.Add(addJogressConditionClass);
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return true;
  42. }
  43. JogressCondition GetJogress(CardSource cardSource)
  44. {
  45. if (cardSource == card)
  46. {
  47. bool PermanentCondition1(Permanent permanent)
  48. {
  49. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  50. && (permanent.TopCard.CardColors.Contains(CardColor.Red)
  51. || permanent.TopCard.CardColors.Contains(CardColor.Blue))
  52. && permanent.Levels_ForJogress(card).Contains(6);
  53. }
  54. bool PermanentCondition2(Permanent permanent)
  55. {
  56. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  57. && (permanent.TopCard.CardColors.Contains(CardColor.Black)
  58. || permanent.TopCard.CardColors.Contains(CardColor.Purple))
  59. && permanent.Levels_ForJogress(card).Contains(6);
  60. }
  61. JogressConditionElement[] elements = new JogressConditionElement[]
  62. {
  63. new JogressConditionElement(PermanentCondition1, "a level 6 Red or Blue Digimon"),
  64. new JogressConditionElement(PermanentCondition2, "a level 6 Black or Purple Digimon"),
  65. };
  66. JogressCondition jogressCondition = new JogressCondition(elements, 0);
  67. return jogressCondition;
  68. }
  69. return null;
  70. }
  71. }
  72. #endregion
  73. #region Security A. +1
  74. if (timing == EffectTiming.None)
  75. {
  76. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  77. }
  78. #endregion
  79. #region Blocker
  80. if (timing == EffectTiming.None)
  81. {
  82. cardEffects.Add(CardEffectFactory.BlockerSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  83. }
  84. #endregion
  85. #region Shared OP/WD
  86. string SharedEffectName1 = "Place 2 cards with [Gammamon] text/[VB] under 1 of your Digimon to delete 1 enemy Digimon/Tamer";
  87. CardEffectFactory.ActivateClassesForSharedEffects
  88. (ref cardEffects, timing, card,
  89. SharedEffectName1,
  90. SharedActivateCoroutine1,
  91. SharedEffectDescription1,
  92. optional: false,
  93. onPlay: true,
  94. whenDigivolving: true);
  95. string SharedEffectDescription1(string tag)
  96. {
  97. return $"[{tag}] By placing 2 cards with [Gammamon] in their texts or the [VB] trait from your hand or trash as 1 of your Digimon's top or bottom digivolution cards, delete 1 of your opponent's Digimon or Tamers.";
  98. }
  99. bool CanSelectCardCondition1(CardSource cardSource)
  100. {
  101. return cardSource.HasText("Gammamon")
  102. || cardSource.EqualsTraits("VB");
  103. }
  104. bool CanSelectPermanentPlaceCondition1(Permanent permanent)
  105. {
  106. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  107. }
  108. bool CanSelectPermanentDeletionCondition1(Permanent permanent)
  109. {
  110. return CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card)
  111. && (permanent.IsDigimon
  112. || permanent.IsTamer);
  113. }
  114. IEnumerator SharedActivateCoroutine1(Hashtable hashtable, ActivateClass activateClass)
  115. {
  116. if (card.Owner.HandCards.Count(CanSelectCardCondition1) + card.Owner.TrashCards.Count(CanSelectCardCondition1) >= 2)
  117. {
  118. Permanent selectedPermanent = null;
  119. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  120. selectPermanentEffect.SetUp(
  121. selectPlayer: card.Owner,
  122. canTargetCondition: CanSelectPermanentPlaceCondition1,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. maxCount: 1,
  126. canNoSelect: true,
  127. canEndNotMax: false,
  128. selectPermanentCoroutine: selectPermanentCoroutine,
  129. afterSelectPermanentCoroutine: null,
  130. mode: SelectPermanentEffect.Mode.Custom,
  131. cardEffect: activateClass
  132. );
  133. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to place sources under.", "The opponent is selecting 1 Digimon to place sources under.");
  134. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  135. IEnumerator selectPermanentCoroutine(Permanent permanent)
  136. {
  137. selectedPermanent = permanent;
  138. yield return null;
  139. }
  140. if (selectedPermanent != null)
  141. {
  142. int toSelect = 2;
  143. List<CardSource> selectedCards = new List<CardSource>();
  144. while (toSelect > 0)
  145. {
  146. bool CanSelectFilteredCardCondtion(CardSource cardSource)
  147. {
  148. return CanSelectCardCondition1(cardSource)
  149. && !selectedCards.Contains(cardSource);
  150. }
  151. int validHandCardCount = card.Owner.HandCards.Count(CanSelectFilteredCardCondtion);
  152. int validTrashCardCount = card.Owner.TrashCards.Count(CanSelectFilteredCardCondtion);
  153. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
  154. if (validHandCardCount > 0)
  155. {
  156. selectionElements.Add(new(message: "from Hand", value: 1, spriteIndex: 0));
  157. }
  158. if (validTrashCardCount > 0)
  159. {
  160. selectionElements.Add(new(message: "from Trash", value: 2, spriteIndex: 0));
  161. }
  162. selectionElements.Add(new(message: "Do not place", value: 3, spriteIndex: 1));
  163. GManager.instance.userSelectionManager.SetIntSelection(
  164. selectionElements: selectionElements,
  165. selectPlayer: card.Owner,
  166. selectPlayerMessage: "From which area will you select a card?",
  167. notSelectPlayerMessage: "The opponent is choosing from which area to select card.");
  168. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  169. if (GManager.instance.userSelectionManager.SelectedIntValue == 3)
  170. {
  171. break;
  172. }
  173. if (GManager.instance.userSelectionManager.SelectedIntValue == 1)
  174. {
  175. int maxCount = Math.Min(toSelect, card.Owner.HandCards.Count(CanSelectCardCondition1));
  176. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  177. selectHandEffect.SetUp(
  178. selectPlayer: card.Owner,
  179. canTargetCondition: CanSelectFilteredCardCondtion,
  180. canTargetCondition_ByPreSelecetedList: null,
  181. canEndSelectCondition: null,
  182. maxCount: maxCount,
  183. canNoSelect: true,
  184. canEndNotMax: true,
  185. isShowOpponent: true,
  186. selectCardCoroutine: SelectCardCoroutine,
  187. afterSelectCardCoroutine: null,
  188. mode: SelectHandEffect.Mode.Custom,
  189. cardEffect: activateClass);
  190. string messagePluralize = maxCount > 1 ? "Select one or more cards to place under this Digimon. You will be able to select a second card if you only choose 1." : "Select a card to place under this Digimon.";
  191. selectHandEffect.SetUpCustomMessage(
  192. messagePluralize,
  193. $"The opponent is selecting cards to place.");
  194. yield return StartCoroutine(selectHandEffect.Activate());
  195. }
  196. else
  197. {
  198. int maxCount = Math.Min(toSelect, card.Owner.TrashCards.Count(CanSelectCardCondition1));
  199. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  200. selectCardEffect.SetUp(
  201. canTargetCondition: CanSelectFilteredCardCondtion,
  202. canTargetCondition_ByPreSelecetedList: null,
  203. canEndSelectCondition: null,
  204. canNoSelect: () => true,
  205. selectCardCoroutine: SelectCardCoroutine,
  206. afterSelectCardCoroutine: null,
  207. message: "Select link card(s)",
  208. maxCount: maxCount,
  209. canEndNotMax: true,
  210. isShowOpponent: true,
  211. mode: SelectCardEffect.Mode.Custom,
  212. root: SelectCardEffect.Root.Trash,
  213. customRootCardList: null,
  214. canLookReverseCard: true,
  215. selectPlayer: card.Owner,
  216. cardEffect: activateClass);
  217. string messagePluralize = maxCount > 1 ? "Select one or more cards to place under this Digimon. You will be able to select a second card if you only choose 1." : "Select a card to place under this Digimon.";
  218. selectCardEffect.SetUpCustomMessage(
  219. messagePluralize,
  220. $"The opponent is selecting cards to place.");
  221. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  222. }
  223. IEnumerator SelectCardCoroutine(CardSource cardSource)
  224. {
  225. if (cardSource != null)
  226. {
  227. selectedCards.Add(cardSource);
  228. toSelect--;
  229. }
  230. yield return null;
  231. }
  232. }
  233. if (selectedCards.Count == 2)
  234. {
  235. List<SelectionElement<bool>> selectionElements1 = new List<SelectionElement<bool>>()
  236. {
  237. new SelectionElement<bool>(message: $"To Top", value : true, spriteIndex: 0),
  238. new SelectionElement<bool>(message: $"To Bottom", value : false, spriteIndex: 1),
  239. };
  240. string selectPlayerMessage1 = "What order do you place the cards?";
  241. string notSelectPlayerMessage1 = "The opponent is choosing what order to place the cards.";
  242. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  243. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  244. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  245. List<CardSource> fixedCards = new List<CardSource>();
  246. bool ToTop = GManager.instance.userSelectionManager.SelectedBoolValue;
  247. selectCardEffect.SetUp(
  248. canTargetCondition: _ => true,
  249. canTargetCondition_ByPreSelecetedList: null,
  250. canEndSelectCondition: null,
  251. canNoSelect: () => false,
  252. selectCardCoroutine: null,
  253. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  254. message: "Specify the order to place the cards in the digivolution cards\n(cards will be placed so that cards with lower numbers are on top).",
  255. maxCount: selectedCards.Count,
  256. canEndNotMax: false,
  257. isShowOpponent: false,
  258. mode: SelectCardEffect.Mode.Custom,
  259. root: SelectCardEffect.Root.Custom,
  260. customRootCardList: selectedCards,
  261. canLookReverseCard: true,
  262. selectPlayer: card.Owner,
  263. cardEffect: activateClass);
  264. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Cards");
  265. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  266. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  267. {
  268. fixedCards = cardSources.Clone();
  269. fixedCards.Reverse();
  270. if (ToTop)
  271. {
  272. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsTop(fixedCards, activateClass));
  273. }
  274. else
  275. {
  276. yield return ContinuousController.instance.StartCoroutine(selectedPermanent.AddDigivolutionCardsBottom(fixedCards, activateClass));
  277. }
  278. yield return null;
  279. }
  280. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentDeletionCondition1))
  281. {
  282. SelectPermanentEffect selectPermanentEffect2 = GManager.instance.GetComponent<SelectPermanentEffect>();
  283. selectPermanentEffect2.SetUp(
  284. selectPlayer: card.Owner,
  285. canTargetCondition: CanSelectPermanentDeletionCondition1,
  286. canTargetCondition_ByPreSelecetedList: null,
  287. canEndSelectCondition: null,
  288. maxCount: 1,
  289. canNoSelect: false,
  290. canEndNotMax: false,
  291. selectPermanentCoroutine: null,
  292. afterSelectPermanentCoroutine: null,
  293. mode: SelectPermanentEffect.Mode.Destroy,
  294. cardEffect: activateClass);
  295. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect2.Activate());
  296. }
  297. }
  298. }
  299. }
  300. }
  301. #endregion
  302. #region Shared OP/WD/WA/C
  303. string SharedEffectName2 = "May play/use 1 10 cost or lower [Gammamon] text/[VB] from sources for free";
  304. string SharedEffectHash2 = "EX12_077_OP_WD_WA_C";
  305. CardEffectFactory.ActivateClassesForSharedEffects
  306. (ref cardEffects, timing, card,
  307. SharedEffectName2,
  308. SharedActivateCoroutine2,
  309. SharedEffectDescription2,
  310. additionalActivateCondition: AdditionalActivateCondition2,
  311. optional: false,
  312. isSkippable: true,
  313. maxCountPerTurn: 1,
  314. hashValue: SharedEffectHash2,
  315. onPlay: true,
  316. whenDigivolving: true,
  317. whenAttacking: true,
  318. counter: true);
  319. string SharedEffectDescription2(string tag)
  320. {
  321. return $"[{tag}] [Once Per Turn] You may play or use 1 play or use cost 10 or lower card with [Gammamon] in its text or the [VB] trait from any of your Digimon's digivolution cards without paying the cost.";
  322. }
  323. bool AdditionalActivateCondition2(Hashtable hashtable, ActivateClass activateClass)
  324. {
  325. return CardEffectCommons.HasMatchConditionPermanent(permanent => CanSelectPermanentCondition2(permanent, activateClass));
  326. }
  327. bool CanSelectCardCondition2(CardSource cardSource, ActivateClass activateClass)
  328. {
  329. return (cardSource.HasText("Gammamon")
  330. || cardSource.EqualsTraits("VB"))
  331. && cardSource.GetCostItself <= 10
  332. && ((cardSource.IsOption
  333. && !cardSource.CanNotPlayThisOption)
  334. || (cardSource.HasPlayCost
  335. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass)));
  336. }
  337. bool CanSelectPermanentCondition2(Permanent permanent, ActivateClass activateClass)
  338. {
  339. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  340. && permanent.DigivolutionCards.Some(cardSource => CanSelectCardCondition2(cardSource, activateClass));
  341. }
  342. IEnumerator SharedActivateCoroutine2(Hashtable hashtable, ActivateClass activateClass)
  343. {
  344. Permanent selectedPermanent = null;
  345. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  346. selectPermanentEffect.SetUp(
  347. selectPlayer: card.Owner,
  348. canTargetCondition: permanent => CanSelectPermanentCondition2(permanent, activateClass),
  349. canTargetCondition_ByPreSelecetedList: null,
  350. canEndSelectCondition: null,
  351. maxCount: 1,
  352. canNoSelect: true,
  353. canEndNotMax: false,
  354. selectPermanentCoroutine: selectPermanentCoroutine,
  355. afterSelectPermanentCoroutine: null,
  356. mode: SelectPermanentEffect.Mode.Custom,
  357. cardEffect: activateClass
  358. );
  359. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to play/use a source from.", "The opponent is selecting 1 Digimon to play/use a source from.");
  360. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  361. IEnumerator selectPermanentCoroutine(Permanent permanent)
  362. {
  363. selectedPermanent = permanent;
  364. yield return null;
  365. }
  366. if (selectedPermanent != null)
  367. {
  368. CardSource selectedCard = null;
  369. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  370. selectCardEffect.SetUp(
  371. canTargetCondition: cardSource => CanSelectCardCondition2(cardSource, activateClass),
  372. canTargetCondition_ByPreSelecetedList: null,
  373. canEndSelectCondition: null,
  374. canNoSelect: () => true,
  375. selectCardCoroutine: SelectCardCoroutine,
  376. afterSelectCardCoroutine: null,
  377. message: "Select 1 card to play/use",
  378. maxCount: 1,
  379. canEndNotMax: false,
  380. isShowOpponent: true,
  381. mode: SelectCardEffect.Mode.Custom,
  382. root: SelectCardEffect.Root.DigivolutionCards,
  383. customRootCardList: selectedPermanent.DigivolutionCards,
  384. canLookReverseCard: true,
  385. selectPlayer: card.Owner,
  386. cardEffect: activateClass);
  387. selectCardEffect.SetUpCustomMessage("Select 1 card to play/use.", "The opponent is selecting 1 card to play/use.");
  388. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  389. IEnumerator SelectCardCoroutine(CardSource cardSource)
  390. {
  391. selectedCard = cardSource;
  392. yield return null;
  393. }
  394. if (selectedCard != null)
  395. {
  396. if (selectedCard.IsOption)
  397. {
  398. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayOptionCards(
  399. cardSources: new List<CardSource>() { selectedCard },
  400. activateClass: activateClass,
  401. payCost: false,
  402. root: SelectCardEffect.Root.Hand));
  403. }
  404. else
  405. {
  406. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  407. new List<CardSource>() { selectedCard },
  408. activateClass: activateClass,
  409. payCost: false,
  410. isTapped: false,
  411. root: SelectCardEffect.Root.Hand,
  412. activateETB: true));
  413. }
  414. }
  415. }
  416. }
  417. #endregion
  418. return cardEffects;
  419. }
  420. }
  421. }