BT3_088.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 BT3_088 : 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.OnEnterFieldAnyone)
  14. {
  15. ActivateClass activateClass = new ActivateClass();
  16. activateClass.SetUpICardEffect("Draw 2 and trash 2 cards from hand", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, false, EffectDiscription());
  18. cardEffects.Add(activateClass);
  19. string EffectDiscription()
  20. {
  21. return "[When Digivolving] Trigger <Draw 2>. (Draw 2 cards from your deck.) Then, trash 2 cards in your hand.";
  22. }
  23. bool CanUseCondition(Hashtable hashtable)
  24. {
  25. return CardEffectCommons.CanTriggerWhenDigivolving(hashtable, card);
  26. }
  27. bool CanActivateCondition(Hashtable hashtable)
  28. {
  29. if (CardEffectCommons.IsExistOnBattleArea(card))
  30. {
  31. if (card.Owner.LibraryCards.Count >= 1)
  32. {
  33. return true;
  34. }
  35. if (card.Owner.HandCards.Count >= 1)
  36. {
  37. return true;
  38. }
  39. }
  40. return false;
  41. }
  42. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  43. {
  44. yield return ContinuousController.instance.StartCoroutine(new DrawClass(card.Owner, 2, activateClass).Draw());
  45. if (card.Owner.HandCards.Count >= 1)
  46. {
  47. int discardCount = Math.Min(2, card.Owner.HandCards.Count);
  48. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  49. selectHandEffect.SetUp(
  50. selectPlayer: card.Owner,
  51. canTargetCondition: (cardSource) => true,
  52. canTargetCondition_ByPreSelecetedList: null,
  53. canEndSelectCondition: null,
  54. maxCount: discardCount,
  55. canNoSelect: false,
  56. canEndNotMax: false,
  57. isShowOpponent: true,
  58. selectCardCoroutine: null,
  59. afterSelectCardCoroutine: null,
  60. mode: SelectHandEffect.Mode.Discard,
  61. cardEffect: activateClass);
  62. yield return StartCoroutine(selectHandEffect.Activate());
  63. }
  64. }
  65. }
  66. if (timing == EffectTiming.OnUseOption)
  67. {
  68. ActivateClass activateClass = new ActivateClass();
  69. activateClass.SetUpICardEffect("Delete 1 level 3 Digimon", CanUseCondition, card);
  70. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  71. activateClass.SetIsInheritedEffect(true);
  72. activateClass.SetHashString("Delete_BT3_088");
  73. cardEffects.Add(activateClass);
  74. string EffectDiscription()
  75. {
  76. return "[Your Turn][Once Per Turn] When you use an Option card, delete 1 of your opponent's level 3 Digimon.";
  77. }
  78. bool CanSelectPermanentCondition(Permanent permanent)
  79. {
  80. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleAreaDigimon(permanent, card))
  81. {
  82. if (permanent.Level == 3)
  83. {
  84. if (permanent.TopCard.HasLevel)
  85. {
  86. return true;
  87. }
  88. }
  89. }
  90. return false;
  91. }
  92. bool CanUseCondition(Hashtable hashtable)
  93. {
  94. if (CardEffectCommons.IsExistOnBattleArea(card))
  95. {
  96. if (CardEffectCommons.IsOwnerTurn(card))
  97. {
  98. if (CardEffectCommons.CanTriggerWhenOwnerUseOption(hashtable, null, null, card))
  99. {
  100. return true;
  101. }
  102. }
  103. }
  104. return false;
  105. }
  106. bool CanActivateCondition(Hashtable hashtable)
  107. {
  108. if (CardEffectCommons.IsExistOnBattleArea(card))
  109. {
  110. return true;
  111. }
  112. return false;
  113. }
  114. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  115. {
  116. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  117. {
  118. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  119. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  120. selectPermanentEffect.SetUp(
  121. selectPlayer: card.Owner,
  122. canTargetCondition: CanSelectPermanentCondition,
  123. canTargetCondition_ByPreSelecetedList: null,
  124. canEndSelectCondition: null,
  125. maxCount: maxCount,
  126. canNoSelect: false,
  127. canEndNotMax: false,
  128. selectPermanentCoroutine: null,
  129. afterSelectPermanentCoroutine: null,
  130. mode: SelectPermanentEffect.Mode.Destroy,
  131. cardEffect: activateClass);
  132. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  133. }
  134. }
  135. }
  136. return cardEffects;
  137. }
  138. }