EX7_040.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_040 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Alternate Digivolution
  11. if (timing == EffectTiming.None)
  12. {
  13. bool PermanentCondition(Permanent targetPermanent)
  14. {
  15. return targetPermanent.TopCard.IsLevel2 && targetPermanent.TopCard.ContainsTraits("Three Musketeers");
  16. }
  17. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  18. permanentCondition: PermanentCondition,
  19. digivolutionCost: 0,
  20. ignoreDigivolutionRequirement: false,
  21. card: card,
  22. condition: null)
  23. );
  24. }
  25. #endregion
  26. #region On Play
  27. if (timing == EffectTiming.OnEnterFieldAnyone)
  28. {
  29. ActivateClass activateClass = new ActivateClass();
  30. activateClass.SetUpICardEffect("Trash 1 [Three Musketeers], <Draw 2>", CanUseCondition, card);
  31. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  32. cardEffects.Add(activateClass);
  33. string EffectDescription()
  34. {
  35. return "[On Play] By trashing 1 card with the [Three Musketeers] trait in your hand, <Draw 2>.";
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool HasThreeMusketeersInTrait(CardSource cardSource)
  42. {
  43. return cardSource.ContainsTraits("Three Musketeers");
  44. }
  45. bool CanActivateCondition(Hashtable hashtable)
  46. {
  47. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  48. CardEffectCommons.HasMatchConditionOwnersHand(card, HasThreeMusketeersInTrait);
  49. }
  50. IEnumerator ActivateCoroutine(Hashtable hashtable)
  51. {
  52. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  53. selectHandEffect.SetUp(
  54. canTargetCondition: HasThreeMusketeersInTrait,
  55. canTargetCondition_ByPreSelecetedList: null,
  56. canEndSelectCondition: null,
  57. canNoSelect: true,
  58. selectCardCoroutine: null,
  59. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  60. maxCount: 1,
  61. canEndNotMax: false,
  62. isShowOpponent: true,
  63. mode: SelectHandEffect.Mode.Discard,
  64. selectPlayer: card.Owner,
  65. cardEffect: activateClass);
  66. selectHandEffect.SetUpCustomMessage("Select 1 card with [Three Musketeers] trait to discard.",
  67. "The opponent is selecting 1 card with [Three Musketeers] trait to discard.");
  68. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  69. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  70. {
  71. if (cardSources.Count > 0)
  72. {
  73. yield return ContinuousController.instance.StartCoroutine(
  74. new DrawClass(card.Owner, 2, activateClass).Draw());
  75. }
  76. }
  77. }
  78. }
  79. #endregion
  80. #region Reboot - ESS
  81. if (timing == EffectTiming.None)
  82. {
  83. cardEffects.Add(CardEffectFactory.RebootSelfStaticEffect(
  84. isInheritedEffect: true,
  85. card: card,
  86. condition: null));
  87. }
  88. #endregion
  89. return cardEffects;
  90. }
  91. }
  92. }