BT10_032.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. namespace DCGO.CardEffects.BT10
  9. {
  10. public class BT10_032 : CEntity_Effect
  11. {
  12. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  13. {
  14. List<ICardEffect> cardEffects = new List<ICardEffect>();
  15. if (timing == EffectTiming.OnEnterFieldAnyone)
  16. {
  17. ActivateClass activateClass = new ActivateClass();
  18. activateClass.SetUpICardEffect("Reveal the top 4 cards of deck", CanUseCondition, card);
  19. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  20. cardEffects.Add(activateClass);
  21. string EffectDiscription()
  22. {
  23. return "[On Play] Reveal the top 4 cards of your deck. Add 1 Option card with [Plug-In] in its name and 1 yellow Tamer card among them to your hand. Place the rest at the bottom of your deck in any order.";
  24. }
  25. bool CanSelectCardCondition(CardSource cardSource)
  26. {
  27. if (cardSource.IsOption)
  28. {
  29. if (cardSource.ContainsCardName("Plug-In"))
  30. {
  31. return true;
  32. }
  33. }
  34. return false;
  35. }
  36. bool CanSelectCardCondition1(CardSource cardSource)
  37. {
  38. if (cardSource.IsTamer)
  39. {
  40. if (cardSource.CardColors.Contains(CardColor.Yellow))
  41. {
  42. return true;
  43. }
  44. }
  45. return false;
  46. }
  47. bool CanUseCondition(Hashtable hashtable)
  48. {
  49. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  50. }
  51. bool CanActivateCondition(Hashtable hashtable)
  52. {
  53. if (CardEffectCommons.IsExistOnBattleArea(card))
  54. {
  55. if (card.Owner.LibraryCards.Count >= 1)
  56. {
  57. return true;
  58. }
  59. }
  60. return false;
  61. }
  62. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  63. {
  64. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  65. revealCount: 4,
  66. simplifiedSelectCardConditions:
  67. new SimplifiedSelectCardConditionClass[]
  68. {
  69. new SimplifiedSelectCardConditionClass(
  70. canTargetCondition:CanSelectCardCondition,
  71. message: "Select 1 Option card with [Plug-In] in its name.",
  72. mode: SelectCardEffect.Mode.AddHand,
  73. maxCount: 1,
  74. selectCardCoroutine: null),
  75. new SimplifiedSelectCardConditionClass(
  76. canTargetCondition:CanSelectCardCondition1,
  77. message:"Select 1 yellow Tamer card.",
  78. mode: SelectCardEffect.Mode.AddHand,
  79. maxCount: 1,
  80. selectCardCoroutine: null),
  81. },
  82. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  83. activateClass: activateClass,
  84. mutualConditions: true
  85. ));
  86. }
  87. }
  88. if (timing == EffectTiming.OnUseOption)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect("DP -2000", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  93. activateClass.SetIsInheritedEffect(true);
  94. activateClass.SetHashString("DP-2000_BT10_032");
  95. cardEffects.Add(activateClass);
  96. string EffectDiscription()
  97. {
  98. 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.";
  99. }
  100. bool CanSelectPermanentCondition(Permanent permanent)
  101. {
  102. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card);
  103. }
  104. bool CanUseCondition(Hashtable hashtable)
  105. {
  106. if (CardEffectCommons.IsExistOnBattleArea(card))
  107. {
  108. if (CardEffectCommons.IsOwnerTurn(card))
  109. {
  110. if (CardEffectCommons.CanTriggerWhenOwnerUseOption(hashtable, null, (cost) => cost >= 2, card))
  111. {
  112. return true;
  113. }
  114. }
  115. }
  116. return false;
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnBattleArea(card))
  121. {
  122. return true;
  123. }
  124. return false;
  125. }
  126. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  127. {
  128. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  129. {
  130. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  131. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  132. selectPermanentEffect.SetUp(
  133. selectPlayer: card.Owner,
  134. canTargetCondition: CanSelectPermanentCondition,
  135. canTargetCondition_ByPreSelecetedList: null,
  136. canEndSelectCondition: null,
  137. maxCount: maxCount,
  138. canNoSelect: false,
  139. canEndNotMax: false,
  140. selectPermanentCoroutine: SelectPermanentCoroutine,
  141. afterSelectPermanentCoroutine: null,
  142. mode: SelectPermanentEffect.Mode.Custom,
  143. cardEffect: activateClass);
  144. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get DP -2000.", "The opponent is selecting 1 Digimon that will get DP -2000.");
  145. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  146. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  147. {
  148. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonDP(targetPermanent: permanent, changeValue: -2000, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  149. }
  150. }
  151. }
  152. }
  153. return cardEffects;
  154. }
  155. }
  156. }