ST23_13.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Tomoro Tenma & Kyo Sawashiro
  5. namespace DCGO.CardEffects.ST23
  6. {
  7. public class ST23_13 : 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. {
  30. new(message: $"Yes", value: 1, spriteIndex: 0),
  31. new(message: $"No", value: 2, spriteIndex: 1)
  32. };
  33. string selectPlayerMessage = "Will you place the top card from your deck under this Tamer face down?";
  34. string notSelectPlayerMessage = "The opponent is choosing whether to place the top card from their deck under their Tamer face down.";
  35. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  36. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  37. bool Yes = GManager.instance.userSelectionManager.SelectedIntValue == 1;
  38. if (Yes)
  39. {
  40. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
  41. new List<CardSource> { card.Owner.LibraryCards[0] }, activateClass, isFacedown: true));
  42. }
  43. }
  44. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  45. {
  46. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  47. }
  48. }
  49. #endregion
  50. #region Your Turn
  51. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  52. {
  53. ActivateClass activateClass = new ActivateClass();
  54. activateClass.SetUpICardEffect("Suspend this tamer to give 1 of your [Glowing Dawn] Digimon +3K DP until enemy turn ends", CanUseCondition, card);
  55. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  56. cardEffects.Add(activateClass);
  57. string EffectDescription()
  58. {
  59. return "[Your Turn] When effects trash cards from under this Tamer, by suspending this Tamer, 1 of your [Glowing Dawn] trait Digimon gets +3000 DP until your opponent's turn ends.";
  60. }
  61. bool CanUseCondition(Hashtable hashtable)
  62. {
  63. return CardEffectCommons.IsExistOnBattleArea(card)
  64. && CardEffectCommons.IsOwnerTurn(card)
  65. && CardEffectCommons.CanTriggerOnTrashDigivolutionCard(hashtable, permanent => permanent == card.PermanentOfThisCard(), effect => effect != null, cardSource => true);
  66. }
  67. bool CanActivateCondition(Hashtable hashtable)
  68. {
  69. return CardEffectCommons.IsExistOnBattleArea(card)
  70. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  71. }
  72. bool CanSelectPermanentCondition(Permanent permanent)
  73. {
  74. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  75. && permanent.TopCard.EqualsTraits("Glowing Dawn");
  76. }
  77. IEnumerator ActivateCoroutine(Hashtable hashtable)
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  80. new List<Permanent>() { card.PermanentOfThisCard() },
  81. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  82. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  83. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  84. selectPermanentEffect.SetUp(
  85. selectPlayer: card.Owner,
  86. canTargetCondition: CanSelectPermanentCondition,
  87. canTargetCondition_ByPreSelecetedList: null,
  88. canEndSelectCondition: null,
  89. maxCount: maxCount,
  90. canNoSelect: false,
  91. canEndNotMax: false,
  92. selectPermanentCoroutine: SelectPermanentCoroutine,
  93. afterSelectPermanentCoroutine: null,
  94. mode: SelectPermanentEffect.Mode.Custom,
  95. cardEffect: activateClass);
  96. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get 3K DP.", "The opponent is selecting 1 Digimon that will get 3K DP.");
  97. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  98. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  99. {
  100. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  101. targetPermanent: permanent,
  102. changeValue: 3000,
  103. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  104. activateClass: activateClass));
  105. }
  106. }
  107. }
  108. #endregion
  109. #region Security Effect
  110. if (timing == EffectTiming.SecuritySkill)
  111. {
  112. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  113. }
  114. #endregion
  115. return cardEffects;
  116. }
  117. }
  118. }