EX12_018.cs 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Siriusmon / Planet Punch
  6. namespace DCGO.CardEffects.EX12
  7. {
  8. public class EX12_018 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Digimon Effects
  14. #region Alt Digivolution
  15. if (timing == EffectTiming.None)
  16. {
  17. bool PermanentCondition(Permanent permanent)
  18. {
  19. return permanent.TopCard.HasVBTraits
  20. || permanent.TopCard.HasText("Gammamon");
  21. }
  22. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(PermanentCondition, 3, true, card, null, level: 5));
  23. }
  24. #endregion
  25. #region Progress
  26. if (timing == EffectTiming.None)
  27. {
  28. cardEffects.Add(CardEffectFactory.ProgressSelfStaticEffect(false, card, null));
  29. }
  30. #endregion
  31. #region Piercing
  32. if (timing == EffectTiming.OnDetermineDoSecurityCheck)
  33. {
  34. cardEffects.Add(CardEffectFactory.PierceSelfEffect(isInheritedEffect: false, card: card, condition: null));
  35. }
  36. #endregion
  37. #region Security Attack +1
  38. if (timing == EffectTiming.None)
  39. {
  40. cardEffects.Add(CardEffectFactory.ChangeSelfSAttackStaticEffect(changeValue: 1, isInheritedEffect: false, card: card, condition: null));
  41. }
  42. #endregion
  43. #region Shared WD / WA
  44. string SharedEffectName = "May place up to 2 [Gammamon] in text/[VB] trait digimon from hand or trash as top/bottom digivolution card, if placed -2000 DP for each digivolution card to 1 opponent digimon";
  45. string SharedEffectDescription(string tag) => $"[{tag}] [Once Per Turn] You may place up to 2 Digimon cards with [Gammamon] in its text or the [VB] trait from your hand or trash as this Digimon's top or bottom digivolution cards. If this effect placed, to 1 of your opponent's Digimon, give -2000 DP until their turn ends for each of this Digimon's digivolution cards.";
  46. string SharedHashValue = "EX12_018_WDWA";
  47. CardEffectFactory.ActivateClassesForSharedEffects
  48. (ref cardEffects, timing, card,
  49. SharedEffectName,
  50. SharedActivateCoroutine,
  51. SharedEffectDescription,
  52. hashValue: SharedHashValue,
  53. maxCountPerTurn: 1,
  54. optional: false,
  55. isSkippable: true,
  56. whenDigivolving: true,
  57. whenAttacking: true);
  58. bool CanSelectCardCondition(CardSource cardSource)
  59. => cardSource.IsDigimon &&
  60. (cardSource.HasVBTraits || cardSource.HasText("Gammamon"));
  61. bool CanSelectPermamentCondition(Permanent permanent) => CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  62. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  63. {
  64. bool isUsed = false;
  65. bool canSelectHand = CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition);
  66. bool canSelectTrash = CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition);
  67. if (canSelectHand || canSelectTrash)
  68. {
  69. List<CardSource> cardSources = new List<CardSource>();
  70. while (cardSources.Count < 2)
  71. {
  72. #region Setup Location Selection
  73. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
  74. if (canSelectHand) selectionElements.Add(new(message: $"From Hand", value: 1, spriteIndex: 0));
  75. if (canSelectTrash) selectionElements.Add(new(message: $"From Trash", value: 2, spriteIndex: 0));
  76. selectionElements.Add(new(message: $"Don't place any", value: 3, spriteIndex: 1));
  77. string selectPlayerMessage = "Where will you select cards from to place under this Digimon as digivolution sources?";
  78. string notSelectPlayerMessage = "The opponent is choosing to up to 2 digimon cards inside this cards digivolution source.";
  79. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  80. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  81. #endregion
  82. if (GManager.instance.userSelectionManager.SelectedIntValue == 3)
  83. {
  84. break;
  85. }
  86. else
  87. {
  88. int maxCount = Math.Max(2, 2-cardSources.Count);
  89. IEnumerator SelectCardCoroutine(CardSource cardSource)
  90. {
  91. cardSources.Add(cardSource);
  92. yield return null;
  93. }
  94. if (GManager.instance.userSelectionManager.SelectedIntValue == 1)
  95. {
  96. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  97. selectHandEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectCardCondition,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: true,
  104. canEndNotMax: true,
  105. isShowOpponent: true,
  106. selectCardCoroutine: SelectCardCoroutine,
  107. afterSelectCardCoroutine: null,
  108. mode: SelectHandEffect.Mode.Custom,
  109. cardEffect: activateClass);
  110. selectHandEffect.SetUpCustomMessage("Select up to 2 digimon cards to add to source.", "The opponent is selecting 2 digimon cards to add to source.");
  111. selectHandEffect.SetUpCustomMessage_ShowCard("Selected cards");
  112. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  113. }
  114. else
  115. {
  116. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  117. selectCardEffect.SetUp(
  118. canTargetCondition: CanSelectCardCondition,
  119. canTargetCondition_ByPreSelecetedList: null,
  120. canEndSelectCondition: null,
  121. canNoSelect: () => true,
  122. selectCardCoroutine: SelectCardCoroutine,
  123. afterSelectCardCoroutine: null,
  124. message: "Select up to 2 digimon cards",
  125. maxCount: maxCount,
  126. canEndNotMax: true,
  127. isShowOpponent: true,
  128. mode: SelectCardEffect.Mode.Custom,
  129. root: SelectCardEffect.Root.Trash,
  130. customRootCardList: null,
  131. canLookReverseCard: true,
  132. selectPlayer: card.Owner,
  133. cardEffect: activateClass);
  134. selectCardEffect.SetUpCustomMessage("Select up to 2 digimon cards to add to source.", "The opponent is selecting 2 digimon cards to add to source.");
  135. selectCardEffect.SetUpCustomMessage_ShowCard("Selected cards");
  136. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  137. }
  138. }
  139. }
  140. if (cardSources.Any())
  141. {
  142. isUsed = true;
  143. #region Setup Location Selection
  144. List<SelectionElement<bool>> selectionElements1 = new List<SelectionElement<bool>>
  145. {
  146. new(message: $"Top of digivolution sources", value: true, spriteIndex: 0),
  147. new(message: $"Bottom of digivolution sources", value: false, spriteIndex: 0)
  148. };
  149. string selectPlayerMessage1 = "Will you place up to 2 digimon cards inside this cards digivolution source?";
  150. string notSelectPlayerMessage1 = "The opponent is choosing to up to 2 digimon cards inside this cards digivolution source.";
  151. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements1, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage1, notSelectPlayerMessage: notSelectPlayerMessage1);
  152. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  153. #endregion
  154. bool isTop = GManager.instance.userSelectionManager.SelectedBoolValue;
  155. if (isTop)
  156. {
  157. List<CardSource> fixedCards = new List<CardSource>();
  158. fixedCards = cardSources.Clone();
  159. fixedCards.Reverse();
  160. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsTop(
  161. addedDigivolutionCards: fixedCards,
  162. cardEffect: activateClass));
  163. }
  164. else yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
  165. addedDigivolutionCards: cardSources,
  166. cardEffect: activateClass));
  167. if (card.PermanentOfThisCard().DigivolutionCards.Intersect(cardSources).Any() && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermamentCondition))
  168. {
  169. int dpMinus = 2000 * card.PermanentOfThisCard().DigivolutionCards.Count;
  170. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  171. selectPermanentEffect.SetUp(
  172. selectPlayer: card.Owner,
  173. canTargetCondition: CanSelectPermamentCondition,
  174. canTargetCondition_ByPreSelecetedList: null,
  175. canEndSelectCondition: null,
  176. maxCount: 1,
  177. canNoSelect: false,
  178. canEndNotMax: false,
  179. selectPermanentCoroutine: SelectPermanentCoroutine,
  180. afterSelectPermanentCoroutine: null,
  181. mode: SelectPermanentEffect.Mode.Custom,
  182. cardEffect: activateClass);
  183. selectPermanentEffect.SetUpCustomMessage($"Select 1 Digimon that will get DP -{dpMinus}.", $"The opponent is selecting 1 Digimon that will get DP -{dpMinus}.");
  184. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  185. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  186. {
  187. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -dpMinus, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  188. }
  189. }
  190. }
  191. }
  192. if (!isUsed) activateClass.RemoveUse();
  193. }
  194. #endregion
  195. #endregion
  196. #region Option Effects
  197. #region Ignore Colour Requirement
  198. if (timing == EffectTiming.None)
  199. {
  200. cardEffects.Add(CardEffectFactory.UseRequirements(card, CardCondition));
  201. bool CardCondition(CardSource cardSource)
  202. {
  203. return cardSource.HasVBTraits;
  204. }
  205. }
  206. #endregion
  207. #region Main
  208. if (timing == EffectTiming.OptionSkill)
  209. {
  210. ActivateClass activateClass = new ActivateClass();
  211. activateClass.SetUpICardEffect("Delete 1 enemy digimon with highest DP, then 1 digimon may attack", CanUseCondition, card);
  212. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  213. cardEffects.Add(activateClass);
  214. string EffectDescription()
  215. => "[Main] Delete 1 of your opponent's highest DP Digimon. Then, 1 of your Digimon may attack.";
  216. bool CanUseCondition(Hashtable hashtable)
  217. => CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  218. bool CanSelectOpponentPermanentCondition(Permanent permanent)
  219. => CardEffectCommons.IsMaxDP(permanent, card.Owner.Enemy, null);
  220. bool CanSelectOwnerPermamentCondition(Permanent permanent)
  221. => CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  222. && permanent.CanAttack(activateClass);
  223. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  224. {
  225. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOpponentPermanentCondition))
  226. {
  227. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  228. selectPermanentEffect.SetUp(
  229. selectPlayer: card.Owner,
  230. canTargetCondition: CanSelectOpponentPermanentCondition,
  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. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermamentCondition))
  244. {
  245. SelectPermanentEffect selectPermanentEffect =
  246. GManager.instance.GetComponent<SelectPermanentEffect>();
  247. selectPermanentEffect.SetUp(
  248. selectPlayer: card.Owner,
  249. canTargetCondition: CanSelectOwnerPermamentCondition,
  250. canTargetCondition_ByPreSelecetedList: null,
  251. canEndSelectCondition: null,
  252. maxCount: 1,
  253. canNoSelect: true,
  254. canEndNotMax: false,
  255. selectPermanentCoroutine: null,
  256. afterSelectPermanentCoroutine: null,
  257. mode: SelectPermanentEffect.Mode.Attack,
  258. cardEffect: activateClass);
  259. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will attack.",
  260. "The opponent is selecting 1 Digimon that will attack.");
  261. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  262. }
  263. }
  264. }
  265. #endregion
  266. #region Arts Digivolution
  267. if (timing == EffectTiming.None)
  268. {
  269. cardEffects.Add(CardEffectFactory.ArtsDigivolveEffect(card));
  270. }
  271. #endregion
  272. #endregion
  273. return cardEffects;
  274. }
  275. }
  276. }