BT23_049.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. //Monodramon
  4. namespace DCGO.CardEffects.BT23
  5. {
  6. public class BT23_049 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. #region Alternate Digivolution
  12. if (timing == EffectTiming.None)
  13. {
  14. bool PermanentCondition(Permanent targetPermanent)
  15. {
  16. return targetPermanent.TopCard.IsLevel2 &&
  17. targetPermanent.TopCard.HasCSTraits;
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(
  20. permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false,
  21. card: card, condition: null));
  22. }
  23. #endregion
  24. #region Start of Your Main Phase
  25. if (timing == EffectTiming.OnStartMainPhase)
  26. {
  27. ActivateClass activateClass = new ActivateClass();
  28. activateClass.SetUpICardEffect("Trash 1 card from hand to Draw 1 and memory +1", CanUseCondition, card);
  29. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  30. cardEffects.Add(activateClass);
  31. string EffectDiscription()
  32. {
  33. return "[Start of Your Main Phase] By trashing 1 card with the [Dragonkin], [Cyborg], [Device] or [CS] trait from your hand, <Draw 1> and gain 1 memory.";
  34. }
  35. bool CanSelectCardCondition(CardSource cardSource)
  36. {
  37. return cardSource.EqualsTraits("Dragonkin") ||
  38. cardSource.EqualsTraits("Cyborg") ||
  39. cardSource.HasDeviceTraits ||
  40. cardSource.HasCSTraits;
  41. }
  42. bool CanUseCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (CardEffectCommons.IsOwnerTurn(card))
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. bool CanActivateCondition(Hashtable hashtable)
  54. {
  55. if (CardEffectCommons.IsExistOnBattleArea(card))
  56. {
  57. if (card.Owner.HandCards.Count >= 1)
  58. {
  59. return true;
  60. }
  61. }
  62. return false;
  63. }
  64. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  65. {
  66. if (card.Owner.HandCards.Some(CanSelectCardCondition))
  67. {
  68. bool discarded = false;
  69. int discardCount = 1;
  70. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  71. selectHandEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectCardCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: discardCount,
  77. canNoSelect: true,
  78. canEndNotMax: false,
  79. isShowOpponent: true,
  80. selectCardCoroutine: null,
  81. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  82. mode: SelectHandEffect.Mode.Discard,
  83. cardEffect: activateClass);
  84. yield return StartCoroutine(selectHandEffect.Activate());
  85. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  86. {
  87. if (cardSources.Count >= 1)
  88. {
  89. discarded = true;
  90. yield return null;
  91. }
  92. }
  93. if (discarded)
  94. {
  95. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  96. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  97. }
  98. }
  99. }
  100. }
  101. #endregion
  102. #region All Turns - ESS
  103. if (timing == EffectTiming.None)
  104. {
  105. bool Condition()
  106. {
  107. if (CardEffectCommons.IsExistOnBattleArea(card))
  108. {
  109. return true;
  110. }
  111. return false;
  112. }
  113. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: 1000, isInheritedEffect: true, card: card, condition: Condition));
  114. }
  115. #endregion
  116. return cardEffects;
  117. }
  118. }
  119. }