BT4_100.cs 5.6 KB

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