BT20_008.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace DCGO.CardEffects.BT20
  5. {
  6. public class BT20_008 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Start of Your Main Phase
  12. if (timing == EffectTiming.OnStartMainPhase)
  13. {
  14. ActivateClass activateClass = new ActivateClass();
  15. activateClass.SetUpICardEffect("Trash a card, draw a card, gain 1 memory", CanUseCondition, card);
  16. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  17. cardEffects.Add(activateClass);
  18. string EffectDiscription()
  19. {
  20. return "[Start of Your Main Phase] By trashing 1 card with [Huckmon] or [Sistermon] in its name or the [Royal Knight] trait in your hand, <Draw 1> and gain 1 memory.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.IsOwnerTurn(card);
  25. }
  26. bool CanActivateCondition(Hashtable hashtable)
  27. {
  28. return CardEffectCommons.IsExistOnBattleAreaDigimon(card) &&
  29. CardEffectCommons.HasMatchConditionOwnersHand(card, CanSelect);
  30. }
  31. bool CanSelect(CardSource cardSource)
  32. {
  33. return cardSource.ContainsCardName("Sistermon") || cardSource.ContainsCardName("Huckmon") || cardSource.HasRoyalKnightTraits;
  34. }
  35. IEnumerator ActivateCoroutine(Hashtable hashtable)
  36. {
  37. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  38. bool discarded = false;
  39. selectHandEffect.SetUp(
  40. selectPlayer: card.Owner,
  41. canTargetCondition: CanSelect,
  42. canTargetCondition_ByPreSelecetedList: null,
  43. canEndSelectCondition: null,
  44. maxCount: 1,
  45. canNoSelect: true,
  46. canEndNotMax: false,
  47. isShowOpponent: true,
  48. selectCardCoroutine: null,
  49. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  50. mode: SelectHandEffect.Mode.Discard,
  51. cardEffect: activateClass);
  52. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  53. {
  54. if (cardSources.Count == 1)
  55. {
  56. discarded = true;
  57. yield return null;
  58. }
  59. }
  60. selectHandEffect.SetUpCustomMessage("Select 1 card to discard.", "The opponent is selecting 1 card to discard.");
  61. selectHandEffect.SetUpCustomMessage_ShowCard("Discarded Card");
  62. yield return ContinuousController.instance.StartCoroutine(selectHandEffect.Activate());
  63. if (discarded)
  64. {
  65. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  66. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  67. }
  68. }
  69. }
  70. #endregion
  71. #region ESS
  72. if (timing == EffectTiming.None)
  73. {
  74. bool Condition()
  75. {
  76. if (CardEffectCommons.IsExistOnBattleArea(card))
  77. {
  78. if (CardEffectCommons.IsOwnerTurn(card))
  79. {
  80. return true;
  81. }
  82. }
  83. return false;
  84. }
  85. bool PermanentCondition(Permanent permanent)
  86. {
  87. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  88. {
  89. return true;
  90. }
  91. return false;
  92. }
  93. cardEffects.Add(CardEffectFactory.ChangeDPStaticEffect(
  94. permanentCondition: PermanentCondition,
  95. changeValue: 1000,
  96. isInheritedEffect: true,
  97. card: card,
  98. condition: Condition,
  99. effectName: () => "Your Digimon gain DP +1000"));
  100. }
  101. #endregion
  102. return cardEffects;
  103. }
  104. }
  105. }