BT6_071.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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_071 : 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.OnAllyAttack)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Trash 1 card from hand to delete 1 level 3 Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  18. activateClass.SetIsInheritedEffect(true);
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[When Attacking] You may trash 1 card in your hand to delete 1 of your opponent's level 3 Digimon.";
  23. }
  24. bool CanSelectPermanentCondition(Permanent permanent)
  25. {
  26. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  27. {
  28. if (permanent.Level == 3)
  29. {
  30. if (permanent.TopCard.HasLevel)
  31. {
  32. return true;
  33. }
  34. }
  35. }
  36. return false;
  37. }
  38. bool CanUseCondition(Hashtable hashtable)
  39. {
  40. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  41. }
  42. bool CanActivateCondition(Hashtable hashtable)
  43. {
  44. if (CardEffectCommons.IsExistOnBattleArea(card))
  45. {
  46. if (card.Owner.HandCards.Count >= 1)
  47. {
  48. return true;
  49. }
  50. }
  51. return false;
  52. }
  53. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  54. {
  55. if (card.Owner.HandCards.Count >= 1)
  56. {
  57. bool discarded = false;
  58. int discardCount = 1;
  59. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  60. selectHandEffect.SetUp(
  61. selectPlayer: card.Owner,
  62. canTargetCondition: (cardSource) => true,
  63. canTargetCondition_ByPreSelecetedList: null,
  64. canEndSelectCondition: null,
  65. maxCount: discardCount,
  66. canNoSelect: true,
  67. canEndNotMax: false,
  68. isShowOpponent: true,
  69. selectCardCoroutine: null,
  70. afterSelectCardCoroutine: AfterSelectCardCoroutine,
  71. mode: SelectHandEffect.Mode.Discard,
  72. cardEffect: activateClass);
  73. yield return StartCoroutine(selectHandEffect.Activate());
  74. IEnumerator AfterSelectCardCoroutine(List<CardSource> cardSources)
  75. {
  76. if (cardSources.Count >= 1)
  77. {
  78. discarded = true;
  79. yield return null;
  80. }
  81. }
  82. if (discarded)
  83. {
  84. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  85. {
  86. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  87. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  88. selectPermanentEffect.SetUp(
  89. selectPlayer: card.Owner,
  90. canTargetCondition: CanSelectPermanentCondition,
  91. canTargetCondition_ByPreSelecetedList: null,
  92. canEndSelectCondition: null,
  93. maxCount: maxCount,
  94. canNoSelect: false,
  95. canEndNotMax: false,
  96. selectPermanentCoroutine: null,
  97. afterSelectPermanentCoroutine: null,
  98. mode: SelectPermanentEffect.Mode.Destroy,
  99. cardEffect: activateClass);
  100. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  101. }
  102. }
  103. }
  104. }
  105. }
  106. return cardEffects;
  107. }
  108. }