EX5_066.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. public class EX5_066 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. if (timing == EffectTiming.OptionSkill)
  11. {
  12. ActivateClass activateClass = new ActivateClass();
  13. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  14. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  15. cardEffects.Add(activateClass);
  16. string EffectDiscription()
  17. {
  18. return "[Main] Delete 1 of your opponent's Digimon with the lowest DP. Then, if you have a Tamer, return 1 Digimon card with the [Light Fang]/[Night Claw]/[Galaxy] trait from your trash to the hand.";
  19. }
  20. bool CanSelectPermanentCondition(Permanent permanent)
  21. {
  22. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  23. {
  24. if (CardEffectCommons.IsMinDP(permanent, card.Owner.Enemy))
  25. {
  26. return true;
  27. }
  28. }
  29. return false;
  30. }
  31. bool CanSelectCardCondition(CardSource cardSource)
  32. {
  33. if (cardSource.IsDigimon)
  34. {
  35. if (cardSource.CardTraits.Contains("Light Fang"))
  36. {
  37. return true;
  38. }
  39. if (cardSource.CardTraits.Contains("LightFung"))
  40. {
  41. return true;
  42. }
  43. if (cardSource.CardTraits.Contains("Night Claw"))
  44. {
  45. return true;
  46. }
  47. if (cardSource.CardTraits.Contains("NightClaw"))
  48. {
  49. return true;
  50. }
  51. if (cardSource.CardTraits.Contains("Galaxy"))
  52. {
  53. return true;
  54. }
  55. }
  56. return false;
  57. }
  58. bool CanUseCondition(Hashtable hashtable)
  59. {
  60. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  65. {
  66. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  67. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  68. selectPermanentEffect.SetUp(
  69. selectPlayer: card.Owner,
  70. canTargetCondition: CanSelectPermanentCondition,
  71. canTargetCondition_ByPreSelecetedList: null,
  72. canEndSelectCondition: null,
  73. maxCount: maxCount,
  74. canNoSelect: false,
  75. canEndNotMax: false,
  76. selectPermanentCoroutine: null,
  77. afterSelectPermanentCoroutine: null,
  78. mode: SelectPermanentEffect.Mode.Destroy,
  79. cardEffect: activateClass);
  80. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  81. }
  82. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer))
  83. {
  84. if (CardEffectCommons.HasMatchConditionOwnersCardInTrash(card, CanSelectCardCondition))
  85. {
  86. int maxCount = Math.Min(1, card.Owner.TrashCards.Count(CanSelectCardCondition));
  87. SelectCardEffect selectCardEffect = GManager.instance.GetComponent<SelectCardEffect>();
  88. selectCardEffect.SetUp(
  89. canTargetCondition: CanSelectCardCondition,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. canNoSelect: () => false,
  93. selectCardCoroutine: null,
  94. afterSelectCardCoroutine: null,
  95. message: "Select 1 card to add to your hand.",
  96. maxCount: maxCount,
  97. canEndNotMax: false,
  98. isShowOpponent: true,
  99. mode: SelectCardEffect.Mode.AddHand,
  100. root: SelectCardEffect.Root.Trash,
  101. customRootCardList: null,
  102. canLookReverseCard: true,
  103. selectPlayer: card.Owner,
  104. cardEffect: activateClass);
  105. yield return ContinuousController.instance.StartCoroutine(selectCardEffect.Activate());
  106. }
  107. }
  108. }
  109. }
  110. if (timing == EffectTiming.SecuritySkill)
  111. {
  112. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Delete 1 Digimon with the lowest DP and return 1 card from trash to hand");
  113. }
  114. return cardEffects;
  115. }
  116. }