BT12_098.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT12
  6. {
  7. public class BT12_098 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  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 <Save> in its text and 1 card with a [Hunter] trait among them to your hand. Place the remaining cards at the bottom of your deck in any order.";
  21. }
  22. bool CanSelectCardCondition(CardSource cardSource)
  23. {
  24. if (cardSource.IsDigimon)
  25. {
  26. if (cardSource.HasSaveText)
  27. {
  28. return true;
  29. }
  30. }
  31. return false;
  32. }
  33. bool CanSelectCardCondition1(CardSource cardSource)
  34. {
  35. return cardSource.CardTraits.Contains("Hunter");
  36. }
  37. bool CanUseCondition(Hashtable hashtable)
  38. {
  39. return CardEffectCommons.CanTriggerOnPlay(hashtable, card);
  40. }
  41. bool CanActivateCondition(Hashtable hashtable)
  42. {
  43. if (CardEffectCommons.IsExistOnBattleArea(card))
  44. {
  45. if (card.Owner.LibraryCards.Count >= 1)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  53. {
  54. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  55. revealCount: 3,
  56. simplifiedSelectCardConditions:
  57. new SimplifiedSelectCardConditionClass[]
  58. {
  59. new SimplifiedSelectCardConditionClass(
  60. canTargetCondition:CanSelectCardCondition,
  61. message: "Select 1 Digimon card with <Save> in its text.",
  62. mode: SelectCardEffect.Mode.AddHand,
  63. maxCount: 1,
  64. selectCardCoroutine: null),
  65. new SimplifiedSelectCardConditionClass(
  66. canTargetCondition:CanSelectCardCondition1,
  67. message: "Select 1 card with a [Hunter] trait.",
  68. mode: SelectCardEffect.Mode.AddHand,
  69. maxCount: 1,
  70. selectCardCoroutine: null),
  71. },
  72. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  73. activateClass: activateClass,
  74. mutualConditions: true
  75. ));
  76. }
  77. }
  78. if (timing == EffectTiming.OnDeclaration)
  79. {
  80. ActivateClass activateClass = new ActivateClass();
  81. activateClass.SetUpICardEffect("Your 1 Digimon gains Security Attack +1", CanUseCondition, card);
  82. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  83. cardEffects.Add(activateClass);
  84. string EffectDiscription()
  85. {
  86. return "[Main] If you have 4 or more Tamers in play, by suspending this Tamer, 1 of your Digimon with <Save> in its text gains <Security Attack +1> for the turn.";
  87. }
  88. bool CanSelectPermanentCondition(Permanent permanent)
  89. {
  90. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  91. {
  92. if (permanent.TopCard.HasSaveText)
  93. {
  94. return true;
  95. }
  96. }
  97. return false;
  98. }
  99. bool CanUseCondition(Hashtable hashtable)
  100. {
  101. if (CardEffectCommons.IsExistOnBattleArea(card))
  102. {
  103. if (CardEffectCommons.CanActivateSuspendCostEffect(card))
  104. {
  105. if (card.Owner.GetBattleAreaPermanents().Count((permanent) => permanent.IsTamer) >= 4)
  106. {
  107. return true;
  108. }
  109. }
  110. }
  111. return false;
  112. }
  113. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  114. {
  115. yield return ContinuousController.instance.StartCoroutine(new SuspendPermanentsClass(new List<Permanent>() { card.PermanentOfThisCard() }, CardEffectCommons.CardEffectHashtable(activateClass)).Tap());
  116. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  117. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  118. selectPermanentEffect.SetUp(
  119. selectPlayer: card.Owner,
  120. canTargetCondition: CanSelectPermanentCondition,
  121. canTargetCondition_ByPreSelecetedList: null,
  122. canEndSelectCondition: null,
  123. maxCount: maxCount,
  124. canNoSelect: false,
  125. canEndNotMax: false,
  126. selectPermanentCoroutine: SelectPermanentCoroutine,
  127. afterSelectPermanentCoroutine: null,
  128. mode: SelectPermanentEffect.Mode.Custom,
  129. cardEffect: activateClass);
  130. selectPermanentEffect.SetUpCustomMessage("Select 1 Digimon that will get Security Attack +1.", "The opponent is selecting 1 Digimon that will get Security Attack +1.");
  131. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  132. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  133. {
  134. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.ChangeDigimonSAttack(targetPermanent: permanent, changeValue: 1, effectDuration: EffectDuration.UntilEachTurnEnd, activateClass: activateClass));
  135. }
  136. }
  137. }
  138. if (timing == EffectTiming.SecuritySkill)
  139. {
  140. cardEffects.Add(CardEffectFactory.PlaySelfTamerSecurityEffect(card));
  141. }
  142. return cardEffects;
  143. }
  144. }
  145. }