DeathSlinger_EX2_071.cs 4.5 KB

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