BT9_096.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 BT9_096 : 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 4 or lower Digimon to its owner's hand. Then, if you have a Digimon with [Jellymon] in its name or with [Jellymon] in its digivolution cards, return 1 of your opponent's Tamers to its owner's hand.";
  22. }
  23. bool CanSelectPermanentCondition(Permanent permanent)
  24. {
  25. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  26. {
  27. if (permanent.TopCard.HasLevel)
  28. {
  29. if (permanent.Level <= 4)
  30. {
  31. return true;
  32. }
  33. }
  34. }
  35. return false;
  36. }
  37. bool CanSelectPermanentCondition1(Permanent permanent)
  38. {
  39. if (permanent != null)
  40. {
  41. if (permanent.TopCard != null)
  42. {
  43. if (permanent.TopCard.Owner == card.Owner.Enemy)
  44. {
  45. if (permanent.TopCard.Owner.GetBattleAreaPermanents().Contains(permanent))
  46. {
  47. if (permanent.IsTamer)
  48. {
  49. return true;
  50. }
  51. }
  52. }
  53. }
  54. }
  55. return false;
  56. }
  57. bool CanUseCondition(Hashtable hashtable)
  58. {
  59. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  60. }
  61. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  62. {
  63. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  64. {
  65. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  66. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  67. selectPermanentEffect.SetUp(
  68. selectPlayer: card.Owner,
  69. canTargetCondition: CanSelectPermanentCondition,
  70. canTargetCondition_ByPreSelecetedList: null,
  71. canEndSelectCondition: null,
  72. maxCount: maxCount,
  73. canNoSelect: false,
  74. canEndNotMax: false,
  75. selectPermanentCoroutine: null,
  76. afterSelectPermanentCoroutine: null,
  77. mode: SelectPermanentEffect.Mode.Bounce,
  78. cardEffect: activateClass);
  79. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  80. }
  81. if (CardEffectCommons.HasMatchConditionOwnersPermanent(card, (permanent) => permanent.IsDigimon && permanent.TopCard.ContainsCardName("Jellymon") || permanent.DigivolutionCards.Count((cardSource) => cardSource.CardNames.Contains("Jellymon")) >= 1))
  82. {
  83. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition1))
  84. {
  85. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition1));
  86. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  87. selectPermanentEffect.SetUp(
  88. selectPlayer: card.Owner,
  89. canTargetCondition: CanSelectPermanentCondition1,
  90. canTargetCondition_ByPreSelecetedList: null,
  91. canEndSelectCondition: null,
  92. maxCount: maxCount,
  93. canNoSelect: false,
  94. canEndNotMax: false,
  95. selectPermanentCoroutine: null,
  96. afterSelectPermanentCoroutine: null,
  97. mode: SelectPermanentEffect.Mode.Bounce,
  98. cardEffect: activateClass);
  99. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  100. }
  101. }
  102. }
  103. }
  104. if (timing == EffectTiming.SecuritySkill)
  105. {
  106. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Return 1 level 4 or lower Digimon and a Tamer to hand");
  107. }
  108. return cardEffects;
  109. }
  110. }