BT14_005.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_005 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnAllyAttack)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Return cards from trash to gain DP +2000", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  16. activateClass.SetIsInheritedEffect(true);
  17. activateClass.SetHashString("ReturnCards_BT14_005");
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Attacking][Once Per Turn] By returning 3 cards with the [D-Brigade] or [DigiPolice] trait from your trash to the top of the deck, this Digimon gets +2000 DP for the turn.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.CardTraits.Contains("D-Brigade"))
  26. {
  27. return true;
  28. }
  29. if (cardSource.CardTraits.Contains("DigiPolice"))
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 3)
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. if (card.Owner.TrashCards.Count(CanSelectCardCondition) >= 3)
  53. {
  54. int maxCount = 3;
  55. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  56. selectCardEffect.SetUp(
  57. canTargetCondition: (cardSource) => CanSelectCardCondition(cardSource),
  58. canTargetCondition_ByPreSelecetedList: null,
  59. canEndSelectCondition: null,
  60. canNoSelect: () => true,
  61. selectCardCoroutine: null,
  62. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  63. 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).",
  64. maxCount: maxCount,
  65. canEndNotMax: false,
  66. isShowOpponent: false,
  67. mode: SelectCardEffect.Mode.Custom,
  68. root: SelectCardEffect.Root.Trash,
  69. customRootCardList: null,
  70. canLookReverseCard: true,
  71. selectPlayer: card.Owner,
  72. cardEffect: activateClass);
  73. selectCardEffect.SetNotAddLog();
  74. selectCardEffect.SetUpCustomMessage_ShowCard("Deck Top Cards");
  75. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  76. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  77. {
  78. if (cardSources.Count == 3)
  79. {
  80. cardSources.Reverse();
  81. yield return ContinuousController.instance.StartCoroutine(CardObjectController.AddLibraryTopCards(cardSources));
  82. if (CardEffectCommons.IsExistOnBattleArea(card))
  83. {
  84. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(
  85. targetPermanent: card.PermanentOfThisCard(),
  86. changeValue: 2000,
  87. effectDuration: EffectDuration.UntilEachTurnEnd,
  88. activateClass: activateClass));
  89. }
  90. }
  91. }
  92. }
  93. }
  94. }
  95. return cardEffects;
  96. }
  97. }
  98. }