EX1_050.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX1
  5. {
  6. public class EX1_050 : 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.OnEnterFieldAnyone)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Reveal the top 3 cards of deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] You may reveal the top 3 cards of your deck. Add 1 level 6 Digimon card with [Machine] in its traits among them to your hand. Trash the remaining cards.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.IsDigimon)
  24. {
  25. if (cardSource.CardTraits.Contains("Machine"))
  26. {
  27. if (cardSource.Level == 6)
  28. {
  29. if (cardSource.HasLevel)
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (card.Owner.LibraryCards.Count >= 1)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  56. revealCount: 3,
  57. simplifiedSelectCardConditions:
  58. new SimplifiedSelectCardConditionClass[]
  59. {
  60. new SimplifiedSelectCardConditionClass(
  61. canTargetCondition:CanSelectCardCondition,
  62. message: "Select 1 level 6 Digimon card with [Machine] in its traits.",
  63. mode: SelectCardEffect.Mode.AddHand,
  64. maxCount: 1,
  65. selectCardCoroutine: null),
  66. },
  67. remainingCardsPlace: RemainingCardsPlace.Trash,
  68. activateClass: activateClass
  69. ));
  70. }
  71. }
  72. if (timing == EffectTiming.OnAllyAttack)
  73. {
  74. ActivateClass activateClass = new ActivateClass();
  75. activateClass.SetUpICardEffect("Delete 1 Digimon with 5 or less Cost", CanUseCondition, card);
  76. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  77. activateClass.SetIsInheritedEffect(true);
  78. cardEffects.Add(activateClass);
  79. string EffectDiscription()
  80. {
  81. return "[When Attacking] If this Digimon has [Machine] in its traits, delete 1 of your opponent's Digimon with a play cost of 5 or less.";
  82. }
  83. bool CanSelectPermanentCondition(Permanent permanent)
  84. {
  85. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  86. {
  87. if (permanent.TopCard.GetCostItself <= 5)
  88. {
  89. if (permanent.TopCard.HasPlayCost)
  90. {
  91. return true;
  92. }
  93. }
  94. }
  95. return false;
  96. }
  97. bool CanUseCondition(Hashtable hashtable)
  98. {
  99. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  100. }
  101. bool CanActivateCondition(Hashtable hashtable)
  102. {
  103. if (CardEffectCommons.IsExistOnBattleArea(card))
  104. {
  105. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  106. {
  107. if (card.PermanentOfThisCard().TopCard.CardTraits.Contains("Machine"))
  108. {
  109. return true;
  110. }
  111. }
  112. }
  113. return false;
  114. }
  115. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  116. {
  117. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  118. {
  119. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  120. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  121. selectPermanentEffect.SetUp(
  122. selectPlayer: card.Owner,
  123. canTargetCondition: CanSelectPermanentCondition,
  124. canTargetCondition_ByPreSelecetedList: null,
  125. canEndSelectCondition: null,
  126. maxCount: maxCount,
  127. canNoSelect: false,
  128. canEndNotMax: false,
  129. selectPermanentCoroutine: null,
  130. afterSelectPermanentCoroutine: null,
  131. mode: SelectPermanentEffect.Mode.Destroy,
  132. cardEffect: activateClass);
  133. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  134. }
  135. }
  136. }
  137. return cardEffects;
  138. }
  139. }
  140. }