EX2_071.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_071 : 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.OnDiscardLibrary)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Memory +1", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "When this card is trashed from your deck, gain 1 memory.";
  20. }
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.CanTriggerWhenSelfDiscardLibrary(hashtable, card);
  24. }
  25. bool CanActivateCondition(Hashtable hashtable)
  26. {
  27. if (CardEffectCommons.IsExistOnTrash(card))
  28. {
  29. if (card.Owner.CanAddMemory(activateClass))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  37. {
  38. yield return ContinuousController.instance.StartCoroutine(card.Owner.AddMemory(1, activateClass));
  39. }
  40. }
  41. if (timing == EffectTiming.OptionSkill)
  42. {
  43. int maxLevel()
  44. {
  45. int maxLevel = 4;
  46. maxLevel += card.Owner.TrashCards.Count / 10;
  47. return maxLevel;
  48. }
  49. ActivateClass activateClass = new ActivateClass();
  50. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  51. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  52. cardEffects.Add(activateClass);
  53. string EffectDiscription()
  54. {
  55. return "[Main] Delete 1 of your opponent's level 4 or lower Digimon. For every 10 cards in your trash, add 1 to the maximum level of the Digimon you can choose with this effect.";
  56. }
  57. bool CanSelectPermanentCondition(Permanent permanent)
  58. {
  59. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  60. {
  61. if (permanent.Level <= maxLevel())
  62. {
  63. if (permanent.TopCard.HasLevel)
  64. {
  65. return true;
  66. }
  67. }
  68. }
  69. return false;
  70. }
  71. bool CanUseCondition(Hashtable hashtable)
  72. {
  73. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  74. }
  75. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  76. {
  77. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  78. {
  79. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  80. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  81. selectPermanentEffect.SetUp(
  82. selectPlayer: card.Owner,
  83. canTargetCondition: CanSelectPermanentCondition,
  84. canTargetCondition_ByPreSelecetedList: null,
  85. canEndSelectCondition: null,
  86. maxCount: maxCount,
  87. canNoSelect: false,
  88. canEndNotMax: false,
  89. selectPermanentCoroutine: null,
  90. afterSelectPermanentCoroutine: null,
  91. mode: SelectPermanentEffect.Mode.Destroy,
  92. cardEffect: activateClass);
  93. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  94. }
  95. }
  96. }
  97. if (timing == EffectTiming.SecuritySkill)
  98. {
  99. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Delete 1 Digimon");
  100. }
  101. return cardEffects;
  102. }
  103. }
  104. }