BT7_029.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  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_029 : 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("Return 1 digivolution card and return 1 Digimon to hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  18. activateClass.SetHashString("Bounce_BT7_029");
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[When Digivolving][Once Per Turn] You may return 1 card with [Hybrid] in its traits from this Digimon's digivolution cards to your hand to return 1 of your opponent's Digimon with the same level as the returned card to its owner's hand. Trash all of the digivolution cards of that Digimon.";
  23. }
  24. bool CanSelectCardCondition(CardSource cardSource)
  25. {
  26. return cardSource.CardTraits.Contains("Hybrid");
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  31. }
  32. bool CanActivateCondition(Hashtable hashtable)
  33. {
  34. if (CardEffectCommons.IsExistOnBattleArea(card))
  35. {
  36. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  37. {
  38. return true;
  39. }
  40. }
  41. return false;
  42. }
  43. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  44. {
  45. Permanent selectedPermanent = card.PermanentOfThisCard();
  46. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  47. {
  48. int maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  49. CardSource selectedCard = null;
  50. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  51. selectCardEffect.SetUp(
  52. canTargetCondition: CanSelectCardCondition,
  53. canTargetCondition_ByPreSelecetedList: null,
  54. canEndSelectCondition: null,
  55. canNoSelect: () => false,
  56. selectCardCoroutine: null,
  57. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  58. message: "Select 1 card to add to your hand.",
  59. maxCount: maxCount,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. mode: SelectCardEffect.Mode.AddHand,
  63. root: SelectCardEffect.Root.Custom,
  64. customRootCardList: selectedPermanent.DigivolutionCards,
  65. canLookReverseCard: true,
  66. selectPlayer: card.Owner,
  67. cardEffect: activateClass);
  68. yield return StartCoroutine(selectCardEffect.Activate());
  69. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  70. {
  71. foreach (CardSource cardSource in cardSources)
  72. {
  73. selectedCard = cardSource;
  74. }
  75. yield return null;
  76. }
  77. if (selectedCard != null)
  78. {
  79. bool CanSelectPermanentCondition(Permanent permanent)
  80. {
  81. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  82. {
  83. if (permanent.Level == selectedCard.Level)
  84. {
  85. if (permanent.TopCard.HasLevel && selectedCard.HasLevel)
  86. {
  87. return true;
  88. }
  89. }
  90. }
  91. return false;
  92. }
  93. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  94. {
  95. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  96. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  97. selectPermanentEffect.SetUp(
  98. selectPlayer: card.Owner,
  99. canTargetCondition: CanSelectPermanentCondition,
  100. canTargetCondition_ByPreSelecetedList: null,
  101. canEndSelectCondition: null,
  102. maxCount: maxCount,
  103. canNoSelect: false,
  104. canEndNotMax: false,
  105. selectPermanentCoroutine: null,
  106. afterSelectPermanentCoroutine: null,
  107. mode: SelectPermanentEffect.Mode.Bounce,
  108. cardEffect: activateClass);
  109. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  110. }
  111. }
  112. }
  113. }
  114. }
  115. if (timing == EffectTiming.OnAllyAttack)
  116. {
  117. ActivateClass activateClass = new ActivateClass();
  118. activateClass.SetUpICardEffect("Return 1 digivolution card and return 1 Digimon to hand", CanUseCondition, card);
  119. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  120. activateClass.SetHashString("Bounce_BT7_029");
  121. cardEffects.Add(activateClass);
  122. string EffectDiscription()
  123. {
  124. return "[When Attacking][Once Per Turn] You may return 1 card with [Hybrid] in its traits from this Digimon's digivolution cards to your hand to return 1 of your opponent's Digimon with the same level as the returned card to its owner's hand. Trash all of the digivolution cards of that Digimon.";
  125. }
  126. bool CanSelectCardCondition(CardSource cardSource)
  127. {
  128. return cardSource.CardTraits.Contains("Hybrid");
  129. }
  130. bool CanUseCondition(Hashtable hashtable)
  131. {
  132. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  133. }
  134. bool CanActivateCondition(Hashtable hashtable)
  135. {
  136. if (CardEffectCommons.IsExistOnBattleArea(card))
  137. {
  138. if (card.PermanentOfThisCard().DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  139. {
  140. return true;
  141. }
  142. }
  143. return false;
  144. }
  145. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  146. {
  147. Permanent selectedPermanent = card.PermanentOfThisCard();
  148. if (selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition) >= 1)
  149. {
  150. int maxCount = Math.Min(1, selectedPermanent.DigivolutionCards.Count(CanSelectCardCondition));
  151. CardSource selectedCard = null;
  152. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  153. selectCardEffect.SetUp(
  154. canTargetCondition: CanSelectCardCondition,
  155. canTargetCondition_ByPreSelecetedList: null,
  156. canEndSelectCondition: null,
  157. canNoSelect: () => false,
  158. selectCardCoroutine: null,
  159. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  160. message: "Select 1 card to add to your hand.",
  161. maxCount: maxCount,
  162. canEndNotMax: false,
  163. isShowOpponent: true,
  164. mode: SelectCardEffect.Mode.AddHand,
  165. root: SelectCardEffect.Root.Custom,
  166. customRootCardList: selectedPermanent.DigivolutionCards,
  167. canLookReverseCard: true,
  168. selectPlayer: card.Owner,
  169. cardEffect: activateClass);
  170. yield return StartCoroutine(selectCardEffect.Activate());
  171. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  172. {
  173. foreach (CardSource cardSource in cardSources)
  174. {
  175. selectedCard = cardSource;
  176. }
  177. yield return null;
  178. }
  179. if (selectedCard != null)
  180. {
  181. bool CanSelectPermanentCondition(Permanent permanent)
  182. {
  183. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  184. {
  185. if (permanent.Level == selectedCard.Level)
  186. {
  187. return true;
  188. }
  189. }
  190. return false;
  191. }
  192. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  193. {
  194. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  195. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  196. selectPermanentEffect.SetUp(
  197. selectPlayer: card.Owner,
  198. canTargetCondition: CanSelectPermanentCondition,
  199. canTargetCondition_ByPreSelecetedList: null,
  200. canEndSelectCondition: null,
  201. maxCount: maxCount,
  202. canNoSelect: false,
  203. canEndNotMax: false,
  204. selectPermanentCoroutine: null,
  205. afterSelectPermanentCoroutine: null,
  206. mode: SelectPermanentEffect.Mode.Bounce,
  207. cardEffect: activateClass);
  208. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  209. }
  210. }
  211. }
  212. }
  213. }
  214. if (timing == EffectTiming.OnAddHand)
  215. {
  216. ActivateClass activateClass = new ActivateClass();
  217. activateClass.SetUpICardEffect("Unsuspend 1 Digimon", CanUseCondition, card);
  218. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  219. activateClass.SetHashString("Unsuspend_BT7_029");
  220. cardEffects.Add(activateClass);
  221. string EffectDiscription()
  222. {
  223. return "[Your Turn][Once Per Turn] When an effect adds a card to your hand, you may unsuspend 1 of your Digimon.";
  224. }
  225. bool CanSelectPermanentCondition(Permanent permanent)
  226. {
  227. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  228. }
  229. bool CanUseCondition(Hashtable hashtable)
  230. {
  231. if (CardEffectCommons.IsExistOnBattleArea(card))
  232. {
  233. if (CardEffectCommons.IsOwnerTurn(card))
  234. {
  235. if (CardEffectCommons.CanTriggerWhenAddHand(hashtable, player => player == card.Owner, cardEffect => cardEffect != null))
  236. {
  237. return true;
  238. }
  239. }
  240. }
  241. return false;
  242. }
  243. bool CanActivateCondition(Hashtable hashtable)
  244. {
  245. if (CardEffectCommons.IsExistOnBattleArea(card))
  246. {
  247. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  248. {
  249. return true;
  250. }
  251. }
  252. return false;
  253. }
  254. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  255. {
  256. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  257. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  258. selectPermanentEffect.SetUp(
  259. selectPlayer: card.Owner,
  260. canTargetCondition: CanSelectPermanentCondition,
  261. canTargetCondition_ByPreSelecetedList: null,
  262. canEndSelectCondition: null,
  263. maxCount: maxCount,
  264. canNoSelect: false,
  265. canEndNotMax: false,
  266. selectPermanentCoroutine: null,
  267. afterSelectPermanentCoroutine: null,
  268. mode: SelectPermanentEffect.Mode.UnTap,
  269. cardEffect: activateClass);
  270. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  271. }
  272. }
  273. return cardEffects;
  274. }
  275. }