BT4_114.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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_114 : 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("Unsuspend Digimon", CanUseCondition, card);
  17. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  18. activateClass.SetHashString("Unsuspend_BT4_114");
  19. cardEffects.Add(activateClass);
  20. string EffectDiscription()
  21. {
  22. return "[When Attacking][Once Per Turn] Unsuspend up to 2 of your Digimon with [Garurumon] in their names (other than [KendoGarurumon]) or [Hybrid] in their forms.";
  23. }
  24. bool CanSelectPermanentCondition(Permanent permanent)
  25. {
  26. if (CardEffectCommons.IsPermanentExistsOnOwnerBattleAreaDigimon(permanent, card))
  27. {
  28. if (permanent.TopCard.HasGarurumonName)
  29. {
  30. return true;
  31. }
  32. if (permanent.TopCard.CardTraits.Contains("Hybrid"))
  33. {
  34. return true;
  35. }
  36. }
  37. return false;
  38. }
  39. bool CanUseCondition(Hashtable hashtable)
  40. {
  41. return CardEffectCommons.CanTriggerOnAttack(hashtable, card);
  42. }
  43. bool CanActivateCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. return true;
  48. }
  49. return false;
  50. }
  51. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  52. {
  53. if (CardEffectCommons.HasMatchConditionPermanent(CanSelectPermanentCondition))
  54. {
  55. int maxCount = Math.Min(2, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  56. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  57. selectPermanentEffect.SetUp(
  58. selectPlayer: card.Owner,
  59. canTargetCondition: CanSelectPermanentCondition,
  60. canTargetCondition_ByPreSelecetedList: null,
  61. canEndSelectCondition: CanEndSelectCondition,
  62. maxCount: maxCount,
  63. canNoSelect: false,
  64. canEndNotMax: true,
  65. selectPermanentCoroutine: null,
  66. afterSelectPermanentCoroutine: null,
  67. mode: SelectPermanentEffect.Mode.UnTap,
  68. cardEffect: activateClass);
  69. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  70. bool CanEndSelectCondition(List<Permanent> permanents)
  71. {
  72. if (CardEffectCommons.HasNoElement(permanents))
  73. {
  74. return false;
  75. }
  76. return true;
  77. }
  78. }
  79. }
  80. }
  81. if (timing == EffectTiming.OnDestroyedAnyone)
  82. {
  83. ActivateClass activateClass = new ActivateClass();
  84. activateClass.SetUpICardEffect("Play 1 Digimon from hand", CanUseCondition, card);
  85. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  86. cardEffects.Add(activateClass);
  87. string EffectDiscription()
  88. {
  89. return "[On Deletion] You may play 1 blue level 4 or lower Digimon card with[Hybrid] in its form from your hand without paying its memory cost.";
  90. }
  91. bool CanSelectCardCondition(CardSource cardSource)
  92. {
  93. if (cardSource.IsDigimon)
  94. {
  95. if (cardSource.HasCardColor(CardColor.Blue))
  96. {
  97. if (cardSource.Level <= 4)
  98. {
  99. if (cardSource.CardTraits.Contains("Hybrid"))
  100. {
  101. if (CardEffectCommons.CanPlayAsNewPermanent(cardSource: cardSource, payCost: false, cardEffect: activateClass))
  102. {
  103. if (cardSource.HasLevel)
  104. {
  105. return true;
  106. }
  107. }
  108. }
  109. }
  110. }
  111. }
  112. return false;
  113. }
  114. bool CanUseCondition(Hashtable hashtable)
  115. {
  116. return CardEffectCommons.CanTriggerOnDeletion(hashtable, card, activateClass);
  117. }
  118. bool CanActivateCondition(Hashtable hashtable)
  119. {
  120. if (CardEffectCommons.IsExistOnTrash(card))
  121. {
  122. if (card.Owner.HandCards.Count >= 1)
  123. {
  124. return true;
  125. }
  126. }
  127. return false;
  128. }
  129. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  130. {
  131. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  132. {
  133. List<CardSource> selectedCards = new List<CardSource>();
  134. int maxCount = 1;
  135. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  136. selectHandEffect.SetUp(
  137. selectPlayer: card.Owner,
  138. canTargetCondition: CanSelectCardCondition,
  139. canTargetCondition_ByPreSelecetedList: null,
  140. canEndSelectCondition: null,
  141. maxCount: maxCount,
  142. canNoSelect: true,
  143. canEndNotMax: false,
  144. isShowOpponent: true,
  145. selectCardCoroutine: SelectCardCoroutine,
  146. afterSelectCardCoroutine: null,
  147. mode: SelectHandEffect.Mode.Custom,
  148. cardEffect: activateClass);
  149. selectHandEffect.SetUpCustomMessage("Select 1 card to play.", "The opponent is selecting 1 card to play.");
  150. selectHandEffect.SetUpCustomMessage_ShowCard("Played Card");
  151. yield return StartCoroutine(selectHandEffect.Activate());
  152. IEnumerator SelectCardCoroutine(CardSource cardSource)
  153. {
  154. selectedCards.Add(cardSource);
  155. yield return null;
  156. }
  157. yield return ContinuousController.instance.StartCoroutine(CardEffectCommons.PlayPermanentCards(cardSources: selectedCards, activateClass: activateClass, payCost: false, isTapped: false, root: SelectCardEffect.Root.Hand, activateETB: true));
  158. }
  159. }
  160. }
  161. return cardEffects;
  162. }
  163. }