BT19_092.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. namespace DCGO.CardEffects.BT19
  4. {
  5. public class BT19_092 : CEntity_Effect
  6. {
  7. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  8. {
  9. List<ICardEffect> cardEffects = new List<ICardEffect>();
  10. #region Main Effect
  11. if (timing == EffectTiming.OptionSkill)
  12. {
  13. ActivateClass activateClass = new ActivateClass();
  14. activateClass.SetUpICardEffect("Return 1 of your opponent's Digimon to the bottom of the deck", CanUseCondition, card);
  15. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDescription());
  16. cardEffects.Add(activateClass);
  17. string EffectDescription()
  18. {
  19. return
  20. "[Main] Return 1 of your opponent's level 4 or lower Digimon to the bottom of the deck. By returning 1 of your blue Digimon to the bottom of the deck, return 1 of their level 6 or lower Digimon to the bottom of the deck instead.";
  21. }
  22. bool CanUseCondition(Hashtable hashtable)
  23. {
  24. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  25. }
  26. bool CanSelectOwnerPermanentCondition(Permanent permanent)
  27. {
  28. return CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card) &&
  29. permanent.TopCard.CardColors.Contains(CardColor.Blue);
  30. }
  31. bool CanSelectOpponentPermanentLevelCondition(Permanent permanent, int level)
  32. {
  33. return CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card) &&
  34. permanent.TopCard.HasLevel && permanent.Level <= level;
  35. }
  36. IEnumerator ActivateCoroutine(Hashtable hashtable)
  37. {
  38. bool bottomDeckOwnDigimon = false;
  39. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectOwnerPermanentCondition))
  40. {
  41. List<SelectionElement<bool>> selectionElements = new List<SelectionElement<bool>>
  42. {
  43. new(message: "Yes", value: true, spriteIndex: 0),
  44. new(message: "No", value: false, spriteIndex: 1),
  45. };
  46. string selectPlayerMessage = "Return 1 of your digimon to the bottom of the deck?";
  47. string notSelectPlayerMessage =
  48. "The opponent is choosing whether to return 1 of their digimon to the bottom of the deck";
  49. GManager.instance.userSelectionManager.SetBoolSelection(selectionElements: selectionElements,
  50. selectPlayer: card.Owner, selectPlayerMessage: selectPlayerMessage,
  51. notSelectPlayerMessage: notSelectPlayerMessage);
  52. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager
  53. .WaitForEndSelect());
  54. bottomDeckOwnDigimon = GManager.instance.userSelectionManager.SelectedBoolValue;
  55. if (bottomDeckOwnDigimon)
  56. {
  57. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  58. selectPermanentEffect.SetUp(
  59. selectPlayer: card.Owner,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canTargetCondition: CanSelectOwnerPermanentCondition,
  62. canEndSelectCondition: null,
  63. maxCount: 1,
  64. canNoSelect: false,
  65. canEndNotMax: false,
  66. selectPermanentCoroutine: null,
  67. afterSelectPermanentCoroutine: null,
  68. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  69. cardEffect: activateClass);
  70. selectPermanentEffect.SetUpCustomMessage("Select 1 of your Digimon to bottom deck.",
  71. "The opponent is selecting 1 of your Digimon to bottom deck.");
  72. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  73. }
  74. }
  75. int targetLevel = bottomDeckOwnDigimon ? 6 : 4;
  76. if (CardEffectCommons.HasMatchConditionPermanent(permanent =>
  77. CanSelectOpponentPermanentLevelCondition(permanent, targetLevel)))
  78. {
  79. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  80. selectPermanentEffect.SetUp(
  81. selectPlayer: card.Owner,
  82. canTargetCondition_ByPreSelecetedList: null,
  83. canTargetCondition: permanent => CanSelectOpponentPermanentLevelCondition(permanent, targetLevel),
  84. canEndSelectCondition: null,
  85. maxCount: 1,
  86. canNoSelect: false,
  87. canEndNotMax: false,
  88. selectPermanentCoroutine: null,
  89. afterSelectPermanentCoroutine: null,
  90. mode: SelectPermanentEffect.Mode.PutLibraryBottom,
  91. cardEffect: activateClass);
  92. selectPermanentEffect.SetUpCustomMessage("Select 1 opponent's Digimon to bottom deck.",
  93. "The opponent is selecting 1 opponent's Digimon to bottom deck.");
  94. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  95. }
  96. }
  97. }
  98. #endregion
  99. #region Security Effect
  100. if (timing == EffectTiming.SecuritySkill)
  101. {
  102. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects,
  103. effectName: "Return 1 of your opponent's Digimon to the bottom of the deck");
  104. }
  105. #endregion
  106. return cardEffects;
  107. }
  108. }
  109. }