BT10_105.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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_105 : 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.None)
  16. {
  17. IgnoreColorConditionClass ignoreColorConditionClass = new IgnoreColorConditionClass();
  18. ignoreColorConditionClass.SetUpICardEffect("Ignore color requirements", CanUseCondition, card);
  19. ignoreColorConditionClass.SetUpIgnoreColorConditionClass(cardCondition: CardCondition);
  20. cardEffects.Add(ignoreColorConditionClass);
  21. bool CanUseCondition(Hashtable hashtable)
  22. {
  23. return CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsTamer);
  24. }
  25. bool CardCondition(CardSource cardSource)
  26. {
  27. return cardSource == card;
  28. }
  29. }
  30. if (timing == EffectTiming.OptionSkill)
  31. {
  32. ActivateClass activateClass = new ActivateClass();
  33. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  34. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  35. cardEffects.Add(activateClass);
  36. string EffectDiscription()
  37. {
  38. return "[Main] Until the end of your opponent's turn, 1 of your Digimon gains <Blocker> (When an opponent's Digimon attacks, you may suspend this Digimon to force the opponent to attack it instead), and <Reboot> (Unsuspend this Digimon during your opponent's unsuspend phase), and can't be deleted by your opponent's effects.";
  39. }
  40. bool CanSelectPermanentCondition(Permanent permanent)
  41. {
  42. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card);
  43. }
  44. bool CanUseCondition(Hashtable hashtable)
  45. {
  46. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  47. }
  48. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  49. {
  50. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  51. {
  52. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  53. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  54. selectPermanentEffect.SetUp(
  55. selectPlayer: card.Owner,
  56. canTargetCondition: CanSelectPermanentCondition,
  57. canTargetCondition_ByPreSelecetedList: null,
  58. canEndSelectCondition: null,
  59. maxCount: maxCount,
  60. canNoSelect: false,
  61. canEndNotMax: false,
  62. selectPermanentCoroutine: SelectPermanentCoroutine,
  63. afterSelectPermanentCoroutine: null,
  64. mode: SelectPermanentEffect.Mode.Custom,
  65. cardEffect: activateClass);
  66. selectPermanentEffect.SetUpCustomMessage(
  67. "Select 1 Digimon that will get effects.",
  68. "The opponent is selecting 1 Digimon that will get effects.");
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. IEnumerator SelectPermanentCoroutine(Permanent permanent)
  71. {
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainBlocker(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  73. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainReboot(targetPermanent: permanent, effectDuration: EffectDuration.UntilOpponentTurnEnd, activateClass: activateClass));
  74. bool CardEffectCondition(ICardEffect cardEffect)
  75. {
  76. return CardEffectCommons.IsOpponentEffect(cardEffect, card);
  77. }
  78. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.GainCanNotBeDeletedByEffect(
  79. targetPermanent: permanent,
  80. cardEffectCondition: CardEffectCondition,
  81. effectDuration: EffectDuration.UntilOpponentTurnEnd,
  82. activateClass: activateClass,
  83. effectName: "Can't be deleted by opponent's effects"));
  84. }
  85. }
  86. }
  87. }
  88. if (timing == EffectTiming.SecuritySkill)
  89. {
  90. ActivateClass activateClass = new ActivateClass();
  91. activateClass.SetUpICardEffect($"Reveal the top 3 cards of deck and add this card to hand", CanUseCondition, card);
  92. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  93. activateClass.SetIsSecurityEffect(true);
  94. cardEffects.Add(activateClass);
  95. string EffectDiscription()
  96. {
  97. return "[Security] Reveal the top 3 cards of your deck. You may play 1 Digimon card with a play cost of 4 or less among them without paying its memory cost. Place the rest at the bottom of your deck in any order. Then, add this card to its owner's hand.";
  98. }
  99. bool CanSelectCardCondition(CardSource cardSource)
  100. {
  101. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  102. {
  103. if (cardSource.GetCostItself <= 4)
  104. {
  105. if (cardSource.HasPlayCost)
  106. {
  107. if (cardSource.IsDigimon)
  108. {
  109. return true;
  110. }
  111. }
  112. }
  113. }
  114. return false;
  115. }
  116. bool CanUseCondition(Hashtable hashtable)
  117. {
  118. return CardEffectCommons.CanTriggerSecurityEffect(hashtable, card);
  119. }
  120. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  121. {
  122. List<CardSource> selectedCards = new List<CardSource>();
  123. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.SimplifiedRevealDeckTopCardsAndSelect(
  124. revealCount: 3,
  125. simplifiedSelectCardConditions:
  126. new SimplifiedSelectCardConditionClass[]
  127. {
  128. new SimplifiedSelectCardConditionClass(
  129. canTargetCondition:CanSelectCardCondition,
  130. message: "Select 1 Digimon card with a play cost of 4 or less.",
  131. mode: SelectCardEffect.Mode.Custom,
  132. maxCount: 1,
  133. selectCardCoroutine: SelectCardCoroutine),
  134. },
  135. remainingCardsPlace: RemainingCardsPlace.DeckBottom,
  136. activateClass: activateClass,
  137. canNoSelect: true
  138. ));
  139. IEnumerator SelectCardCoroutine(CardSource cardSource)
  140. {
  141. selectedCards.Add(cardSource);
  142. yield return null;
  143. }
  144. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  145. cardSources: selectedCards,
  146. activateClass: activateClass,
  147. payCost: false,
  148. isTapped: false,
  149. root: SelectCardEffect.Root.Library,
  150. activateETB: true));
  151. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.AddThisCardToHand(card, activateClass));
  152. }
  153. }
  154. return cardEffects;
  155. }
  156. }
  157. }