BT9_111.cs 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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_111 : 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.CardNames.Contains("Alphamon") && targetPermanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Ouryumon")) >= 1;
  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 all Digimon with the highest play cost", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[When Digivolving] Delete all of your opponent's Digimon with the highest play cost.";
  30. }
  31. bool PermanentCondition(Permanent permanent)
  32. {
  33. return CardEffectCommons.IsMaxCost(permanent, card.Owner.Enemy, true);
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (CardEffectCommons.HasMatchConditionPermanent(PermanentCondition))
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. List<Permanent> destroyTargetPermanents = card.Owner.Enemy.GetBattleAreaDigimons().Filter(PermanentCondition);
  53. yield return ContinuousController.instance.StartCoroutine(new DestroyPermanentsClass(destroyTargetPermanents, CardEffectCommons.CardEffectHashtable(activateClass)).Destroy());
  54. }
  55. }
  56. if (timing == EffectTiming.OnEndTurn)
  57. {
  58. ActivateClass activateClass = new ActivateClass();
  59. activateClass.SetUpICardEffect("Return digivolution cards from this Digimon to deck to gain Memory", CanUseCondition, card);
  60. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  61. activateClass.SetHashString("Memory+_BT9_111");
  62. cardEffects.Add(activateClass);
  63. string EffectDiscription()
  64. {
  65. return "[End of Your Turn][Once Per Turn] You may return up to 7 non-Digi-Egg cards with [X Antibody] in their traits from this Digimon's digivolution cards to the bottom of your deck in any order; if you do, gain 1 memory for each card returned.";
  66. }
  67. bool CanSelectCardCondition(CardSource cardSource)
  68. {
  69. if (!cardSource.IsDigiEgg)
  70. {
  71. if (cardSource.HasXAntibodyTraits)
  72. {
  73. return true;
  74. }
  75. }
  76. return false;
  77. }
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. if (CardEffectCommons.IsExistOnBattleArea(card))
  81. {
  82. if (CardEffectCommons.IsOwnerTurn(card))
  83. {
  84. return true;
  85. }
  86. }
  87. return false;
  88. }
  89. bool CanActivateCondition(Hashtable hashtable)
  90. {
  91. if (CardEffectCommons.IsExistOnBattleArea(card))
  92. {
  93. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  94. {
  95. return true;
  96. }
  97. }
  98. return false;
  99. }
  100. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  101. {
  102. if (CardEffectCommons.IsExistOnBattleArea(card))
  103. {
  104. Permanent selectedPermanent = card.PermanentOfThisCard();
  105. List<CardSource> selectedCards = new List<CardSource>();
  106. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) == 1)
  107. {
  108. selectedCards = card.PermanentOfThisCard().DigivolutionCards.Filter(CanSelectCardCondition).Clone();
  109. }
  110. else
  111. {
  112. int maxCount = Math.Min(7, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  113. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  114. selectCardEffect.SetUp(
  115. canTargetCondition: CanSelectCardCondition,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: CanEndSelectCondition,
  118. canNoSelect: () => false,
  119. selectCardCoroutine: SelectCardCoroutine,
  120. afterSelectCardCoroutine: null,
  121. message: "Select cards that will return to the bottom of deck\n(cards will be placed back to the bottom of the deck so that cards with lower numbers are on top).",
  122. maxCount: maxCount,
  123. canEndNotMax: true,
  124. isShowOpponent: true,
  125. mode: SelectCardEffect.Mode.Custom,
  126. root: SelectCardEffect.Root.Custom,
  127. customRootCardList: selectedPermanent.DigivolutionCards,
  128. canLookReverseCard: true,
  129. selectPlayer: card.Owner,
  130. cardEffect: activateClass);
  131. selectCardEffect.SetUpCustomMessage("Select digivolution cards to return to the bottom of deck.", "The opponent is selecting digivolution cards to return to the bottom of deck.");
  132. selectCardEffect.SetNotShowCard();
  133. yield return StartCoroutine(selectCardEffect.Activate());
  134. bool CanEndSelectCondition(List<CardSource> cardSources)
  135. {
  136. if (CardEffectCommons.HasNoElement(cardSources))
  137. {
  138. return false;
  139. }
  140. return true;
  141. }
  142. IEnumerator SelectCardCoroutine(CardSource cardSource)
  143. {
  144. selectedCards.Add(cardSource);
  145. yield return null;
  146. }
  147. }
  148. if (selectedCards.Count >= 1)
  149. {
  150. yield return ContinuousController.instance.StartCoroutine(new ReturnToLibraryBottomDigivolutionCardsClass(card.PermanentOfThisCard(), selectedCards, CardEffectCommons.CardEffectHashtable(activateClass)).ReturnToLibraryBottomDigivolutionCards());
  151. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(selectedCards.Count, activateClass));
  152. }
  153. }
  154. }
  155. }
  156. return cardEffects;
  157. }
  158. }