BT9_064.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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_064 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Reveal the top 3 cards of your deck. Add 1 card with [Alphamon] in its name among them to your hand, and place 1 card with [X Antibody] in its traits among them under this Digimon as its bottom digivolution card. Trash the rest.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. return cardSource.ContainsCardName("Alphamon");
  26. }
  27. bool CanSelectCardCondition1(CardSource cardSource)
  28. {
  29. if (cardSource.HasXAntibodyTraits)
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. if (!card.PermanentOfThisCard().IsToken)
  34. {
  35. return true;
  36. }
  37. }
  38. }
  39. return false;
  40. }
  41. bool CanUseCondition(Hashtable hashtable)
  42. {
  43. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. if (card.Owner.LibraryCards.Count >= 1)
  50. {
  51. return true;
  52. }
  53. }
  54. return false;
  55. }
  56. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  57. {
  58. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  59. revealCount: 3,
  60. simplifiedSelectCardConditions:
  61. new SimplifiedSelectCardConditionClass[]
  62. {
  63. new SimplifiedSelectCardConditionClass(
  64. canTargetCondition:CanSelectCardCondition,
  65. message: "Select 1 card with [Alphamon] in its name.",
  66. mode: SelectCardEffect.Mode.AddHand,
  67. maxCount: 1,
  68. selectCardCoroutine: null),
  69. new SimplifiedSelectCardConditionClass(
  70. canTargetCondition:CanSelectCardCondition1,
  71. message: "Select 1 card with [X Antibody] in its traits.",
  72. mode: SelectCardEffect.Mode.Custom,
  73. maxCount: 1,
  74. selectCardCoroutine: SelectCardCoroutine),
  75. },
  76. remainingCardsPlace: RemainingCardsPlace.Trash,
  77. activateClass: activateClass
  78. ));
  79. IEnumerator SelectCardCoroutine(CardSource cardSource)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(card))
  82. {
  83. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(new List<CardSource>() { cardSource }, activateClass));
  84. }
  85. }
  86. }
  87. }
  88. if (timing == EffectTiming.OnEndAttack)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect("Delete 1 Digimon with 5 or less Cost", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  93. activateClass.SetIsInheritedEffect(true);
  94. cardEffects.Add(activateClass);
  95. string EffectDiscription()
  96. {
  97. return "[End of Attack] If this Digimon has [Alphamon] in its name, delete 1 of your opponent's Digimon with a play cost of 5 or less.";
  98. }
  99. bool CanSelectPermanentCondition(Permanent permanent)
  100. {
  101. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  102. {
  103. if (permanent.TopCard.GetCostItself <= 5)
  104. {
  105. if (permanent.TopCard.HasPlayCost)
  106. {
  107. return true;
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  116. }
  117. bool CanActivateCondition(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleArea(card))
  120. {
  121. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  122. {
  123. if (card.PermanentOfThisCard().TopCard.ContainsCardName("Alphamon"))
  124. {
  125. return true;
  126. }
  127. }
  128. }
  129. return false;
  130. }
  131. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  132. {
  133. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  134. {
  135. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  136. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  137. selectPermanentEffect.SetUp(
  138. selectPlayer: card.Owner,
  139. canTargetCondition: CanSelectPermanentCondition,
  140. canTargetCondition_ByPreSelecetedList: null,
  141. canEndSelectCondition: null,
  142. maxCount: maxCount,
  143. canNoSelect: false,
  144. canEndNotMax: false,
  145. selectPermanentCoroutine: null,
  146. afterSelectPermanentCoroutine: null,
  147. mode: SelectPermanentEffect.Mode.Destroy,
  148. cardEffect: activateClass);
  149. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  150. }
  151. }
  152. }
  153. return cardEffects;
  154. }
  155. }