BT6_110.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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_110 : 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] You may play 1 level 5 or lower [Eosmon] from your hand without paying its memory cost. Then, delete 1 of your opponent's Digimon with DP less than or equal to the Digimon played with this effect.";
  22. }
  23. bool CanSelectCardCondition(CardSource cardSource)
  24. {
  25. if (cardSource.CardNames.Contains("Eosmon"))
  26. {
  27. if (cardSource.Level <= 5)
  28. {
  29. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  30. {
  31. if (cardSource.HasLevel)
  32. {
  33. return true;
  34. }
  35. }
  36. }
  37. }
  38. return false;
  39. }
  40. bool CanUseCondition(Hashtable hashtable)
  41. {
  42. return CardEffectCommons.CanTriggerOptionMainEffect(hashtable, card);
  43. }
  44. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  45. {
  46. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  47. {
  48. List<CardSource> selectedCards = new List<CardSource>();
  49. int maxCount = 1;
  50. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  51. selectHandEffect.SetUp(
  52. selectPlayer: card.Owner,
  53. canTargetCondition: CanSelectCardCondition,
  54. canTargetCondition_ByPreSelecetedList: null,
  55. canEndSelectCondition: null,
  56. maxCount: maxCount,
  57. canNoSelect: true,
  58. canEndNotMax: false,
  59. isShowOpponent: true,
  60. selectCardCoroutine: SelectCardCoroutine,
  61. afterSelectCardCoroutine: null,
  62. mode: SelectHandEffect.Mode.Custom,
  63. cardEffect: activateClass);
  64. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  65. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  66. yield return StartCoroutine(selectHandEffect.Activate());
  67. IEnumerator SelectCardCoroutine(CardSource cardSource)
  68. {
  69. selectedCards.Add(cardSource);
  70. yield return null;
  71. }
  72. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(
  73. cardSources: selectedCards,
  74. activateClass: activateClass,
  75. payCost: false,
  76. isTapped: false,
  77. root: SelectCardEffect.Root.Hand,
  78. activateETB: true));
  79. foreach (CardSource selectedCard in selectedCards)
  80. {
  81. if (CardEffectCommons.IsExistOnBattleArea(selectedCard))
  82. {
  83. int maxDP = selectedCard.PermanentOfThisCard().DP;
  84. bool CanSelectPermanentCondition(Permanent permanent)
  85. {
  86. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  87. {
  88. if (permanent.DP <= maxDP)
  89. {
  90. return true;
  91. }
  92. }
  93. return false;
  94. }
  95. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  96. {
  97. maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  98. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  99. selectPermanentEffect.SetUp(
  100. selectPlayer: card.Owner,
  101. canTargetCondition: CanSelectPermanentCondition,
  102. canTargetCondition_ByPreSelecetedList: null,
  103. canEndSelectCondition: null,
  104. maxCount: maxCount,
  105. canNoSelect: false,
  106. canEndNotMax: false,
  107. selectPermanentCoroutine: null,
  108. afterSelectPermanentCoroutine: null,
  109. mode: SelectPermanentEffect.Mode.Destroy,
  110. cardEffect: activateClass);
  111. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  112. }
  113. }
  114. }
  115. }
  116. }
  117. }
  118. if (timing == EffectTiming.SecuritySkill)
  119. {
  120. CardEffectCommons.AddActivateMainOptionSecurityEffect(card: card, cardEffects: ref cardEffects, effectName: $"Play 1 Digimon with [Eosmon] in its name from hand and delete 1 Digimon");
  121. }
  122. return cardEffects;
  123. }
  124. }