EX7_039.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX7
  4. {
  5. public class EX7_039 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Start of Your Main Phase
  11. if (timing == EffectTiming.OnStartMainPhase)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Trash 1 [Rock Dragon]/[Earth Dragon], <Draw 1> and gain 1 memory", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDescription());
  16. cardEffects.Add(activateClass);
  17. string EffectDescription()
  18. {
  19. return
  20. "[Start of Your Main Phase] By trashing 1 card with the [Rock Dragon]/[Earth Dragon] trait from your hand, <Draw 1> and gain 1 memory.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  25. CardEffectCommons.IsOwnerTurn(card);
  26. }
  27. bool HasDragonInTrait(CardSource cardSource)
  28. {
  29. return cardSource.ContainsTraits("Rock Dragon") ||
  30. cardSource.ContainsTraits("Earth Dragon");
  31. }
  32. bool CanActivateCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  35. CardEffectCommons.HasMatchConditionOwnersHand(card, HasDragonInTrait);
  36. }
  37. IEnumerator ActivateCoroutine(Hashtable hashtable)
  38. {
  39. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  40. selectHandEffect.SetUp(
  41. canTargetCondition: HasDragonInTrait,
  42. canTargetCondition_ByPreSelecetedList: null,
  43. canEndSelectCondition: null,
  44. canNoSelect: true,
  45. selectCardCoroutine: null,
  46. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  47. maxCount: 1,
  48. canEndNotMax: false,
  49. isShowOpponent: true,
  50. mode: SelectHandEffect.Mode.Discard,
  51. selectPlayer: card.Owner,
  52. cardEffect: activateClass);
  53. selectHandEffect.SetUpCustomMessage("Select 1 card with [Rock Dragon]/[Earth Dragon] trait to discard.",
  54. "The opponent is selecting 1 card with [Rock Dragon]/[Earth Dragon] trait to discard.");
  55. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  56. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  57. {
  58. if (cardSources.Count > 0)
  59. {
  60. yield return ContinuousController.instance.StartCoroutine(
  61. new DrawClass(card.Owner, 1, activateClass).Draw());
  62. yield return ContinuousController.instance.StartCoroutine(
  63. card.Owner.AddMemory(1, activateClass));
  64. }
  65. }
  66. }
  67. }
  68. #endregion
  69. #region Opponent's Turn - ESS
  70. if (timing == EffectTiming.None)
  71. {
  72. bool Condition()
  73. {
  74. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  75. CardEffectCommons.IsOpponentTurn(card);
  76. }
  77. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  78. changeValue: 2000,
  79. isInheritedEffect: true,
  80. card: card,
  81. condition: Condition));
  82. }
  83. #endregion
  84. return cardEffects;
  85. }
  86. }
  87. }