BT13_102.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT13
  4. {
  5. public class BT13_102 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnEnterFieldAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Opponent trashes 1 Tamer card or 1 option card from hand, or you gain Memory +1 and Draw 1", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Play] Your opponent may trash 1 Tamer card or Option card in their hand. If they don't, gain 1 memory and <Draw 1>.";
  19. }
  20. bool CanSelectCardCondition(CardSource cardSource)
  21. {
  22. if (cardSource.Owner == card.Owner.Enemy)
  23. {
  24. if (cardSource.IsOption)
  25. {
  26. return true;
  27. }
  28. if (cardSource.IsTamer)
  29. {
  30. return true;
  31. }
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (card.Owner.Enemy.HandCards.Count >= 1)
  44. {
  45. return true;
  46. }
  47. if (card.Owner.LibraryCards.Count >= 1)
  48. {
  49. return true;
  50. }
  51. if (card.Owner.CanAddMemory(activateClass))
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  59. {
  60. bool discarded = false;
  61. if (card.Owner.Enemy.HandCards.Count >= 1)
  62. {
  63. int discardCount = 1;
  64. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  65. selectHandEffect.SetUp(
  66. selectPlayer: card.Owner.Enemy,
  67. canTargetCondition: CanSelectCardCondition,
  68. canTargetCondition_ByPreSelecetedList: null,
  69. canEndSelectCondition: null,
  70. maxCount: discardCount,
  71. canNoSelect: true,
  72. canEndNotMax: false,
  73. isShowOpponent: true,
  74. selectCardCoroutine: null,
  75. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  76. mode: SelectHandEffect.Mode.Discard,
  77. cardEffect: activateClass);
  78. yield return StartCoroutine(selectHandEffect.Activate());
  79. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  80. {
  81. if (cardSources.Count >= 1)
  82. {
  83. discarded = true;
  84. yield return null;
  85. }
  86. }
  87. }
  88. if (!discarded)
  89. {
  90. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  91. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  92. }
  93. }
  94. }
  95. if (timing == EffectTiming.OnEnterFieldAnyone)
  96. {
  97. ActivateClass activateClass = new ActivateClass();
  98. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  99. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  100. cardEffects.Add(activateClass);
  101. string EffectDiscription()
  102. {
  103. return "[Opponent's Turn] When an effect plays a Digimon, by suspending this Tamer, gain 1 memory.";
  104. }
  105. bool PermanentCondition(Permanent permanent)
  106. {
  107. if (CardEffectCommons.IsPermanentExistsOnBattleArea(permanent))
  108. {
  109. if (permanent.IsDigimon)
  110. {
  111. return true;
  112. }
  113. }
  114. return false;
  115. }
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. if (CardEffectCommons.IsExistOnBattleArea(card))
  119. {
  120. if (CardEffectCommons.IsOpponentTurn(card))
  121. {
  122. if (CardEffectCommons.CanTriggerOnPermanentPlay(hashtable, PermanentCondition))
  123. {
  124. if (CardEffectCommons.IsByEffect(hashtable, null))
  125. {
  126. return true;
  127. }
  128. }
  129. }
  130. }
  131. return false;
  132. }
  133. bool CanActivateCondition(Hashtable hashtable)
  134. {
  135. if (CardEffectCommons.IsExistOnBattleArea(card))
  136. {
  137. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  138. {
  139. return true;
  140. }
  141. }
  142. return false;
  143. }
  144. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  145. {
  146. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  147. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  148. }
  149. }
  150. if (timing == EffectTiming.SecuritySkill)
  151. {
  152. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  153. }
  154. return cardEffects;
  155. }
  156. }
  157. }