ST23_14.cs 6.8 KB

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