BT20_091.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT20
  4. {
  5. public class BT20_091 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Your Turn
  11. if (timing == EffectTiming.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("<Draw 1> and gain 1 memory", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -11, true, EffectDescription());
  16. cardEffects.Add(activateClass);
  17. string EffectDescription()
  18. {
  19. return "[Your Turn] When your Digimon are played or digivolve, if any of them have the [Royal Knight] trait, by suspending this Tamer, <Draw 1> and gain 1 memory.";
  20. }
  21. bool PermanentConditionNSoEnterField(Permanent permanent)
  22. {
  23. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  24. {
  25. if (permanent.TopCard.EqualsTraits("Royal Knight"))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. if (CardEffectCommons.IsOwnerTurn(card))
  37. {
  38. if(CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentConditionNSoEnterField))
  39. {
  40. return true;
  41. }
  42. if (CardEffectCommons.CanTriggerWhenPermanentDigivolving(hashtable, PermanentConditionNSoEnterField))
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. return false;
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. return CardEffectCommons.IsExistOnBattleArea(card) &&
  53. CardEffectCommons.CanActivateSuspendCostEffect(card);
  54. }
  55. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  56. {
  57. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  58. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  59. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  60. }
  61. }
  62. #endregion
  63. #region Opponents Turn
  64. if (timing == EffectTiming.WhenRemoveField)
  65. {
  66. ActivateClass activateClass = new ActivateClass();
  67. activateClass.SetUpICardEffect("Play 1 [Omekamon] from your hand", CanUseCondition, card);
  68. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  69. activateClass.SetHashString("PlayCard_BT20-091");
  70. cardEffects.Add(activateClass);
  71. string EffectDiscription()
  72. {
  73. return "[Opponent's Turn] [Once Per Turn] When any of your Digimon with the [Royal Knight] trait would leave the battle area, you may play 1 [Omekamon] from your hand without paying the cost.";
  74. }
  75. bool IsOmekamon(CardSource source)
  76. {
  77. return source.EqualsCardName("Omekamon") &&
  78. CardEffectCommons.CanPlayAsNewPermanent(source, false, activateClass);
  79. }
  80. bool PermanentCondition(Permanent permanent)
  81. {
  82. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  83. {
  84. if (permanent != card.PermanentOfThisCard())
  85. {
  86. if (permanent.TopCard.EqualsTraits("Royal Knight"))
  87. {
  88. return true;
  89. }
  90. }
  91. }
  92. return false;
  93. }
  94. bool CanUseCondition(Hashtable hashtable)
  95. {
  96. if (CardEffectCommons.IsExistOnBattleArea(card))
  97. {
  98. if (CardEffectCommons.CanTriggerWhenPermanentRemoveField(hashtable, PermanentCondition))
  99. {
  100. return true;
  101. }
  102. }
  103. return false;
  104. }
  105. bool CanActivateCondition(Hashtable hashtable)
  106. {
  107. return CardEffectCommons.IsExistOnBattleArea(card) &&
  108. CardEffectCommons.HasMatchConditionOwnersHand(card, IsOmekamon);
  109. }
  110. IEnumerator ActivateCoroutine(Hashtable hashtable)
  111. {
  112. List<CardSource> selectedCards = new List<CardSource>();
  113. int maxCount = 1;
  114. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  115. selectHandEffect.SetUp(
  116. selectPlayer: card.Owner,
  117. canTargetCondition: IsOmekamon,
  118. canTargetCondition_ByPreSelecetedList: null,
  119. canEndSelectCondition: null,
  120. maxCount: maxCount,
  121. canNoSelect: true,
  122. canEndNotMax: false,
  123. isShowOpponent: true,
  124. selectCardCoroutine: SelectCardCoroutine,
  125. afterSelectCardCoroutine: null,
  126. mode: SelectHandEffect.Mode.Custom,
  127. cardEffect: activateClass);
  128. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  129. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  130. yield return StartCoroutine(selectHandEffect.Activate());
  131. IEnumerator SelectCardCoroutine(CardSource cardSource)
  132. {
  133. selectedCards.Add(cardSource);
  134. yield return null;
  135. }
  136. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  137. }
  138. }
  139. #endregion
  140. #region Security Effect
  141. if (timing == EffectTiming.SecuritySkill)
  142. {
  143. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  144. }
  145. #endregion
  146. return cardEffects;
  147. }
  148. }
  149. }