BT4_071.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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 BT4_071 : 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.OnDestroyedAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal the top 2 cards of deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn] When one of your other Digimon with [D-Brigade] in its type is deleted, reveal the top 2 cards of your deck. You may play 1 [Commandramon] among them without paying its memory cost. Place the remaining cards at the bottom of your deck in any order.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  26. {
  27. if (cardSource.CardNames.Contains("Commandramon"))
  28. {
  29. return true;
  30. }
  31. }
  32. return false;
  33. }
  34. bool PermanentCondition(Permanent permanent)
  35. {
  36. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  37. {
  38. if (permanent != card.PermanentOfThisCard())
  39. {
  40. if (permanent.TopCard.CardTraits.Contains("D-Brigade"))
  41. {
  42. return true;
  43. }
  44. }
  45. }
  46. return false;
  47. }
  48. bool CanUseCondition(Hashtable hashtable)
  49. {
  50. if (CardEffectCommons.IsExistOnBattleArea(card))
  51. {
  52. if (CardEffectCommons.CanTriggerOnPermanentDeleted(hashtable, PermanentCondition, activateClass))
  53. {
  54. if (CardEffectCommons.IsOwnerTurn(card))
  55. {
  56. return true;
  57. }
  58. }
  59. }
  60. return false;
  61. }
  62. bool CanActivateCondition(Hashtable hashtable)
  63. {
  64. if (CardEffectCommons.IsExistOnBattleArea(card))
  65. {
  66. if (card.Owner.LibraryCards.Count >= 1)
  67. {
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  74. {
  75. List<CardSource> selectedCards = new List<CardSource>();
  76. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  77. revealCount: 2,
  78. simplifiedSelectCardConditions:
  79. new SimplifiedSelectCardConditionClass[]
  80. {
  81. new SimplifiedSelectCardConditionClass(
  82. canTargetCondition:CanSelectCardCondition,
  83. message: "Select 1 [Commandramon].",
  84. mode: SelectCardEffect.Mode.Custom,
  85. maxCount: 1,
  86. selectCardCoroutine: SelectCardCoroutine),
  87. },
  88. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  89. activateClass: activateClass,
  90. canNoSelect: true
  91. ));
  92. IEnumerator SelectCardCoroutine(CardSource cardSource)
  93. {
  94. selectedCards.Add(cardSource);
  95. yield return null;
  96. }
  97. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  98. cardSources: selectedCards,
  99. activateClass: activateClass,
  100. payCost: false,
  101. isTapped: false,
  102. root: SelectCardEffect.Root.Library,
  103. activateETB: true));
  104. }
  105. }
  106. return cardEffects;
  107. }
  108. }