BT23_082.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Makiko Date
  5. namespace DCGO.CardEffects.BT23
  6. {
  7. public class BT23_082 : 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 Main Phase
  13. if (timing == EffectTiming.OnStartMainPhase)
  14. {
  15. cardEffects.Add(CardEffectFactory.Gain1MemoryTamerOpponentDigimonEffect(card));
  16. }
  17. #endregion
  18. #region Your Turn
  19. if (timing == EffectTiming.OnEnterFieldAnyone)
  20. {
  21. ActivateClass activateClass = new ActivateClass();
  22. activateClass.SetUpICardEffect("By returning this card to hand, play 1 [Lopmon]/level 3 [CS] digimon from hand", CanUseCondition, card);
  23. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  24. cardEffects.Add(activateClass);
  25. string EffectDiscription()
  26. {
  27. return "[Your Turn] When any of your Digimon digivolve into a Digimon with the [Beastkin], [Holy Beast], [Cherub] or [CS] trait, by returning this Tamer to the hand, you may play 1 [Lopmon] or level 3 Digimon card with the [CS] trait from your hand without paying the cost.";
  28. }
  29. bool CanUseCondition(Hashtable hashtable)
  30. {
  31. return CardEffectCommons.IsExistOnBattleArea(card)
  32. && CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermamentCondition, null);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleArea(card)
  37. && CardEffectCommons.IsOwnerTurn(card);
  38. }
  39. bool PermamentCondition(Permanent permanent)
  40. {
  41. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card)
  42. && (permanent.TopCard.EqualsTraits("Beastkin") || permanent.TopCard.HasHolyBeastTraits || permanent.TopCard.EqualsTraits("Cherub") || permanent.TopCard.HasCSTraits);
  43. }
  44. bool CanSelectCardCondition(CardSource cardSource)
  45. {
  46. return cardSource.IsDigimon
  47. && (cardSource.EqualsCardName("Lopmon") || (cardSource.HasLevel && cardSource.IsLevel3 && cardSource.HasCSTraits))
  48. && CardEffectCommons.CanPlayAsNewPermanent(cardSource, false, activateClass);
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable hashtable)
  51. {
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.BouncePeremanentAndProcessAccordingToResult(
  53. targetPermanents: new List<Permanent>() { card.PermanentOfThisCard() },
  54. activateClass: activateClass,
  55. successProcess: SuccessProcess(),
  56. failureProcess: null));
  57. IEnumerator SuccessProcess()
  58. {
  59. if (CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelectCardCondition))
  60. {
  61. CardSource selectedCard = null;
  62. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  63. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOwnersCardCountInHand(card, CanSelectCardCondition));
  64. selectHandEffect.SetUp(
  65. selectPlayer: card.Owner,
  66. canTargetCondition: CanSelectCardCondition,
  67. canTargetCondition_ByPreSelecetedList: null,
  68. canEndSelectCondition: null,
  69. maxCount: maxCount,
  70. canNoSelect: true,
  71. canEndNotMax: false,
  72. isShowOpponent: true,
  73. selectCardCoroutine: SelectCardCoroutine,
  74. afterSelectCardCoroutine: null,
  75. mode: SelectHandEffect.Mode.Custom,
  76. cardEffect: activateClass);
  77. IEnumerator SelectCardCoroutine(CardSource cardSource)
  78. {
  79. selectedCard = cardSource;
  80. yield return null;
  81. }
  82. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  83. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  84. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  85. if (selectedCard != null) yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  86. cardSources: new List<CardSource>() { selectedCard },
  87. activateClass: activateClass,
  88. payCost: false,
  89. isTapped: false,
  90. root: SelectCardEffect.Root.Hand,
  91. activateETB: true));
  92. }
  93. }
  94. }
  95. }
  96. #endregion
  97. #region Security
  98. if (timing == EffectTiming.SecuritySkill)
  99. {
  100. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  101. }
  102. #endregion
  103. return cardEffects;
  104. }
  105. }
  106. }