BT9_066.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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_066 : 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("Place 1 card from trash to digivolution cards", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Place 1 card with [X Antibody] in its traits from your trash under this Digimon as its bottom digivolution card.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. return cardSource.HasXAntibodyTraits;
  26. }
  27. bool CanUseCondition(Hashtable hashtable)
  28. {
  29. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  30. }
  31. bool CanActivateCondition(Hashtable hashtable)
  32. {
  33. if (CardEffectCommons.IsExistOnBattleArea(card))
  34. {
  35. if (!card.PermanentOfThisCard().IsToken)
  36. {
  37. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  38. {
  39. return true;
  40. }
  41. }
  42. }
  43. return false;
  44. }
  45. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  46. {
  47. if (CardEffectCommons.IsExistOnBattleArea(card))
  48. {
  49. List<CardSource> selectedCards = new List<CardSource>();
  50. int maxCount = 1;
  51. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  52. selectCardEffect.SetUp(
  53. canTargetCondition: CanSelectCardCondition,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. canNoSelect: () => false,
  57. selectCardCoroutine: SelectCardCoroutine,
  58. afterSelectCardCoroutine: null,
  59. message: "Select 1 card to place on bottom of digivolution cards.",
  60. maxCount: maxCount,
  61. canEndNotMax: false,
  62. isShowOpponent: true,
  63. mode: SelectCardEffect.Mode.Custom,
  64. root: SelectCardEffect.Root.Trash,
  65. customRootCardList: null,
  66. canLookReverseCard: true,
  67. selectPlayer: card.Owner,
  68. cardEffect: activateClass);
  69. selectCardEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  70. selectCardEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  71. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  72. IEnumerator SelectCardCoroutine(CardSource cardSource)
  73. {
  74. selectedCards.Add(cardSource);
  75. yield return null;
  76. }
  77. if (selectedCards.Count >= 1)
  78. {
  79. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  80. }
  81. }
  82. }
  83. }
  84. if (timing == EffectTiming.OnAddDigivolutionCards)
  85. {
  86. ActivateClass activateClass = new ActivateClass();
  87. activateClass.SetUpICardEffect("De-Digivolve 1 to 1 Digimon", CanUseCondition, card);
  88. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  89. activateClass.SetHashString("De-Digivolve_BT9_066");
  90. cardEffects.Add(activateClass);
  91. string EffectDiscription()
  92. {
  93. return "[Your Turn][Once Per Turn] When an effect places a digivolution card under this Digimon, <De-Digivolve 1> 1 of your opponent's Digimon. (Trash 1 card from the top of one of your opponent's Digimon. If it has no digivolution cards, or becomes a level 3 Digimon, you can't trash any more cards.)";
  94. }
  95. bool CanSelectPermanentCondition(Permanent permanent)
  96. {
  97. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.IsOwnerTurn(card))
  104. {
  105. if (CardEffectCommons.CanTriggerOnAddDigivolutionCard(
  106. hashtable: hashtable,
  107. permanentCondition: permanent => permanent == card.PermanentOfThisCard(),
  108. cardEffectCondition: cardEffect => cardEffect != null,
  109. cardCondition: null))
  110. {
  111. return true;
  112. }
  113. }
  114. }
  115. return false;
  116. }
  117. bool CanActivateCondition(Hashtable hashtable)
  118. {
  119. if (CardEffectCommons.IsExistOnBattleArea(card))
  120. {
  121. return true;
  122. }
  123. return false;
  124. }
  125. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  126. {
  127. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  128. {
  129. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  130. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  131. selectPermanentEffect.SetUp(
  132. selectPlayer: card.Owner,
  133. canTargetCondition: CanSelectPermanentCondition,
  134. canTargetCondition_ByPreSelecetedList: null,
  135. canEndSelectCondition: null,
  136. maxCount: maxCount,
  137. canNoSelect: false,
  138. canEndNotMax: false,
  139. selectPermanentCoroutine: SelectPermanentCoroutine,
  140. afterSelectPermanentCoroutine: null,
  141. mode: SelectPermanentEffect.Mode.Custom,
  142. cardEffect: activateClass);
  143. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to De-Digivolve.", "The opponent is selecting 1 Digimon to De-Digivolve.");
  144. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  145. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  146. {
  147. Permanent selectedPermanent = permanent;
  148. yield return ContinuousController.instance.StartCoroutine(new IDegeneration(selectedPermanent, 1, activateClass).Degeneration());
  149. }
  150. }
  151. }
  152. }
  153. return cardEffects;
  154. }
  155. }