BT25_091.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. // Monica Simmons
  4. namespace DCGO.CardEffects.BT25
  5. {
  6. public class BT25_091 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of turn set to 3
  12. if (timing == EffectTiming.OnStartTurn)
  13. {
  14. cardEffects.Add(CardEffectFactory.SetMemoryTo3TamerEffect(card));
  15. }
  16. #endregion
  17. #region On Play
  18. if (timing == EffectTiming.OnEnterFieldAnyone)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("May return 1 [TS] card, if not <Draw 1>", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  23. cardEffects.Add(activateClass);
  24. string EffectDescription()
  25. {
  26. return "[On Play] You may return 1 [TS] trait Option card from your trash to the hand. If this effect didn't return, <Draw 1>.";
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleArea(card)
  31. && CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  32. }
  33. bool CanActivateCondition(Hashtable hashtable)
  34. {
  35. return CardEffectCommons.IsExistOnBattleArea(card);
  36. }
  37. bool CanSelectCardCondition(CardSource cardSource)
  38. {
  39. return cardSource.IsOption
  40. && cardSource.HasTSTraits;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable hashtable)
  43. {
  44. bool returned = false;
  45. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  46. {
  47. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  48. selectCardEffect.SetUp(
  49. canTargetCondition: CanSelectCardCondition,
  50. canTargetCondition_ByPreSelecetedList: null,
  51. canEndSelectCondition: null,
  52. canNoSelect: () => true,
  53. selectCardCoroutine: null,
  54. afterSelectCardCoroutine: SelectCardCoroutine,
  55. message: "Select 1 [TS] trait Option card to return to hand",
  56. maxCount: 1,
  57. canEndNotMax: false,
  58. isShowOpponent: true,
  59. mode: SelectCardEffect.Mode.AddHand,
  60. root: SelectCardEffect.Root.Trash,
  61. customRootCardList: null,
  62. canLookReverseCard: true,
  63. selectPlayer: card.Owner,
  64. cardEffect: activateClass);
  65. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  66. IEnumerator SelectCardCoroutine(List<CardSource> cardSources)
  67. {
  68. if (cardSources.Count >= 1)
  69. {
  70. returned = true;
  71. yield return null;
  72. }
  73. yield return null;
  74. }
  75. }
  76. if (!returned)
  77. {
  78. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  79. }
  80. }
  81. }
  82. #endregion
  83. #region Your Turn
  84. if (timing == EffectTiming.OnUseOption)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("May suspend tamer to prevent enemy Digimon from attack", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  89. cardEffects.Add(activateClass);
  90. string EffectDescription()
  91. {
  92. return "[Your Turn] When you use [TS] trait Option cards, by suspending this Tamer, 1 of your opponent's Digimon can't attack until their turn ends.";
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. return CardEffectCommons.IsExistOnBattleArea(card)
  97. && CardEffectCommons.IsOwnerTurn(card)
  98. && CardEffectCommons.CanTriggerWhenOwnerUseOption(hashtable, OptionTrigger, null, card);
  99. }
  100. bool CanActivateCondition(Hashtable hashtable)
  101. {
  102. return CardEffectCommons.IsExistOnBattleArea(card)
  103. && CardEffectCommons.CanActivateSuspendCostEffect(card);
  104. }
  105. bool OptionTrigger(CardSource cardSource)
  106. {
  107. return cardSource.IsOption
  108. && cardSource.HasTSTraits;
  109. }
  110. bool CanSelectPermanentCondition(Permanent permanent)
  111. {
  112. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(
  117. new List<Permanent>() { card.PermanentOfThisCard() },
  118. CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  119. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  120. {
  121. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  122. selectPermanentEffect.SetUp(
  123. selectPlayer: card.Owner,
  124. canTargetCondition: CanSelectPermanentCondition,
  125. canTargetCondition_ByPreSelecetedList: null,
  126. canEndSelectCondition: null,
  127. maxCount: 1,
  128. canNoSelect: false,
  129. canEndNotMax: false,
  130. selectPermanentCoroutine: SelectPermanentCoroutine,
  131. afterSelectPermanentCoroutine: null,
  132. mode: SelectPermanentEffect.Mode.Custom,
  133. cardEffect: activateClass);
  134. selectPermanentEffect.SetUpCustomMessage("Select Digimon to give can't attack until their turn ends.", "The opponent is selecting Digimon to give can't attack until your turn ends.");
  135. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  136. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  137. {
  138. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotAttack(
  139. targetPermanent: permanent,
  140. defenderCondition: null,
  141. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  142. activateClass: activateClass,
  143. effectName: "Can't Attack"));
  144. }
  145. }
  146. }
  147. }
  148. #endregion
  149. #region Security
  150. if (timing == EffectTiming.SecuritySkill)
  151. {
  152. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  153. }
  154. #endregion
  155. return cardEffects;
  156. }
  157. }
  158. }