ST24_14.cs 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Yoshino Fujieda & Keenan Crier
  6. namespace DCGO.CardEffects.ST24
  7. {
  8. public class ST24_14 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Name Rule
  14. if (timing == EffectTiming.None)
  15. {
  16. ChangeCardNamesClass changeCardNamesClass = new ChangeCardNamesClass();
  17. changeCardNamesClass.SetUpICardEffect("[Rule] Name: Also treated as [Yoshino Fujieda]/[Keenan Crier].", _ => true, card);
  18. changeCardNamesClass.SetUpChangeCardNamesClass(changeCardNames: ChangeCardNames);
  19. cardEffects.Add(changeCardNamesClass);
  20. List<string> ChangeCardNames(CardSource cardSource, List<string> cardNames)
  21. {
  22. if (cardSource == card)
  23. {
  24. cardNames.Add("Yoshino Fujieda");
  25. cardNames.Add("Keenan Crier");
  26. }
  27. return cardNames;
  28. }
  29. }
  30. #endregion
  31. #region Shared OP/SOMP
  32. string SharedEffectName = "Place top card of deck face down under this tamer, then if enemy has Digimon gain 1 memory";
  33. CardEffectFactory.ActivateClassesForSharedEffects
  34. (ref cardEffects, timing, card,
  35. SharedEffectName,
  36. SharedActivateCoroutine,
  37. SharedEffectDescription,
  38. optional: false,
  39. onPlay: true,
  40. startOfYourMainPhase: true);
  41. string SharedEffectDescription(string tag) =>
  42. $"[{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.";
  43. IEnumerator SharedActivateCoroutine(Hashtable hashtable, ActivateClass activateClass)
  44. {
  45. if (card.Owner.LibraryCards.Count >= 1)
  46. {
  47. List<SelectionElement<int>> selectionElements = new List<SelectionElement<int>>();
  48. selectionElements.Add(new(message: $"Yes", value: 1, spriteIndex: 0));
  49. selectionElements.Add(new(message: $"No", value: 2, spriteIndex: 1));
  50. string selectPlayerMessage = "Will you place the top card from your deck under this Tamer face down?";
  51. string notSelectPlayerMessage = "The opponent is choosing whether to place the top card from their deck under their Tamer face down.";
  52. GManager.instance.userSelectionManager.SetIntSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  53. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  54. bool Yes = GManager.instance.userSelectionManager.SelectedIntValue == 1;
  55. if (Yes)
  56. {
  57. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(
  58. new List<CardSource> { card.Owner.LibraryCards[0] }, activateClass, isFacedown: true));
  59. }
  60. }
  61. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 1)
  62. {
  63. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  64. }
  65. }
  66. #endregion
  67. #region All Turns
  68. if (timing == EffectTiming.OnDigivolutionCardDiscarded)
  69. {
  70. ActivateClass activateClass = new ActivateClass();
  71. activateClass.SetUpICardEffect("Suspend this tamer to suspend 1 enemy Digimon", CanUseCondition, card);
  72. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  73. cardEffects.Add(activateClass);
  74. string EffectDescription()
  75. {
  76. return "[All Turns] When effects trash cards from under this Tamer, by suspending this Tamer, suspend 1 of your opponent's Digimon.";
  77. }
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. return CardEffectCommons.IsExistOnBattleArea(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. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  87. }
  88. bool CanSelectPermanentCondition(Permanent permanent)
  89. {
  90. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  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: null,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Tap,
  110. cardEffect: activateClass);
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. }
  113. }
  114. #endregion
  115. #region Security Effect
  116. if (timing == EffectTiming.SecuritySkill)
  117. {
  118. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  119. }
  120. #endregion
  121. return cardEffects;
  122. }
  123. }
  124. }