BT13_012.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT13
  6. {
  7. public class BT13_012 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.ContainsCardName("Agumon") && targetPermanent.TopCard.CardTraits.Contains("Dinosaur") && targetPermanent.TopCard.HasLevel && targetPermanent.TopCard.Level == 3;
  17. }
  18. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 2, ignoreDigivolutionRequirement: false, card: card, condition: null));
  19. }
  20. if (timing == EffectTiming.OnEnterFieldAnyone)
  21. {
  22. ActivateClass activateClass = new ActivateClass();
  23. activateClass.SetUpICardEffect("Play 1 Tamer from security", CanUseCondition, card);
  24. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  25. cardEffects.Add(activateClass);
  26. string EffectDiscription()
  27. {
  28. return "[When Digivolving] Search your security stack, and you may play 1 red or yellow Tamer card among it without paying the cost. If you did, <Recovery +1 (Deck)>. (Place the top card of your deck on top of your security stack.) Then, shuffle your security stack.";
  29. }
  30. bool CanSelectCardCondition(CardSource cardSource)
  31. {
  32. if (cardSource.IsTamer)
  33. {
  34. if (cardSource.CardColors.Contains(CardColor.Red) || cardSource.CardColors.Contains(CardColor.Yellow))
  35. {
  36. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  37. {
  38. return true;
  39. }
  40. }
  41. }
  42. return false;
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  47. }
  48. bool CanActivateCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (card.Owner.SecurityCards.Count >= 1)
  53. {
  54. return true;
  55. }
  56. }
  57. return false;
  58. }
  59. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  60. {
  61. if (card.Owner.SecurityCards.Count >= 1)
  62. {
  63. bool played = false;
  64. int maxCount = Math.Min(1, card.Owner.SecurityCards.Count(CanSelectCardCondition));
  65. List<CardSource> selectedCards = new List<CardSource>();
  66. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  67. selectCardEffect.SetUp(
  68. canTargetCondition: CanSelectCardCondition,
  69. canTargetCondition_ByPreSelecetedList: null,
  70. canEndSelectCondition: null,
  71. canNoSelect: () => true,
  72. selectCardCoroutine: SelectCardCoroutine,
  73. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  74. message: "Select 1 Tamer to play.",
  75. maxCount: maxCount,
  76. canEndNotMax: false,
  77. isShowOpponent: true,
  78. mode: SelectCardEffect.Mode.Custom,
  79. root: SelectCardEffect.Root.Security,
  80. customRootCardList: null,
  81. canLookReverseCard: true,
  82. selectPlayer: card.Owner,
  83. cardEffect: activateClass);
  84. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  85. IEnumerator SelectCardCoroutine(CardSource cardSource)
  86. {
  87. selectedCards.Add(cardSource);
  88. yield return null;
  89. }
  90. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  91. {
  92. if (cardSources.Count >= 1)
  93. {
  94. yield return ContinuousController.instance.StartCoroutine(new IReduceSecurity(
  95. player: card.Owner,
  96. refSkillInfos: ref ContinuousController.instance.nullSkillInfos,
  97. activateClass).ReduceSecurity());
  98. }
  99. yield return null;
  100. }
  101. if (selectedCards.Count(selectedCard => CardEffectCommons.CanPlayAsNewPermanent(cardSource: selectedCard, payCost: false, cardEffect: activateClass)) >= 1)
  102. {
  103. played = true;
  104. }
  105. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Security, activateETB: true));
  106. if (played)
  107. {
  108. yield return ContinuousController.instance.StartCoroutine(new IRecovery(card.Owner, 1, activateClass).Recovery());
  109. }
  110. if (card.Owner.SecurityCards.Count >= 1)
  111. {
  112. ContinuousController.instance.PlaySE(GManager.instance.ShuffleSE);
  113. card.Owner.SecurityCards = RandomUtility.ShuffledDeckCards(card.Owner.SecurityCards);
  114. }
  115. }
  116. }
  117. }
  118. if (timing == EffectTiming.OnTappedAnyone)
  119. {
  120. ActivateClass activateClass = new ActivateClass();
  121. activateClass.SetUpICardEffect("Delete 1 Digimon with 3000 DP or less", CanUseCondition, card);
  122. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  123. activateClass.SetIsInheritedEffect(true);
  124. activateClass.SetHashString("Delete_BT13_012");
  125. cardEffects.Add(activateClass);
  126. string EffectDiscription()
  127. {
  128. return "[Your Turn][Once Per Turn] When one of your red or yellow Tamers becomes suspended, you may delete 1 of your opponent's Digimon with 3000 DP or less.";
  129. }
  130. bool PermanentCondition(Permanent permanent)
  131. {
  132. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  133. {
  134. if (permanent.IsTamer)
  135. {
  136. if (permanent.TopCard.CardColors.Contains(CardColor.Red))
  137. {
  138. return true;
  139. }
  140. if (permanent.TopCard.CardColors.Contains(CardColor.Yellow))
  141. {
  142. return true;
  143. }
  144. }
  145. }
  146. return false;
  147. }
  148. bool CanSelectPermanentCondition(Permanent permanent)
  149. {
  150. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  151. {
  152. if (permanent.DP <= card.Owner.MaxDP_DeleteEffect(3000, activateClass))
  153. {
  154. return true;
  155. }
  156. }
  157. return false;
  158. }
  159. bool CanUseCondition(Hashtable hashtable)
  160. {
  161. if (CardEffectCommons.IsExistOnBattleArea(card))
  162. {
  163. if (CardEffectCommons.IsOwnerTurn(card))
  164. {
  165. if (CardEffectCommons.CanTriggerWhenPermanentSuspends(hashtable, PermanentCondition))
  166. {
  167. return true;
  168. }
  169. }
  170. }
  171. return false;
  172. }
  173. bool CanActivateCondition(Hashtable hashtable)
  174. {
  175. if (CardEffectCommons.IsExistOnBattleArea(card))
  176. {
  177. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  178. {
  179. return true;
  180. }
  181. }
  182. return false;
  183. }
  184. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  185. {
  186. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  187. {
  188. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  189. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  190. selectPermanentEffect.SetUp(
  191. selectPlayer: card.Owner,
  192. canTargetCondition: CanSelectPermanentCondition,
  193. canTargetCondition_ByPreSelecetedList: null,
  194. canEndSelectCondition: null,
  195. maxCount: maxCount,
  196. canNoSelect: false,
  197. canEndNotMax: false,
  198. selectPermanentCoroutine: null,
  199. afterSelectPermanentCoroutine: null,
  200. mode: SelectPermanentEffect.Mode.Destroy,
  201. cardEffect: activateClass);
  202. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  203. }
  204. }
  205. }
  206. return cardEffects;
  207. }
  208. }
  209. }