BT14_078.cs 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT14
  6. {
  7. public class BT14_078 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.OnEndTurn)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Delete this Digimon, Draw 2 and return 1 card from trash to hand", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[End of Your Turn] Delete this Digimon and <Draw 2>. Then, you may return 1 [Loogamon] from your trash to the hand.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. return cardSource.CardNames.Contains("Loogamon");
  25. }
  26. bool CanUseCondition(Hashtable hashtable)
  27. {
  28. if (CardEffectCommons.IsExistOnBattleArea(card))
  29. {
  30. if (CardEffectCommons.IsOwnerTurn(card))
  31. {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanActivateCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.IsExistOnBattleArea(card);
  40. }
  41. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  42. {
  43. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(
  44. new List<Permanent>() { card.PermanentOfThisCard() },
  45. CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  46. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  47. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  48. {
  49. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  50. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  51. selectCardEffect.SetUp(
  52. canTargetCondition: CanSelectCardCondition,
  53. canTargetCondition_ByPreSelecetedList: null,
  54. canEndSelectCondition: null,
  55. canNoSelect: () => true,
  56. selectCardCoroutine: null,
  57. afterSelectCardCoroutine: null,
  58. message: "Select 1 card to add to your hand.",
  59. maxCount: maxCount,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. mode: SelectCardEffect.Mode.AddHand,
  63. root: SelectCardEffect.Root.Trash,
  64. customRootCardList: null,
  65. canLookReverseCard: true,
  66. selectPlayer: card.Owner,
  67. cardEffect: activateClass);
  68. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  69. }
  70. }
  71. }
  72. if (timing == EffectTiming.OnDestroyedAnyone)
  73. {
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect("Trash cards from hand and delete 1 Digimon", CanUseCondition, card);
  76. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  77. cardEffects.Add(activateClass);
  78. string EffectDiscription()
  79. {
  80. return "[On Deletion] You may trash up to 3 cards with the [Dark Animal] or [SoC] trait in your hand. Then, delete 1 of your opponent's level 3 or lower Digimon. For each card trashed by this effect, add 1 to the level this effect may choose.";
  81. }
  82. bool CanSelectCardCondition(CardSource cardSource)
  83. {
  84. if (cardSource.CardTraits.Contains("Dark Animal"))
  85. {
  86. return true;
  87. }
  88. if (cardSource.CardTraits.Contains("DarkAnimal"))
  89. {
  90. return true;
  91. }
  92. if (cardSource.CardTraits.Contains("SoC"))
  93. {
  94. return true;
  95. }
  96. return false;
  97. }
  98. bool CanUseCondition(Hashtable hashtable)
  99. {
  100. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  101. }
  102. bool CanActivateCondition(Hashtable hashtable)
  103. {
  104. return CardEffectCommons.CanActivateOnDeletion(card, activateClass);
  105. }
  106. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  107. {
  108. int maxLevel = 3;
  109. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  110. {
  111. int discardCount = Math.Min(3, card.Owner.HandCards.Count(CanSelectCardCondition));
  112. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  113. selectHandEffect.SetUp(
  114. selectPlayer: card.Owner,
  115. canTargetCondition: CanSelectCardCondition,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. maxCount: discardCount,
  119. canNoSelect: true,
  120. canEndNotMax: true,
  121. isShowOpponent: true,
  122. selectCardCoroutine: null,
  123. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  124. mode: SelectHandEffect.Mode.Discard,
  125. cardEffect: activateClass);
  126. yield return StartCoroutine(selectHandEffect.Activate());
  127. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  128. {
  129. if (cardSources.Count >= 1)
  130. {
  131. maxLevel += cardSources.Count;
  132. yield return null;
  133. }
  134. }
  135. }
  136. bool CanSelectPermanentCondition(Permanent permanent)
  137. {
  138. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  139. {
  140. if (permanent.Level <= maxLevel)
  141. {
  142. if (permanent.TopCard.HasLevel)
  143. {
  144. return true;
  145. }
  146. }
  147. }
  148. return false;
  149. }
  150. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  151. {
  152. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  153. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  154. selectPermanentEffect.SetUp(
  155. selectPlayer: card.Owner,
  156. canTargetCondition: CanSelectPermanentCondition,
  157. canTargetCondition_ByPreSelecetedList: null,
  158. canEndSelectCondition: null,
  159. maxCount: maxCount,
  160. canNoSelect: false,
  161. canEndNotMax: false,
  162. selectPermanentCoroutine: null,
  163. afterSelectPermanentCoroutine: null,
  164. mode: SelectPermanentEffect.Mode.Destroy,
  165. cardEffect: activateClass);
  166. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  167. }
  168. }
  169. }
  170. return cardEffects;
  171. }
  172. }
  173. }