EX11_047.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Impmon
  5. namespace DCGO.CardEffects.EX11
  6. {
  7. public class EX11_047 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region Digivolution Condition
  13. if (timing == EffectTiming.None)
  14. {
  15. bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.EqualsCardName("Yaamon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition,
  21. digivolutionCost: 0,
  22. ignoreDigivolutionRequirement: false,
  23. card: card,
  24. condition: null));
  25. }
  26. #endregion
  27. #region Start of Your Main Phase
  28. if (timing == EffectTiming.OnStartMainPhase)
  29. {
  30. ActivateClass activateClass = new ActivateClass();
  31. activateClass.SetUpICardEffect("Trash 1 card and gain 1 memory.", CanUseCondition, card);
  32. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDescription());
  33. cardEffects.Add(activateClass);
  34. string EffectDescription()
  35. {
  36. return "[Start of Your Main Phase] Trash 1 card in your hand. Then, gain 1 memory.";
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.IsExistOnBattleArea(card)
  41. && CardEffectCommons.IsOwnerTurn(card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. return CardEffectCommons.IsExistOnBattleArea(card);
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable hashtable)
  48. {
  49. if (card.Owner.HandCards.Count >= 1)
  50. {
  51. int discardCount = Math.Min(1, card.Owner.HandCards.Count);
  52. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  53. selectHandEffect.SetUp(
  54. selectPlayer: card.Owner,
  55. canTargetCondition: (cardSource) => true,
  56. canTargetCondition_ByPreSelecetedList: null,
  57. canEndSelectCondition: null,
  58. maxCount: discardCount,
  59. canNoSelect: false,
  60. canEndNotMax: false,
  61. isShowOpponent: true,
  62. selectCardCoroutine: null,
  63. afterSelectCardCoroutine: null,
  64. mode: SelectHandEffect.Mode.Discard,
  65. cardEffect: activateClass);
  66. yield return StartCoroutine(selectHandEffect.Activate());
  67. }
  68. if (card.Owner.CanAddMemory(activateClass))
  69. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  70. }
  71. }
  72. #endregion
  73. #region Inherit
  74. if (timing == EffectTiming.None)
  75. {
  76. bool Condition()
  77. {
  78. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  79. && CardEffectCommons.IsOwnerTurn(card);
  80. }
  81. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(
  82. changeValue: 2000,
  83. isInheritedEffect: true,
  84. card: card,
  85. condition: Condition));
  86. }
  87. #endregion
  88. return cardEffects;
  89. }
  90. }
  91. }