ST24_13.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Marcus Damon & Thomas H. Norstein
  5. namespace DCGO.CardEffects.ST24
  6. {
  7. public class ST24_13 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Name Rule
  13. if (timing == EffectTiming.None)
  14. {
  15. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  16. changeCardNamesClass.SetUpICardEffect("[Rule] Name: Also treated as [Marcus Damon]/[Thomas H. Norstein].", _ => true, card);
  17. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: ChangeCardNames);
  18. cardEffects.Add(changeCardNamesClass);
  19. List<string> ChangeCardNames(CardSource cardSource, List<string> cardNames)
  20. {
  21. if (cardSource == card)
  22. {
  23. cardNames.Add("Marcus Damon");
  24. cardNames.Add("Thomas H. Norstein");
  25. }
  26. return cardNames;
  27. }
  28. }
  29. #endregion
  30. #region Shared OP/SOMP
  31. string SharedEffectName = "Place top card of deck face down under this tamer, then if enemy has Digimon gain 1 memory";
  32. CardEffectFactory.ActivateClassesForSharedEffects
  33. (ref cardEffects, timing, card,
  34. SharedEffectName,
  35. SharedActivateCoroutine,
  36. SharedEffectDescription,
  37. optional: false,
  38. onPlay: true,
  39. startOfYourMainPhase: true);
  40. string SharedEffectDescription(string tag) =>
  41. $"[{tag}] You may place the top card of your deck face down under this tamer. Then, if your opponent has a Digimon, gain 1 memory.";
  42. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  43. {
  44. if (card.Owner.LibraryCards.Count >= 1)
  45. {
  46. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
  47. selectionElements.Add(new(message: $"Yes", value: 1, spriteIndex: 0));
  48. selectionElements.Add(new(message: $"No", value: 2, spriteIndex: 1));
  49. string selectPlayerMessage = "Will you place the top card from your deck under this Tamer face down?";
  50. string notSelectPlayerMessage = "The opponent is choosing whether to place the top card from their deck under their Tamer face down.";
  51. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  52. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  53. bool Yes = GManager.instance.userSelectionManager.SelectedIntValue == 1;
  54. if (Yes)
  55. {
  56. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
  57. new List<CardSource> { card.Owner.LibraryCards[0] }, activateClass, isFacedown: true));
  58. }
  59. }
  60. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  61. {
  62. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  63. }
  64. }
  65. #endregion
  66. #region All Turns
  67. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  68. {
  69. ActivateClass activateClass = new ActivateClass();
  70. activateClass.SetUpICardEffect("Suspend this tamer to give 1 of your [DATA SQUAD] Digimon <Jamming> for the turn", CanUseCondition, card);
  71. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  72. cardEffects.Add(activateClass);
  73. string EffectDescription()
  74. {
  75. return "[Your Turn] When effects trash cards from under this Tamer, by suspending this Tamer, 1 of your [DATA SQUAD] trait Digimon gains <Jamming> for the turn.";
  76. }
  77. bool CanUseCondition(Hashtable hashtable)
  78. {
  79. return CardEffectCommons.IsExistOnBattleArea(card)
  80. && CardEffectCommons.IsOwnerTurn(card)
  81. && CardEffectCommons.CanTriggerOnTrashDigivolutionCard(hashtable, permanent => permanent == card.PermanentOfThisCard(), effect => effect != null, cardSource => true);
  82. }
  83. bool CanActivateCondition(Hashtable hashtable)
  84. {
  85. return CardEffectCommons.IsExistOnBattleArea(card);
  86. }
  87. bool CanSelectPermanentCondition(Permanent permanent)
  88. {
  89. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  90. && permanent.TopCard.EqualsTraits("DATA SQUAD");
  91. }
  92. IEnumerator ActivateCoroutine(Hashtable hashtable)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  95. new List<Permanent>() { card.PermanentOfThisCard() },
  96. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  97. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: false,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: SelectPermanentCoroutine,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Custom,
  110. cardEffect: activateClass);
  111. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Jamming.", "The opponent is selecting 1 Digimon that will get Jamming.");
  112. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  113. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainJamming(
  116. targetPermanent: permanent,
  117. effectDuration: EffectDuration.UntilEachTurnEnd,
  118. activateClass: activateClass));
  119. }
  120. }
  121. }
  122. #endregion
  123. #region Security Effect
  124. if (timing == EffectTiming.SecuritySkill)
  125. {
  126. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  127. }
  128. #endregion
  129. return cardEffects;
  130. }
  131. }
  132. }