BT16_054.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT16
  5. {
  6. public class BT16_054 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region On Play/When Digivolving Shared
  12. bool CanSelectCardCondition(CardSource cardSource)
  13. {
  14. if (cardSource.CardTraits.Contains("D-Brigade"))
  15. {
  16. return true;
  17. }
  18. if (cardSource.CardTraits.Contains("DigiPolice"))
  19. {
  20. return true;
  21. }
  22. return false;
  23. }
  24. bool CanActivateCondition(Hashtable hashtable)
  25. {
  26. if (CardEffectCommons.IsExistOnBattleArea(card))
  27. {
  28. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 3)
  29. {
  30. return true;
  31. }
  32. }
  33. return false;
  34. }
  35. #endregion
  36. #region On Play
  37. if (timing == EffectTiming.OnEnterFieldAnyone)
  38. {
  39. ActivateClass activateClass = new ActivateClass();
  40. activateClass.SetUpICardEffect("<Rush>, Can't be Blocked", CanUseCondition, card);
  41. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  42. cardEffects.Add(activateClass);
  43. string EffectDiscription()
  44. {
  45. return "[On Play] By returning 3 cards with the [D-Brigade] or [DigiPolice] trait from your trash to the top of the deck, this Digimon gains <Rush>, and can't be blocked for the turn.";
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable hashtable)
  52. {
  53. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 3)
  54. {
  55. int maxCount = 3;
  56. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  57. selectCardEffect.SetUp(
  58. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  59. canTargetCondition_ByPreSelecetedList: null,
  60. canEndSelectCondition: null,
  61. canNoSelect: () => true,
  62. selectCardCoroutine: null,
  63. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  64. message: "Select cards to place at the top of the deck\n(cards will be placed back to the top of the deck so that cards with lower numbers are on top).",
  65. maxCount: maxCount,
  66. canEndNotMax: false,
  67. isShowOpponent: false,
  68. mode: SelectCardEffect.Mode.Custom,
  69. root: SelectCardEffect.Root.Trash,
  70. customRootCardList: null,
  71. canLookReverseCard: true,
  72. selectPlayer: card.Owner,
  73. cardEffect: null);
  74. selectCardEffect.SetNotAddLog();
  75. selectCardEffect.SetUpCustomMessage_ShowCard("Deck Top Cards");
  76. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  77. }
  78. }
  79. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  80. {
  81. if (cardSources.Count == 3)
  82. {
  83. cardSources.Reverse();
  84. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(cardSources));
  85. if (CardEffectCommons.IsExistOnBattleArea(card))
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  88. targetPermanent: card.PermanentOfThisCard(),
  89. effectDuration: EffectDuration.UntilEachTurnEnd,
  90. activateClass: activateClass));
  91. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeBlocked(
  92. targetPermanent: card.PermanentOfThisCard(),
  93. defenderCondition: null,
  94. effectDuration: EffectDuration.UntilEachTurnEnd,
  95. activateClass: activateClass,
  96. effectName: "Can't be Blocked"));
  97. }
  98. }
  99. }
  100. }
  101. #endregion
  102. #region When Digivolving
  103. if (timing == EffectTiming.OnEnterFieldAnyone)
  104. {
  105. ActivateClass activateClass = new ActivateClass();
  106. activateClass.SetUpICardEffect("<Rush>, Can't be Blocked", CanUseCondition, card);
  107. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  108. cardEffects.Add(activateClass);
  109. string EffectDiscription()
  110. {
  111. return "[When Digivolving] By returning 3 cards with the [D-Brigade] or [DigiPolice] trait from your trash to the top of the deck, this Digimon gains <Rush>, and can't be blocked for the turn.";
  112. }
  113. bool CanUseCondition(Hashtable hashtable)
  114. {
  115. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  116. }
  117. IEnumerator ActivateCoroutine(Hashtable hashtable)
  118. {
  119. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 3)
  120. {
  121. int maxCount = 3;
  122. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  123. selectCardEffect.SetUp(
  124. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  125. canTargetCondition_ByPreSelecetedList: null,
  126. canEndSelectCondition: null,
  127. canNoSelect: () => true,
  128. selectCardCoroutine: null,
  129. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  130. message: "Select cards to place at the top of the deck\n(cards will be placed back to the top of the deck so that cards with lower numbers are on top).",
  131. maxCount: maxCount,
  132. canEndNotMax: false,
  133. isShowOpponent: false,
  134. mode: SelectCardEffect.Mode.Custom,
  135. root: SelectCardEffect.Root.Trash,
  136. customRootCardList: null,
  137. canLookReverseCard: true,
  138. selectPlayer: card.Owner,
  139. cardEffect: null);
  140. selectCardEffect.SetNotAddLog();
  141. selectCardEffect.SetUpCustomMessage_ShowCard("Deck Top Cards");
  142. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  143. }
  144. }
  145. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  146. {
  147. if (cardSources.Count == 3)
  148. {
  149. cardSources.Reverse();
  150. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(cardSources));
  151. if (CardEffectCommons.IsExistOnBattleArea(card))
  152. {
  153. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainRush(
  154. targetPermanent: card.PermanentOfThisCard(),
  155. effectDuration: EffectDuration.UntilEachTurnEnd,
  156. activateClass: activateClass));
  157. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeBlocked(
  158. targetPermanent: card.PermanentOfThisCard(),
  159. defenderCondition: null,
  160. effectDuration: EffectDuration.UntilEachTurnEnd,
  161. activateClass: activateClass,
  162. effectName: "Can't be Blocked"));
  163. }
  164. }
  165. }
  166. }
  167. #endregion
  168. #region Inherited Effect
  169. if (timing == EffectTiming.None)
  170. {
  171. string InheritedEffectDiscription()
  172. {
  173. return "[All Turns] All of your other Digimon with the [D-Brigade] or [DigiPolice] trait get +1000 DP.";
  174. }
  175. bool Condition()
  176. {
  177. if (CardEffectCommons.IsExistOnBattleArea(card))
  178. {
  179. return true;
  180. }
  181. return false;
  182. }
  183. bool PermanentCondition(Permanent permanent)
  184. {
  185. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleArea(permanent, card))
  186. {
  187. if (permanent != card.PermanentOfThisCard())
  188. {
  189. if (permanent.TopCard.CardTraits.Contains("D-Brigade") || permanent.TopCard.CardTraits.Contains("DigiPolice"))
  190. {
  191. return true;
  192. }
  193. }
  194. }
  195. return false;
  196. }
  197. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  198. permanentCondition: PermanentCondition,
  199. changeValue: 1000,
  200. isInheritedEffect: true,
  201. card: card,
  202. condition: Condition,
  203. effectName: InheritedEffectDiscription));
  204. }
  205. #endregion
  206. return cardEffects;
  207. }
  208. }
  209. }