EX2_032.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_032 : 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.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] Reveal the top 4 cards of your deck. Add 1 black Tamer card among them to your hand. Place the remaining cards at the bottom of your deck in any order.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.IsTamer)
  24. {
  25. if (cardSource.HasCardColor(CardColor.Black))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (card.Owner.LibraryCards.Count >= 1)
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  50. revealCount: 4,
  51. simplifiedSelectCardConditions:
  52. new SimplifiedSelectCardConditionClass[]
  53. {
  54. new SimplifiedSelectCardConditionClass(
  55. canTargetCondition:CanSelectCardCondition,
  56. message: "Select 1 black Tamer card.",
  57. mode: SelectCardEffect.Mode.AddHand,
  58. maxCount: 1,
  59. selectCardCoroutine: null),
  60. },
  61. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  62. activateClass: activateClass
  63. ));
  64. }
  65. }
  66. if (timing == EffectTiming.OnAllyAttack)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  71. activateClass.SetIsInheritedEffect(true);
  72. activateClass.SetHashString("Memory+1_EX2_032");
  73. cardEffects.Add(activateClass);
  74. string EffectDiscription()
  75. {
  76. return "[When Attacking][Once Per Turn] If you have 2 or more black Tamers in play, gain 1 memory.";
  77. }
  78. bool CanUseCondition(Hashtable hashtable)
  79. {
  80. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  81. }
  82. bool CanActivateCondition(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.IsExistOnBattleArea(card))
  85. {
  86. if (card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.TopCard.CardColors.Contains(CardColor.Black) && permanent.IsTamer) >= 2)
  87. {
  88. return true;
  89. }
  90. }
  91. return false;
  92. }
  93. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  94. {
  95. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  96. }
  97. }
  98. return cardEffects;
  99. }
  100. }
  101. }