BT14_100.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.BT14
  5. {
  6. public class BT14_100 : CEntity_Effect
  7. {
  8. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  9. {
  10. List<ICardEffect> cardEffects = new List<ICardEffect>();
  11. if (timing == EffectTiming.OnDiscardHand)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Draw 1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "When one of your effects trashes this card in your hand, <Draw 1>.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. bool SkillCondition(ICardEffect cardEffect)
  24. {
  25. return CardEffectCommons.IsOwnerEffect(cardEffect, card);
  26. }
  27. return CardEffectCommons.CanTriggerOnTrashSelfHand(hashtable, SkillCondition, card);
  28. }
  29. bool CanActivateCondition(Hashtable hashtable)
  30. {
  31. if (CardEffectCommons.IsExistOnTrash(card))
  32. {
  33. if (card.Owner.LibraryCards.Count >= 1)
  34. {
  35. return true;
  36. }
  37. }
  38. return false;
  39. }
  40. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  41. {
  42. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 1, activateClass).Draw());
  43. }
  44. }
  45. if (timing == EffectTiming.OptionSkill)
  46. {
  47. ActivateClass activateClass = new ActivateClass();
  48. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  49. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  50. cardEffects.Add(activateClass);
  51. string EffectDiscription()
  52. {
  53. return "[Main] Delete 1 of your opponent's level 4 or lower Digimon.";
  54. }
  55. bool CanSelectPermanentCondition(Permanent permanent)
  56. {
  57. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  58. {
  59. if (permanent.Level <= 4)
  60. {
  61. if (permanent.TopCard.HasLevel)
  62. {
  63. return true;
  64. }
  65. }
  66. }
  67. return false;
  68. }
  69. bool CanUseCondition(Hashtable hashtable)
  70. {
  71. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  72. }
  73. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  74. {
  75. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  76. {
  77. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  78. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  79. selectPermanentEffect.SetUp(
  80. selectPlayer: card.Owner,
  81. canTargetCondition: CanSelectPermanentCondition,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canEndSelectCondition: null,
  84. maxCount: maxCount,
  85. canNoSelect: false,
  86. canEndNotMax: false,
  87. selectPermanentCoroutine: null,
  88. afterSelectPermanentCoroutine: null,
  89. mode: SelectPermanentEffect.Mode.Destroy,
  90. cardEffect: activateClass);
  91. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  92. }
  93. }
  94. }
  95. if (timing == EffectTiming.SecuritySkill)
  96. {
  97. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Delete 1 level 4 or lower Digimon");
  98. }
  99. return cardEffects;
  100. }
  101. }
  102. }