BT3_073.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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 BT3_073 : 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.None)
  14. {
  15. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(isInheritedEffect: false, card: card, condition: null));
  16. }
  17. if (timing == EffectTiming.OnEnterFieldAnyone)
  18. {
  19. int revealCount()
  20. {
  21. return card.Owner.Enemy.GetBattleAreaDigimons().Count;
  22. }
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect($"Reveal the top cards of deck", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[When Digivolving] Reveal 1 card from the top of your deck for each Digimon your opponent has in play. You may play 1 black or red Digimon card with a level of 5 or less among them without paying its memory cost. Place the remaining cards at the bottom of your deck in any order.";
  30. }
  31. bool CanSelectCardCondition(CardSource cardSource)
  32. {
  33. if (cardSource.IsDigimon)
  34. {
  35. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  36. {
  37. if (cardSource.Level <= 5 && cardSource.HasLevel)
  38. {
  39. if (cardSource.HasCardColor(CardColor.Red))
  40. {
  41. return true;
  42. }
  43. if (cardSource.HasCardColor(CardColor.Black))
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. }
  50. return false;
  51. }
  52. bool CanUseCondition(Hashtable hashtable)
  53. {
  54. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  55. }
  56. bool CanActivateCondition(Hashtable hashtable)
  57. {
  58. if (CardEffectCommons.IsExistOnBattleArea(card))
  59. {
  60. if (card.Owner.LibraryCards.Count >= 1)
  61. {
  62. if (revealCount() >= 1)
  63. {
  64. activateClass.SetEffectName($"Reveal the top {revealCount()} cards of deck");
  65. return true;
  66. }
  67. }
  68. }
  69. return false;
  70. }
  71. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  72. {
  73. List<CardSource> selectedCards = new List<CardSource>();
  74. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  75. revealCount: revealCount(),
  76. simplifiedSelectCardConditions:
  77. new SimplifiedSelectCardConditionClass[]
  78. {
  79. new SimplifiedSelectCardConditionClass(
  80. canTargetCondition:CanSelectCardCondition,
  81. message: "Select 1 black or red Digimon card with a level of 5 or less.",
  82. mode: SelectCardEffect.Mode.Custom,
  83. maxCount: 1,
  84. selectCardCoroutine: SelectCardCoroutine),
  85. },
  86. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  87. activateClass: activateClass,
  88. canNoSelect: true
  89. ));
  90. IEnumerator SelectCardCoroutine(CardSource cardSource)
  91. {
  92. selectedCards.Add(cardSource);
  93. yield return null;
  94. }
  95. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  96. cardSources: selectedCards,
  97. activateClass: activateClass,
  98. payCost: false,
  99. isTapped: false,
  100. root: SelectCardEffect.Root.Library,
  101. activateETB: true));
  102. }
  103. }
  104. return cardEffects;
  105. }
  106. }