BT23_090.cs 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Keisuke Amasawa
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_090 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Start Of Your Turn
  13. if (timing == EffectTiming.OnStartTurn)
  14. {
  15. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  16. }
  17. #endregion
  18. #region All Turns
  19. if (timing == EffectTiming.None)
  20. {
  21. string EffectDiscription()
  22. {
  23. return "[All Turns] All of your [Hudie] Digimon get +1000 DP.";
  24. }
  25. bool Condition()
  26. {
  27. return CardEffectCommons.IsExistOnBattleArea(card);
  28. }
  29. bool PermanentCondition(Permanent permanent)
  30. {
  31. return CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card) &&
  32. permanent.TopCard.HasHudieTraits;
  33. }
  34. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  35. permanentCondition: PermanentCondition,
  36. changeValue: 1000,
  37. isInheritedEffect: false,
  38. card: card,
  39. condition: Condition,
  40. effectName: EffectDiscription));
  41. }
  42. #endregion
  43. #region End Of Your Turn
  44. if (timing == EffectTiming.OnEndTurn)
  45. {
  46. ActivateClass activateClass = new ActivateClass();
  47. activateClass.SetUpICardEffect("By suspending this tamer & bouncing 1 [Hudie] digimon to hand, play 1 [CS] tamer in hand", CanUseCondition, card);
  48. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  49. cardEffects.Add(activateClass);
  50. string EffectDiscription()
  51. {
  52. 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 Tamer card with the [CS] trait from your hand without paying the cost.";
  53. }
  54. bool CanUseCondition(Hashtable hashtable)
  55. {
  56. return CardEffectCommons.IsExistOnBattleArea(card);
  57. }
  58. bool CanActivateCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.IsExistOnBattleArea(card)
  61. && CardEffectCommons.IsOwnerTurn(card)
  62. && CardEffectCommons.CanActivateSuspendCostEffect(card) &&
  63. CardEffectCommons.HasMatchConditionPermanent(PermanentCondition);
  64. }
  65. bool PermanentCondition(Permanent permanent)
  66. {
  67. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  68. && permanent.TopCard.EqualsTraits("Hudie");
  69. }
  70. bool CardCondition(CardSource cardSource)
  71. {
  72. return cardSource.IsTamer
  73. && cardSource.HasCSTraits
  74. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  75. }
  76. IEnumerator ActivateCoroutine(Hashtable hashtable)
  77. {
  78. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  79. permanents: new List<Permanent>() { card.PermanentOfThisCard() },
  80. hashtable: hashtable).Tap()
  81. );
  82. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  83. {
  84. Permanent selectedPermanent = null;
  85. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  86. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(PermanentCondition));
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: PermanentCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: maxCount,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: SelectPermanentCoroutine,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Custom,
  98. cardEffect: activateClass);
  99. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  100. {
  101. selectedPermanent = permanent;
  102. yield return null;
  103. }
  104. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to bounce to hand.", "The opponent is selecting 1 Digimon to bounce to hand.");
  105. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  106. if (selectedPermanent != null)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  109. targetPermanents: new List<Permanent>() { selectedPermanent },
  110. activateClass: activateClass,
  111. successProcess: SuccessProcess(),
  112. failureProcess: null)
  113. );
  114. IEnumerator SuccessProcess()
  115. {
  116. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CardCondition))
  117. {
  118. CardSource selectedHandCard = null;
  119. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  120. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CardCondition));
  121. selectHandEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CardCondition,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: maxCount,
  127. canNoSelect: true,
  128. canEndNotMax: false,
  129. isShowOpponent: true,
  130. selectCardCoroutine: SelectCardCoroutine,
  131. afterSelectCardCoroutine: null,
  132. mode: SelectHandEffect.Mode.Custom,
  133. cardEffect: activateClass);
  134. IEnumerator SelectCardCoroutine(CardSource cardSource)
  135. {
  136. selectedHandCard = cardSource;
  137. yield return null;
  138. }
  139. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  140. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  141. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  142. if (selectedHandCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  143. cardSources: new List<CardSource>() { selectedHandCard },
  144. activateClass: activateClass,
  145. payCost: false,
  146. isTapped: false,
  147. root: SelectCardEffect.Root.Hand,
  148. activateETB: true)
  149. );
  150. }
  151. }
  152. }
  153. }
  154. }
  155. }
  156. #endregion
  157. #region Security
  158. if (timing == EffectTiming.SecuritySkill)
  159. {
  160. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  161. }
  162. #endregion
  163. return cardEffects;
  164. }
  165. }
  166. }