EX10_004.cs 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.EX10
  4. {
  5. public class EX10_004 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region ESS
  11. if (timing == EffectTiming.OnMove)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Trash 1 card, Gain 1 Memory, Draw 1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, true, EffectDiscription());
  16. activateClass.SetIsInheritedEffect(true);
  17. activateClass.SetHashString("ESS_EX10-004");
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Your Turn] [Once Per Turn] When any of your Digimon with [Lucemon] in their names move from the breeding area to the battle area, by trashing 1 card in your hand, <Draw 1> (Draw 1 card from your deck.) and gain 1 memory.";
  22. }
  23. bool PermanentCondition(Permanent permanent)
  24. {
  25. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  26. permanent.TopCard.ContainsCardName("Lucemon");
  27. }
  28. bool CanUseCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnBattleArea(card) &&
  31. CardEffectCommons.IsOwnerTurn(card) &&
  32. CardEffectCommons.CanTriggerOnMove(hashtable, PermanentCondition);
  33. }
  34. bool CanActivateCondition(Hashtable hashtable)
  35. {
  36. return CardEffectCommons.IsExistOnBattleArea(card);
  37. }
  38. IEnumerator ActivateCoroutine(Hashtable hashtable)
  39. {
  40. bool discarded = false;
  41. int discardCount = 1;
  42. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  43. selectHandEffect.SetUp(
  44. selectPlayer: card.Owner,
  45. canTargetCondition: cardSource => true,
  46. canTargetCondition_ByPreSelecetedList: null,
  47. canEndSelectCondition: null,
  48. maxCount: discardCount,
  49. canNoSelect: true,
  50. canEndNotMax: false,
  51. isShowOpponent: true,
  52. selectCardCoroutine: null,
  53. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  54. mode: SelectHandEffect.Mode.Discard,
  55. cardEffect: activateClass);
  56. yield return StartCoroutine(selectHandEffect.Activate());
  57. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  58. {
  59. if (cardSources.Count == 1)
  60. {
  61. discarded = true;
  62. yield return null;
  63. }
  64. }
  65. if (discarded)
  66. {
  67. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  68. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  69. }
  70. }
  71. }
  72. #endregion
  73. return cardEffects;
  74. }
  75. }
  76. }