BT23_084.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. // Erika Mishima
  6. namespace DCGO.CardEffects.BT23
  7. {
  8. public class BT23_084 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. #region Start of Main Phase
  14. if (timing == EffectTiming.OnStartMainPhase)
  15. {
  16. bool PermamentCondition(Permanent permanent)
  17. {
  18. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  19. && permanent.TopCard.HasCSTraits;
  20. }
  21. bool Condition()
  22. {
  23. return CardEffectCommons.IsOwnerTurn(card);
  24. }
  25. cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOwnerDigimonConditionalEffect(
  26. effectDescription: "[Start of Your Main Phase] If you have a Digimon with the [CS] trait, gain 1 memory.",
  27. permamentCondition: PermamentCondition,
  28. condition: Condition,
  29. card: card));
  30. }
  31. #endregion
  32. #region End of your turn
  33. if (timing == EffectTiming.OnEndTurn)
  34. {
  35. ActivateClass activateClass = new ActivateClass();
  36. activateClass.SetUpICardEffect("By suspend this tamer & bouncing 1 [Hudie] digimon to hand, play 1 level 3 [CS] digimon to empty breeding area", CanUseCondition, card);
  37. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  38. cardEffects.Add(activateClass);
  39. string EffectDiscription()
  40. {
  41. return "[End of Your Turn] By suspending this Tamer and returning 1 of your Digimon with the [Hudie] trait to the hand, you may play 1 level 3 Digimon card with the [CS] trait from your hand to your empty breeding area without paying the cost.";
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.IsExistOnBattleArea(card)
  46. && CardEffectCommons.CanActivateSuspendCostEffect(card)
  47. && CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsHudieDigimon);
  48. }
  49. bool CanActivateCondition(Hashtable hashtable)
  50. {
  51. return CardEffectCommons.IsExistOnBattleArea(card)
  52. && CardEffectCommons.IsOwnerTurn(card);
  53. }
  54. bool IsHudieDigimon(Permanent permanent)
  55. {
  56. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  57. && permanent.TopCard.HasHudieTraits;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable hashtable)
  60. {
  61. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  62. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, IsHudieDigimon))
  63. {
  64. Permanent selectedPermament = null;
  65. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(IsHudieDigimon));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: IsHudieDigimon,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: SelectPermanentCoroutine,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Custom,
  78. cardEffect: activateClass);
  79. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  80. {
  81. selectedPermament = permanent;
  82. yield return null;
  83. }
  84. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  85. if (selectedPermament != null)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  88. targetPermanents: new List<Permanent>() { selectedPermament },
  89. activateClass: activateClass,
  90. successProcess: SuccessProcess(),
  91. failureProcess: null));
  92. IEnumerator SuccessProcess()
  93. {
  94. if (!card.Owner.GetBreedingAreaPermanents().Any())
  95. {
  96. bool CanSelectCardCondition(CardSource cardSource)
  97. {
  98. return cardSource.IsDigimon
  99. && cardSource.HasLevel && cardSource.IsLevel3
  100. && cardSource.HasCSTraits;
  101. }
  102. CardSource selectedCard = null;
  103. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  104. int maxCount = Math.Min(1, card.Owner.HandCards.Count(CanSelectCardCondition));
  105. selectHandEffect.SetUp(
  106. selectPlayer: card.Owner,
  107. canTargetCondition: CanSelectCardCondition,
  108. canTargetCondition_ByPreSelecetedList: null,
  109. canEndSelectCondition: null,
  110. maxCount: maxCount,
  111. canNoSelect: true,
  112. canEndNotMax: false,
  113. isShowOpponent: true,
  114. selectCardCoroutine: SelectCardCoroutine,
  115. afterSelectCardCoroutine: null,
  116. mode: SelectHandEffect.Mode.Custom,
  117. cardEffect: activateClass);
  118. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  119. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  120. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  121. IEnumerator SelectCardCoroutine(CardSource cardSource)
  122. {
  123. selectedCard = cardSource;
  124. yield return null;
  125. }
  126. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  127. cardSources: new List<CardSource>() { selectedCard },
  128. activateClass: activateClass,
  129. payCost: false,
  130. isTapped: false,
  131. root: SelectCardEffect.Root.Hand,
  132. activateETB: true,
  133. isBreedingArea: true));
  134. }
  135. }
  136. }
  137. }
  138. }
  139. }
  140. #endregion
  141. #region Security
  142. if (timing == EffectTiming.SecuritySkill)
  143. {
  144. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  145. }
  146. #endregion
  147. #region ESS
  148. if (timing == EffectTiming.OnAllyAttack)
  149. {
  150. bool IsHudieOrEaterLegionOrEaterEden()
  151. {
  152. return CardEffectCommons.IsExistOnBattleArea(card) &&
  153. (card.PermanentOfThisCard().TopCard.EqualsCardName("Hudiemon")
  154. || card.PermanentOfThisCard().TopCard.EqualsCardName("Eater Legion")
  155. || card.PermanentOfThisCard().TopCard.EqualsCardName("Eater EDEN"));
  156. }
  157. cardEffects.Add(CardEffectFactory.AllianceSelfEffect(isInheritedEffect: true, card: card,
  158. condition: IsHudieOrEaterLegionOrEaterEden));
  159. }
  160. #endregion
  161. #region Blank ESS
  162. if (timing == EffectTiming.OnEndTurn)
  163. {
  164. ActivateClass activateClass = new ActivateClass();
  165. activateClass.SetUpICardEffect("Placeholder to mark as having inheritable", _ => false, card);
  166. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, true, "No Effect");
  167. activateClass.SetIsInheritedEffect(true);
  168. activateClass.SetIsBackgroundProcess(true);
  169. cardEffects.Add(activateClass);
  170. IEnumerator ActivateCoroutine(Hashtable hashtable)
  171. {
  172. yield return null;
  173. }
  174. }
  175. #endregion
  176. return cardEffects;
  177. }
  178. }
  179. }