EX2_021.cs 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace DCGO.CardEffects.EX2
  5. {
  6. public class EX2_021 : 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, false, EffectDiscription());
  16. cardEffects.Add(activateClass);
  17. string EffectDiscription()
  18. {
  19. return "[When Digivolving] Reveal the top 3 cards of your deck. Add 1 Option card with [Plug-In] in its name among them to your hand. Place the remaining cards at the bottom of your deck in any order.";
  20. }
  21. bool CanSelectCardCondition(CardSource cardSource)
  22. {
  23. if (cardSource.IsOption)
  24. {
  25. if (cardSource.ContainsCardName("Plug-In"))
  26. {
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. bool CanUseCondition(Hashtable hashtable)
  33. {
  34. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  35. }
  36. bool CanActivateCondition(Hashtable hashtable)
  37. {
  38. if (CardEffectCommons.IsExistOnBattleArea(card))
  39. {
  40. if (card.Owner.LibraryCards.Count >= 1)
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  48. {
  49. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  50. revealCount: 3,
  51. simplifiedSelectCardConditions:
  52. new SimplifiedSelectCardConditionClass[]
  53. {
  54. new SimplifiedSelectCardConditionClass(
  55. canTargetCondition:CanSelectCardCondition,
  56. message: "Select 1 Option card with [Plug-In] in its name.",
  57. mode: SelectCardEffect.Mode.AddHand,
  58. maxCount: 1,
  59. selectCardCoroutine: null),
  60. },
  61. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  62. activateClass: activateClass
  63. ));
  64. }
  65. }
  66. if (timing == EffectTiming.OnUseOption)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  71. activateClass.SetIsInheritedEffect(true);
  72. activateClass.SetHashString("DP-2000_EX2_021");
  73. cardEffects.Add(activateClass);
  74. string EffectDiscription()
  75. {
  76. return "[Your Turn][Once Per Turn] When you use an Option card with a cost of 2 or more, 1 of your opponent's Digimon gets -2000 DP for the turn.";
  77. }
  78. bool CanSelectPermanentCondition(Permanent permanent)
  79. {
  80. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  81. }
  82. bool CanUseCondition(Hashtable hashtable)
  83. {
  84. if (CardEffectCommons.IsExistOnBattleArea(card))
  85. {
  86. if (CardEffectCommons.IsOwnerTurn(card))
  87. {
  88. if (CardEffectCommons.CanTriggerWhenOwnerUseOption(hashtable, null, (cost) => cost >= 2, card))
  89. {
  90. return true;
  91. }
  92. }
  93. }
  94. return false;
  95. }
  96. bool CanActivateCondition(Hashtable hashtable)
  97. {
  98. if (CardEffectCommons.IsExistOnBattleArea(card))
  99. {
  100. return true;
  101. }
  102. return false;
  103. }
  104. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  105. {
  106. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  107. {
  108. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  109. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  110. selectPermanentEffect.SetUp(
  111. selectPlayer: card.Owner,
  112. canTargetCondition: CanSelectPermanentCondition,
  113. canTargetCondition_ByPreSelecetedList: null,
  114. canEndSelectCondition: null,
  115. maxCount: maxCount,
  116. canNoSelect: false,
  117. canEndNotMax: false,
  118. selectPermanentCoroutine: SelectPermanentCoroutine,
  119. afterSelectPermanentCoroutine: null,
  120. mode: SelectPermanentEffect.Mode.Custom,
  121. cardEffect: activateClass);
  122. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  123. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  124. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  125. {
  126. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  127. }
  128. }
  129. }
  130. }
  131. return cardEffects;
  132. }
  133. }
  134. }