EX3_055.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX3
  4. {
  5. public class EX3_055 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OnEnterFieldAnyone)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  14. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[On Play] Reveal the top 3 cards of your deck. Add 1 purple or red card with the [Free] trait or 1 card with [Imperialdramon] in its name among them to your hand, and trash 1 such card among them. Place the rest at the bottom of your deck in any order.";
  19. }
  20. bool CanSelectCardCondition(CardSource cardSource)
  21. {
  22. if (cardSource.CardTraits.Contains("Free"))
  23. {
  24. if (cardSource.HasCardColor(CardColor.Red) || cardSource.HasCardColor(CardColor.Purple))
  25. {
  26. return true;
  27. }
  28. }
  29. if (cardSource.ContainsCardName("Imperialdramon"))
  30. {
  31. return true;
  32. }
  33. return false;
  34. }
  35. bool CanUseCondition(Hashtable hashtable)
  36. {
  37. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  38. }
  39. bool CanActivateCondition(Hashtable hashtable)
  40. {
  41. if (CardEffectCommons.IsExistOnBattleArea(card))
  42. {
  43. if (card.Owner.LibraryCards.Count >= 1)
  44. {
  45. return true;
  46. }
  47. }
  48. return false;
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  51. {
  52. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  53. revealCount: 3,
  54. simplifiedSelectCardConditions:
  55. new SimplifiedSelectCardConditionClass[]
  56. {
  57. new SimplifiedSelectCardConditionClass(
  58. canTargetCondition:CanSelectCardCondition,
  59. message: "Select 1 purple or red card with the [Free] trait or 1 card with [Imperialdramon] in its name to add to your hand.",
  60. mode: SelectCardEffect.Mode.AddHand,
  61. maxCount: 1,
  62. selectCardCoroutine: null),
  63. new SimplifiedSelectCardConditionClass(
  64. canTargetCondition:CanSelectCardCondition,
  65. message: "Select 1 purple or red card with the [Free] trait or 1 card with [Imperialdramon] in its name to discard.",
  66. mode: SelectCardEffect.Mode.Discard,
  67. maxCount: 1,
  68. selectCardCoroutine: null),
  69. },
  70. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  71. activateClass: activateClass
  72. ));
  73. }
  74. }
  75. if (timing == EffectTiming.OnDestroyedAnyone)
  76. {
  77. bool Condition()
  78. {
  79. if (CardEffectCommons.IsExistOnBattleArea(card))
  80. {
  81. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.TopCard.CardColors.Contains(CardColor.Red) && permanent.IsDigimon))
  82. {
  83. return true;
  84. }
  85. }
  86. return false;
  87. }
  88. cardEffects.Add(CardEffectFactory.RetaliationSelfEffect(isInheritedEffect: true, card: card, condition: Condition));
  89. }
  90. return cardEffects;
  91. }
  92. }
  93. }