BT17_093.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System;
  5. namespace DCGO.CardEffects.BT17
  6. {
  7. public class BT17_093 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region All Turns - When you Hatch
  13. if (timing == EffectTiming.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Gain Memory", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[All Turns] When your breeding area is hatched in, by suspending this Tamer, gain 1 memory.";
  22. }
  23. bool IsDigiEggHatch(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBreedingArea(permanent, card))
  26. {
  27. return permanent.TopCard.IsDigiEgg;
  28. }
  29. return false;
  30. }
  31. bool CanUseCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnField(card))
  34. {
  35. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, IsDigiEggHatch))
  36. return true;
  37. }
  38. return false;
  39. }
  40. bool CanActivateCondition(Hashtable hashtable)
  41. {
  42. if (CardEffectCommons.IsExistOnField(card))
  43. {
  44. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  45. return true;
  46. }
  47. return false;
  48. }
  49. IEnumerator ActivateCoroutine(Hashtable hashtable)
  50. {
  51. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  52. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  53. }
  54. }
  55. #endregion
  56. #region End of Your Turn
  57. if (timing == EffectTiming.OnEndTurn)
  58. {
  59. ActivateClass activateClass = new ActivateClass();
  60. activateClass.SetUpICardEffect("Return this card to bottom of deck, draw 1. Then play a Tamer", CanUseCondition, card);
  61. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  62. cardEffects.Add(activateClass);
  63. string EffectDiscription()
  64. {
  65. return "[End of Your Turn] By returning this Tamer to the bottom of the deck, <Draw 1>. Then, you may play 1 Tamer card with [Tai Kamiya] or [Kari Kamiya] in its name from your hand without paying the cost.";
  66. }
  67. bool HasProperTamer(CardSource source)
  68. {
  69. if (source.IsTamer)
  70. {
  71. if (source.ContainsCardName("Tai Kamiya") || source.ContainsCardName("Kari Kamiya"))
  72. {
  73. return CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass);
  74. }
  75. }
  76. return false;
  77. }
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. if (CardEffectCommons.IsOwnerTurn(card))
  81. return isExistOnField(card);
  82. return false;
  83. }
  84. bool CanActivateCondition(Hashtable hashtable)
  85. {
  86. return isExistOnField(card);
  87. }
  88. IEnumerator ActivateCoroutine(Hashtable hashtable)
  89. {
  90. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>()
  91. {
  92. new SelectionElement<bool>(message: $"Yes", value : true, spriteIndex: 0),
  93. new SelectionElement<bool>(message: $"No", value : false, spriteIndex: 1),
  94. };
  95. string selectPlayerMessage = "Will you return this tamer to bottom of deck?";
  96. string notSelectPlayerMessage = "The opponent is choosing whether or not to return tamer to bottom of the deck.";
  97. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements, selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage, notSelectPlayerMessage: notSelectPlayerMessage);
  98. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  99. bool willReturn = GManager.instance.userSelectionManager.SelectedBoolValue;
  100. if (willReturn)
  101. {
  102. yield return ContinuousController.instance.StartCoroutine(new DeckBottomBounceClass(new List<Permanent> { card.PermanentOfThisCard() }, hashtable).DeckBounce());
  103. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  104. if (CardEffectCommons.HasMatchConditionOwnersHand(card, HasProperTamer))
  105. {
  106. int maxCount = Math.Min(1, card.Owner.HandCards.Count(HasProperTamer));
  107. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  108. selectHandEffect.SetUp(
  109. selectPlayer: card.Owner,
  110. canTargetCondition: HasProperTamer,
  111. canTargetCondition_ByPreSelecetedList: null,
  112. canEndSelectCondition: null,
  113. maxCount: maxCount,
  114. canNoSelect: true,
  115. canEndNotMax: false,
  116. isShowOpponent: false,
  117. selectCardCoroutine: null,
  118. afterSelectCardCoroutine: SelectCardCoroutine,
  119. mode: SelectHandEffect.Mode.Custom,
  120. cardEffect: activateClass);
  121. selectHandEffect.SetUpCustomMessage("Select Tamer to play.", "The opponent is selecting a Tamer to play.");
  122. yield return StartCoroutine(selectHandEffect.Activate());
  123. IEnumerator SelectCardCoroutine(List<CardSource> selectedCards)
  124. {
  125. if (selectedCards.Count > 0)
  126. {
  127. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  128. cardSources: selectedCards,
  129. activateClass: activateClass,
  130. payCost: false,
  131. isTapped: false,
  132. root: SelectCardEffect.Root.Hand,
  133. activateETB: true));
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. #endregion
  141. #region Security Effect
  142. if (timing == EffectTiming.SecuritySkill)
  143. {
  144. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  145. }
  146. #endregion
  147. return cardEffects;
  148. }
  149. }
  150. }