BT1_078.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 BT1_078 : 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.OnAllyAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Attacking] Reveal 3 cards from the top of your deck. You can digivolve this card into 1 level 6 green Digimon card 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 (cardSource.IsDigimon)
  26. {
  27. if (cardSource.Level == 6)
  28. {
  29. if (cardSource.HasCardColor(CardColor.Green))
  30. {
  31. if (CardEffectCommons.IsExistOnBattleArea(card))
  32. {
  33. if (cardSource.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass))
  34. {
  35. if (cardSource.HasLevel)
  36. {
  37. return true;
  38. }
  39. }
  40. }
  41. }
  42. }
  43. }
  44. return false;
  45. }
  46. bool CanUseCondition(Hashtable hashtable)
  47. {
  48. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  49. }
  50. bool CanActivateCondition(Hashtable hashtable)
  51. {
  52. if (CardEffectCommons.IsExistOnBattleArea(card))
  53. {
  54. if (card.Owner.LibraryCards.Count >= 1)
  55. {
  56. return true;
  57. }
  58. }
  59. return false;
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. CardSource selectedCard = null;
  64. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  65. revealCount: 3,
  66. simplifiedSelectCardConditions:
  67. new SimplifiedSelectCardConditionClass[]
  68. {
  69. new SimplifiedSelectCardConditionClass(
  70. canTargetCondition:CanSelectCardCondition,
  71. message: "Select 1 level 6 green Digimon card.",
  72. mode: SelectCardEffect.Mode.Custom,
  73. maxCount: 1,
  74. selectCardCoroutine: SelectCardCoroutine),
  75. },
  76. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  77. activateClass: activateClass,
  78. canNoSelect: true
  79. ));
  80. IEnumerator SelectCardCoroutine(CardSource cardSource)
  81. {
  82. selectedCard = cardSource;
  83. yield return null;
  84. }
  85. if (selectedCard != null)
  86. {
  87. if (selectedCard.CanPlayCardTargetFrame(card.PermanentOfThisCard().PermanentFrame, false, activateClass))
  88. {
  89. yield return ContinuousController.instance.StartCoroutine(new PlayCardClass(
  90. cardSources: new List<CardSource>(){selectedCard},
  91. hashtable: CardEffectCommons.CardEffectHashtable(activateClass),
  92. payCost: false,
  93. targetPermanent: card.PermanentOfThisCard(),
  94. isTapped: false,
  95. root: SelectCardEffect.Root.Library,
  96. activateETB: true).PlayCard());
  97. }
  98. }
  99. }
  100. }
  101. return cardEffects;
  102. }
  103. }