BT16_073.cs 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_073 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Retaliation
  12. if (timing == EffectTiming.OnDestroyedAnyone)
  13. {
  14. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: false, card: card, condition: null));
  15. }
  16. #endregion
  17. #region On Play
  18. if (timing == EffectTiming.OnEnterFieldAnyone)
  19. {
  20. ActivateClass activateClass = new ActivateClass();
  21. activateClass.SetUpICardEffect("Draw 2 and trash 2.", CanUseCondition, card);
  22. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  23. cardEffects.Add(activateClass);
  24. string EffectDiscription()
  25. {
  26. return "[On Play] <Draw 2> and trash 2 cards in your hand.";
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  31. }
  32. bool CanActivateCondition(Hashtable hashtable)
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. if (card.Owner.LibraryCards.Count >= 1)
  37. {
  38. return true;
  39. }
  40. if (card.Owner.HandCards.Count >= 1)
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  50. if (card.Owner.HandCards.Count >= 1)
  51. {
  52. int discardCount = Math.Min(2, card.Owner.HandCards.Count);
  53. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  54. selectHandEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: (cardSource) => true,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: discardCount,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. isShowOpponent: true,
  63. selectCardCoroutine: null,
  64. afterSelectCardCoroutine: null,
  65. mode: SelectHandEffect.Mode.Discard,
  66. cardEffect: activateClass);
  67. yield return StartCoroutine(selectHandEffect.Activate());
  68. }
  69. }
  70. }
  71. #endregion
  72. #region On Deletion
  73. if (timing == EffectTiming.OnDestroyedAnyone)
  74. {
  75. ActivateClass activateClass = new ActivateClass();
  76. activateClass.SetUpICardEffect("Play 1 tamer with [Myotismon] in it's text from your trash.", CanUseCondition, card);
  77. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  78. cardEffects.Add(activateClass);
  79. string EffectDiscription()
  80. {
  81. return "[On Deletion] From your trash, you may play 1 Tamer card with [Myotismon] in it's text without the same name as one of your Tamers without paying the cost.";
  82. }
  83. bool CanSelectCardCondition(CardSource cardSource)
  84. {
  85. if (cardSource != null)
  86. {
  87. if (cardSource.Owner == card.Owner)
  88. {
  89. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  90. {
  91. if (cardSource.HasText("Myotismon") && cardSource.IsTamer)
  92. {
  93. if (!card.Owner.GetBattleAreaPermanents().Some(permanent => cardSource.HasSameCardName(permanent.TopCard)))
  94. {
  95. return true;
  96. }
  97. }
  98. }
  99. }
  100. }
  101. return false;
  102. }
  103. bool PermanentCondition(Permanent permanent)
  104. {
  105. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  106. {
  107. return true;
  108. }
  109. return false;
  110. }
  111. bool CanUseCondition(Hashtable hashtable)
  112. {
  113. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  114. }
  115. bool CanActivateCondition(Hashtable hashtable)
  116. {
  117. if (CardEffectCommons.CanActivateOnDeletion(card, activateClass))
  118. {
  119. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  120. {
  121. return true;
  122. }
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable hashtable)
  127. {
  128. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  129. {
  130. int maxCount = 1;
  131. List<CardSource> selectedCards = new List<CardSource>();
  132. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  133. selectCardEffect.SetUp(
  134. canTargetCondition: CanSelectCardCondition,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. canNoSelect: () => true,
  138. selectCardCoroutine: SelectCardCoroutine,
  139. afterSelectCardCoroutine: null,
  140. message: "Select 1 card to play.",
  141. maxCount: maxCount,
  142. canEndNotMax: false,
  143. isShowOpponent: true,
  144. mode: SelectCardEffect.Mode.Custom,
  145. root: SelectCardEffect.Root.Trash,
  146. customRootCardList: null,
  147. canLookReverseCard: true,
  148. selectPlayer: card.Owner,
  149. cardEffect: activateClass);
  150. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  151. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  152. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  153. IEnumerator SelectCardCoroutine(CardSource cardSource)
  154. {
  155. selectedCards.Add(cardSource);
  156. yield return null;
  157. }
  158. SelectCardEffect.Root root = SelectCardEffect.Root.Trash;
  159. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  160. cardSources: selectedCards,
  161. activateClass: activateClass,
  162. payCost: false,
  163. isTapped: false,
  164. root: root,
  165. activateETB: true));
  166. }
  167. }
  168. }
  169. #endregion
  170. return cardEffects;
  171. }
  172. }
  173. }