BT9_083.cs 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.Linq;
  5. using Photon;
  6. using System;
  7. using Photon.Pun;
  8. public class BT9_083 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.ContainsCardName("Omnimon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 3, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.OnEnterFieldAnyone)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Delete opponent's Digimon and return cards from trash to deck", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[When Digivolving] For each card with [Mega] in their traits in this Digimon's digivolution cards, delete 1 of your opponent's Digimon. Then, place 10 cards from your opponent's trash at the bottom of their deck in any order.";
  30. }
  31. bool CanSelectCardCondition(CardSource cardSource)
  32. {
  33. return cardSource.CardTraits.Contains("Mega");
  34. }
  35. bool CanSelectPermanentCondition(Permanent permanent)
  36. {
  37. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  38. {
  39. if (permanent.CanSelectBySkill(activateClass))
  40. {
  41. return true;
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  55. {
  56. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  57. {
  58. return true;
  59. }
  60. }
  61. if (card.Owner.Enemy.TrashCards.Count >= 1)
  62. {
  63. return true;
  64. }
  65. }
  66. return false;
  67. }
  68. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  69. {
  70. if (CardEffectCommons.IsExistOnBattleArea(card))
  71. {
  72. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  73. {
  74. int maxCount = Math.Min(card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition), CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  75. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  76. selectPermanentEffect.SetUp(
  77. selectPlayer: card.Owner,
  78. canTargetCondition: CanSelectPermanentCondition,
  79. canTargetCondition_ByPreSelecetedList: null,
  80. canEndSelectCondition: null,
  81. maxCount: maxCount,
  82. canNoSelect: false,
  83. canEndNotMax: false,
  84. selectPermanentCoroutine: null,
  85. afterSelectPermanentCoroutine: null,
  86. mode: SelectPermanentEffect.Mode.Destroy,
  87. cardEffect: activateClass);
  88. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  89. }
  90. if (card.Owner.Enemy.TrashCards.Count >= 1)
  91. {
  92. if (card.Owner.Enemy.TrashCards.Count == 1)
  93. {
  94. List<CardSource> libraryCards = card.Owner.Enemy.TrashCards.Clone();
  95. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(libraryCards));
  96. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect2(libraryCards, "Deck Bottom Cards", true, true));
  97. }
  98. else
  99. {
  100. int maxCount = Math.Min(10, card.Owner.Enemy.TrashCards.Count);
  101. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  102. selectCardEffect.SetUp(
  103. canTargetCondition: (cardSource) => true,
  104. canTargetCondition_ByPreSelecetedList: null,
  105. canEndSelectCondition: null,
  106. canNoSelect: () => false,
  107. selectCardCoroutine: null,
  108. afterSelectCardCoroutine: AfterSelectCardCoroutine1,
  109. message: "Select cards to place at the bottom of the deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  110. maxCount: maxCount,
  111. canEndNotMax: false,
  112. isShowOpponent: false,
  113. mode: SelectCardEffect.Mode.Custom,
  114. root: SelectCardEffect.Root.Custom,
  115. customRootCardList: card.Owner.Enemy.TrashCards,
  116. canLookReverseCard: true,
  117. selectPlayer: card.Owner,
  118. cardEffect: activateClass);
  119. selectCardEffect.SetNotShowCard();
  120. selectCardEffect.SetNotAddLog();
  121. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  122. IEnumerator AfterSelectCardCoroutine1(List<CardSource> cardSources)
  123. {
  124. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryBottomCards(cardSources));
  125. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().ShowCardEffect2(cardSources, "Deck Bottom Cards", true, true));
  126. }
  127. }
  128. }
  129. }
  130. }
  131. }
  132. if (timing == EffectTiming.OnStartTurn)
  133. {
  134. ActivateClass activateClass = new ActivateClass();
  135. activateClass.SetUpICardEffect("Trash the top card of this Digimon to trash the top card of opponent's security", CanUseCondition, card);
  136. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  137. cardEffects.Add(activateClass);
  138. string EffectDiscription()
  139. {
  140. return "[Start of Your Turn] Trash the top card of this Digimon. If you do, trash the top card of your opponent's security stack.";
  141. }
  142. bool CanUseCondition(Hashtable hashtable)
  143. {
  144. if (CardEffectCommons.IsExistOnBattleArea(card))
  145. {
  146. if (CardEffectCommons.IsOwnerTurn(card))
  147. {
  148. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  149. {
  150. return true;
  151. }
  152. }
  153. }
  154. return false;
  155. }
  156. bool CanActivateCondition(Hashtable hashtable)
  157. {
  158. if (CardEffectCommons.IsExistOnBattleArea(card))
  159. {
  160. if (card.PermanentOfThisCard().DigivolutionCards.Count >= 1)
  161. {
  162. return true;
  163. }
  164. }
  165. return false;
  166. }
  167. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  168. {
  169. Permanent permanent = card.PermanentOfThisCard();
  170. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateDebuffEffect(permanent));
  171. CardSource cardSource = permanent.TopCard;
  172. yield return ContinuousController.instance.StartCoroutine(CardObjectController.RemoveFromAllArea(cardSource));
  173. if (!cardSource.IsToken)
  174. {
  175. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddTrashCard(cardSource));
  176. }
  177. permanent.ShowingPermanentCard.ShowPermanentData(true);
  178. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().RemoveDigivolveRootEffect(cardSource, permanent));
  179. yield return ContinuousController.instance.StartCoroutine(new IDestroySecurity(
  180. player: card.Owner.Enemy,
  181. destroySecurityCount: 1,
  182. cardEffect: activateClass,
  183. fromTop: true).DestroySecurity());
  184. }
  185. }
  186. return cardEffects;
  187. }
  188. }