BT6_098.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. public class BT6_098 : CEntity_Effect
  9. {
  10. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  11. {
  12. List<ICardEffect> cardEffects = new List<ICardEffect>();
  13. if (timing == EffectTiming.OptionSkill)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect(card.BaseENGCardNameFromEntity, CanUseCondition, card);
  17. activateClass.SetUpActivateClass(null, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[Main] Return 1 of your opponent's level 5 or lower Digimon to its owner's hand. If your opponent has 3 or more Digimon in play, return 1 of your opponent's Digimon to the bottom of its owner's deck instead. Trash all of the digivolution cards of that Digimon.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (permanent != null)
  26. {
  27. if (permanent.TopCard != null)
  28. {
  29. if (permanent.IsDigimon)
  30. {
  31. if (permanent.TopCard.Owner == card.Owner.Enemy)
  32. {
  33. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  34. {
  35. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 3)
  36. {
  37. return true;
  38. }
  39. else
  40. {
  41. if (permanent.Level <= 5)
  42. {
  43. if (permanent.TopCard.HasLevel)
  44. {
  45. return true;
  46. }
  47. }
  48. }
  49. }
  50. }
  51. }
  52. }
  53. }
  54. return false;
  55. }
  56. bool CanUseCondition(Hashtable hashtable)
  57. {
  58. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  59. }
  60. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  61. {
  62. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  63. {
  64. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  65. SelectPermanentEffect.Mode mode = SelectPermanentEffect.Mode.Bounce;
  66. if (card.Owner.Enemy.GetBattleAreaDigimons().Count >= 3)
  67. {
  68. mode = SelectPermanentEffect.Mode.PutLibraryBottom;
  69. }
  70. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  71. selectPermanentEffect.SetUp(
  72. selectPlayer: card.Owner,
  73. canTargetCondition: CanSelectPermanentCondition,
  74. canTargetCondition_ByPreSelecetedList: null,
  75. canEndSelectCondition: null,
  76. maxCount: maxCount,
  77. canNoSelect: false,
  78. canEndNotMax: false,
  79. selectPermanentCoroutine: null,
  80. afterSelectPermanentCoroutine: null,
  81. mode: mode,
  82. cardEffect: activateClass);
  83. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  84. }
  85. }
  86. }
  87. if (timing == EffectTiming.SecuritySkill)
  88. {
  89. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Return 1 level 5 or lower Digimon to hand or deck");
  90. }
  91. return cardEffects;
  92. }
  93. }