BT7_027.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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 BT7_027 : 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("Play 1 Digimon from digivolution cards", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] You may play 1 level 3 Digimon card from one of your Digimon's digivolution cards as another Digimon without paying its memory cost. If you do, you may place 1 blue Digimon card from your hand at the bottom of one of your Digimon's digivolution cards.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool CanSelectCardCondition(CardSource cardSource)
  35. {
  36. if (cardSource.IsDigimon)
  37. {
  38. if (cardSource.Level == 3)
  39. {
  40. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  41. {
  42. if (cardSource.HasLevel)
  43. {
  44. return true;
  45. }
  46. }
  47. }
  48. }
  49. return false;
  50. }
  51. bool CanSelectPermanentCondition1(Permanent permanent)
  52. {
  53. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  54. }
  55. bool CanSelectCardCondition1(CardSource cardSource)
  56. {
  57. if (cardSource.IsDigimon)
  58. {
  59. if (cardSource.HasCardColor(CardColor.Blue))
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. bool CanUseCondition(Hashtable hashtable)
  67. {
  68. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  69. }
  70. bool CanActivateCondition(Hashtable hashtable)
  71. {
  72. if (CardEffectCommons.IsExistOnBattleArea(card))
  73. {
  74. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  75. {
  76. return true;
  77. }
  78. }
  79. return false;
  80. }
  81. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  82. {
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  84. {
  85. Permanent selectedPermanent = null;
  86. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  87. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  88. selectPermanentEffect.SetUp(
  89. selectPlayer: card.Owner,
  90. canTargetCondition: CanSelectPermanentCondition,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. maxCount: maxCount,
  94. canNoSelect: true,
  95. canEndNotMax: false,
  96. selectPermanentCoroutine: SelectPermanentCoroutine,
  97. afterSelectPermanentCoroutine: null,
  98. mode: SelectPermanentEffect.Mode.Custom,
  99. cardEffect: activateClass);
  100. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon which has digivolution cards.", "The opponent is selecting 1 Digimon which has digivolution cards.");
  101. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  102. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  103. {
  104. selectedPermanent = permanent;
  105. yield return null;
  106. }
  107. if (selectedPermanent != null)
  108. {
  109. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  110. {
  111. maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  112. List<CardSource> selectedCards = new List<CardSource>();
  113. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  114. selectCardEffect.SetUp(
  115. canTargetCondition: CanSelectCardCondition,
  116. canTargetCondition_ByPreSelecetedList: null,
  117. canEndSelectCondition: null,
  118. canNoSelect: () => true,
  119. selectCardCoroutine: SelectCardCoroutine,
  120. afterSelectCardCoroutine: null,
  121. message: "Select 1 digivolution card to play.",
  122. maxCount: maxCount,
  123. canEndNotMax: false,
  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 1 digivolution card to play.", "The opponent is selecting 1 digivolution card to play.");
  132. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  133. yield return StartCoroutine(selectCardEffect.Activate());
  134. IEnumerator SelectCardCoroutine(CardSource cardSource)
  135. {
  136. selectedCards.Add(cardSource);
  137. yield return null;
  138. }
  139. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  140. cardSources: selectedCards,
  141. activateClass: activateClass,
  142. payCost: false,
  143. isTapped: false,
  144. root: SelectCardEffect.Root.DigivolutionCards,
  145. activateETB: true));
  146. if (selectedCards.Some(cardSource => CardEffectCommons.IsExistOnBattleArea(cardSource)))
  147. {
  148. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  149. {
  150. if (card.Owner.HandCards.Count(CanSelectCardCondition1) >= 1)
  151. {
  152. maxCount = 1;
  153. Permanent selectedPermanent1 = null;
  154. selectPermanentEffect.SetUp(
  155. selectPlayer: card.Owner,
  156. canTargetCondition: CanSelectPermanentCondition1,
  157. canTargetCondition_ByPreSelecetedList: null,
  158. canEndSelectCondition: null,
  159. maxCount: maxCount,
  160. canNoSelect: true,
  161. canEndNotMax: false,
  162. selectPermanentCoroutine: SelectPermanentCoroutine1,
  163. afterSelectPermanentCoroutine: null,
  164. mode: SelectPermanentEffect.Mode.Custom,
  165. cardEffect: activateClass);
  166. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to add digivolution cards.", "The opponent is selecting 1 Digimon to add digivolution cards.");
  167. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  168. IEnumerator SelectPermanentCoroutine1(Permanent permanent)
  169. {
  170. selectedPermanent1 = permanent;
  171. yield return null;
  172. }
  173. if (selectedPermanent1 != null)
  174. {
  175. List<CardSource> selectedCards1 = new List<CardSource>();
  176. maxCount = 1;
  177. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  178. selectHandEffect.SetUp(
  179. selectPlayer: card.Owner,
  180. canTargetCondition: CanSelectCardCondition1,
  181. canTargetCondition_ByPreSelecetedList: null,
  182. canEndSelectCondition: null,
  183. maxCount: maxCount,
  184. canNoSelect: true,
  185. canEndNotMax: false,
  186. isShowOpponent: true,
  187. selectCardCoroutine: SelectCardCoroutine1,
  188. afterSelectCardCoroutine: null,
  189. mode: SelectHandEffect.Mode.Custom,
  190. cardEffect: activateClass);
  191. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  192. yield return StartCoroutine(selectHandEffect.Activate());
  193. IEnumerator SelectCardCoroutine1(CardSource cardSource)
  194. {
  195. selectedCards1.Add(cardSource);
  196. yield return null;
  197. }
  198. if (selectedCards1.Count >= 1)
  199. {
  200. yield return ContinuousController.instance.StartCoroutine(selectedPermanent1.AddDigivolutionCardsBottom(selectedCards1, activateClass));
  201. }
  202. }
  203. }
  204. }
  205. }
  206. }
  207. }
  208. }
  209. }
  210. }
  211. return cardEffects;
  212. }
  213. }