EX10_037.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. // Impmon
  5. namespace DCGO.CardEffects.EX10
  6. {
  7. public class EX10_037 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. #region When trashed from deck
  13. if (timing == EffectTiming.OnDiscardLibrary)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Delete 1 level 4 or lower digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. activateClass.SetIsDigimonEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "When this card is trashed from the top of the deck, you may delete 1 of your opponent's level 4 or lower Digimon.";
  23. }
  24. bool CanUseCondition(Hashtable hashtable)
  25. {
  26. return CardEffectCommons.CanTriggerWhenSelfDiscardLibrary(hashtable, card);
  27. }
  28. bool CanActivateCondition(Hashtable hashtable)
  29. {
  30. return CardEffectCommons.IsExistOnTrash(card)
  31. && CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermamentCondition);
  32. }
  33. bool CanSelectPermamentCondition(Permanent permanent)
  34. {
  35. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card)
  36. && permanent.TopCard.HasLevel
  37. && permanent.TopCard.Level <= 4;
  38. }
  39. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  40. {
  41. if (CardEffectCommons.HasMatchConditionOpponentsPermanent(card, CanSelectPermamentCondition))
  42. {
  43. #region Destroy Enemy Digimon
  44. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  45. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionOpponentsPermanentCount(card, CanSelectPermamentCondition));
  46. selectPermanentEffect.SetUp(
  47. selectPlayer: card.Owner,
  48. canTargetCondition: CanSelectPermamentCondition,
  49. canTargetCondition_ByPreSelecetedList: null,
  50. canEndSelectCondition: null,
  51. maxCount: maxCount,
  52. canNoSelect: true,
  53. canEndNotMax: false,
  54. selectPermanentCoroutine: null,
  55. afterSelectPermanentCoroutine: null,
  56. mode: SelectPermanentEffect.Mode.Destroy,
  57. cardEffect: activateClass);
  58. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon to destroy", "The opponent is selecting 1 Digimon to destroy");
  59. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  60. #endregion
  61. }
  62. }
  63. }
  64. #endregion
  65. #region Start of Your Main Phase
  66. if (timing == EffectTiming.OnStartMainPhase)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("Trash top 2 deck cards", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  71. cardEffects.Add(activateClass);
  72. string EffectDiscription()
  73. {
  74. return "[Start of Your Main Phase] Trash the top 2 cards of your deck.";
  75. }
  76. bool CanUseCondition(Hashtable hashtable)
  77. {
  78. return CardEffectCommons.IsExistOnBattleAreaDigimon(card);
  79. }
  80. bool CanActivateCondition(Hashtable hashtable)
  81. {
  82. return CardEffectCommons.IsExistOnBattleAreaDigimon(card)
  83. && CardEffectCommons.IsOwnerTurn(card);
  84. }
  85. IEnumerator ActivateCoroutine(Hashtable hashtable)
  86. {
  87. yield return ContinuousController.instance.StartCoroutine(new IAddTrashCardsFromLibraryTop(2, card.Owner, activateClass).AddTrashCardsFromLibraryTop());
  88. }
  89. }
  90. #endregion
  91. #region ESS
  92. if (timing == EffectTiming.None)
  93. {
  94. bool Condition()
  95. {
  96. return CardEffectCommons.IsExistOnBattleArea(card)
  97. && CardEffectCommons.IsOwnerTurn(card);
  98. }
  99. int GetDPChangeValue()
  100. {
  101. int stacksOf10 = card.Owner.TrashCards.Count / 10;
  102. return stacksOf10 * 1000;
  103. }
  104. cardEffects.Add(CardEffectFactory.ChangeSelfDPStaticEffect(changeValue: GetDPChangeValue(), isInheritedEffect: true, card: card, condition: Condition));
  105. }
  106. #endregion
  107. return cardEffects;
  108. }
  109. }
  110. }