BT9_080.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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_080 : 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 trash", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[On Play] Play 1 purple or yellow Digimon card with 6000 DP or less from your trash without paying its memory cost. If you have 1 or fewer security cards, you may play 1 level 6 or lower Digimon card with [Angel] or [Fallen Angel] in its traits from your trash without paying its memory cost instead.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource != null)
  26. {
  27. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  28. {
  29. if (cardSource.IsDigimon)
  30. {
  31. if (cardSource.Owner == card.Owner)
  32. {
  33. if (cardSource.HasCardColor(CardColor.Purple) || cardSource.HasCardColor(CardColor.Yellow))
  34. {
  35. if (cardSource.CardDP <= 6000)
  36. {
  37. return true;
  38. }
  39. }
  40. if (card.Owner.SecurityCards.Count <= 1)
  41. {
  42. if (cardSource.Level <= 6 && cardSource.HasLevel)
  43. {
  44. if (cardSource.CardTraits.Contains("Angel"))
  45. {
  46. return true;
  47. }
  48. if (cardSource.CardTraits.Contains("Fallen Angel"))
  49. {
  50. return true;
  51. }
  52. if (cardSource.CardTraits.Contains("FallenAngel"))
  53. {
  54. return true;
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. }
  62. return false;
  63. }
  64. bool CanUseCondition(Hashtable hashtable)
  65. {
  66. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  67. }
  68. bool CanActivateCondition(Hashtable hashtable)
  69. {
  70. if (CardEffectCommons.IsExistOnBattleArea(card))
  71. {
  72. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  73. {
  74. return true;
  75. }
  76. }
  77. return false;
  78. }
  79. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  80. {
  81. if (isExistOnField(card))
  82. {
  83. if (card.Owner.GetBattleAreaDigimons().Contains(card.PermanentOfThisCard()))
  84. {
  85. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  86. {
  87. List<CardSource> selectedCards = new List<CardSource>();
  88. int maxCount = 1;
  89. if (card.Owner.TrashCards.Count(CanSelectCardCondition) <= maxCount)
  90. {
  91. maxCount = card.Owner.TrashCards.Count(CanSelectCardCondition);
  92. }
  93. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  94. selectCardEffect.SetUp(
  95. canTargetCondition: CanSelectCardCondition,
  96. canTargetCondition_ByPreSelecetedList: null,
  97. canEndSelectCondition: CanEndSelectCondition,
  98. canNoSelect: () => false,
  99. selectCardCoroutine: SelectCardCoroutine,
  100. afterSelectCardCoroutine: null,
  101. message: "Select 1 card to play.",
  102. maxCount: maxCount,
  103. canEndNotMax: false,
  104. isShowOpponent: true,
  105. mode: SelectCardEffect.Mode.Custom,
  106. root: SelectCardEffect.Root.Trash,
  107. customRootCardList: null,
  108. canLookReverseCard: true,
  109. selectPlayer: card.Owner,
  110. cardEffect: activateClass);
  111. selectCardEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  112. selectCardEffect.SetUpCustomMessage_ShowCard("Played Card");
  113. yield return StartCoroutine(selectCardEffect.Activate());
  114. bool CanEndSelectCondition(List<CardSource> cardSources)
  115. {
  116. if (maxCount >= 1)
  117. {
  118. if (cardSources.Count <= 0)
  119. {
  120. return false;
  121. }
  122. }
  123. return true;
  124. }
  125. IEnumerator SelectCardCoroutine(CardSource cardSource)
  126. {
  127. selectedCards.Add(cardSource);
  128. yield return null;
  129. }
  130. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Trash, activateETB: true));
  131. }
  132. }
  133. }
  134. }
  135. }
  136. if (timing == EffectTiming.OnEndTurn)
  137. {
  138. ActivateClass activateClass = new ActivateClass();
  139. activateClass.SetUpICardEffect("DNA digivolve this Digimon", CanUseCondition, card);
  140. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  141. cardEffects.Add(activateClass);
  142. string EffectDiscription()
  143. {
  144. return "[End of Your Turn] You may DNA digivolve this Digimon and one of your other Digimon in play into a Digimon card in your hand for its DNA digivolve cost. ";
  145. }
  146. bool CanSelectCardCondition(CardSource cardSource)
  147. {
  148. if (cardSource != null)
  149. {
  150. if (cardSource.IsDigimon)
  151. {
  152. if (cardSource.Owner == card.Owner)
  153. {
  154. if (cardSource.CanPlayJogress(true))
  155. {
  156. if (isExistOnField(card))
  157. {
  158. if (cardSource.CanJogressFromTargetPermanent(card.PermanentOfThisCard(), true))
  159. {
  160. return true;
  161. }
  162. }
  163. }
  164. }
  165. }
  166. }
  167. return false;
  168. }
  169. bool CanUseCondition(Hashtable hashtable)
  170. {
  171. if (isExistOnField(card))
  172. {
  173. return true;
  174. }
  175. return false;
  176. }
  177. bool CanActivateCondition(Hashtable hashtable)
  178. {
  179. if (CardEffectCommons.IsExistOnBattleArea(card))
  180. {
  181. if (CardEffectCommons.IsOwnerTurn(card))
  182. {
  183. if (card.Owner.HandCards.Count >= 1)
  184. {
  185. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent != card.PermanentOfThisCard()))
  186. {
  187. return true;
  188. }
  189. }
  190. }
  191. }
  192. return false;
  193. }
  194. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  195. {
  196. if (isExistOnField(card))
  197. {
  198. yield return ContinuousController.instance.StartCoroutine(
  199. CardEffectCommons.DNADigivolvePermanentsIntoHandOrTrashCard(
  200. CanSelectCardCondition,
  201. payCost: true,
  202. isHand: true,
  203. activateClass,
  204. permanentConditions: new Func<Permanent, bool>[] { (permanent) => permanent == card.PermanentOfThisCard() }
  205. ));
  206. }
  207. }
  208. }
  209. return cardEffects;
  210. }
  211. }