BT17_031.cs 7.9 KB

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