BT15_056.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. namespace DCGO.CardEffects.BT15
  6. {
  7. public class BT15_056 : CEntity_Effect
  8. {
  9. public override List<ICardEffect> CardEffects(EffectTiming timing, CardSource card)
  10. {
  11. List<ICardEffect> cardEffects = new List<ICardEffect>();
  12. //Black box Digivolution requirement
  13. if (timing == EffectTiming.None)
  14. {
  15. static bool PermanentCondition(Permanent targetPermanent)
  16. {
  17. return targetPermanent.TopCard.CardNames.Contains("Kyokyomon");
  18. }
  19. cardEffects.Add(CardEffectFactory.AddSelfDigivolutionRequirementStaticEffect(permanentCondition: PermanentCondition, digivolutionCost: 0, ignoreDigivolutionRequirement: false, card: card, condition: null));
  20. }
  21. if (timing == EffectTiming.OnStartMainPhase)
  22. {
  23. ActivateClass activateClass = new ActivateClass();
  24. activateClass.SetUpICardEffect("Place cards under this Digimon's digivolution cards to make this Digimon unaffected by your opponent's effects until the end of your opponent's turn.", CanUseCondition, card);
  25. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, -1, true, EffectDiscription());
  26. cardEffects.Add(activateClass);
  27. string EffectDiscription()
  28. {
  29. return "[Start of Your Main Phase] By placing 1 [Shuu Yulin] from your hand or trash as this Digimon's bottom digivolution card, this Digimon isn't affected by the effects of your opponent's Digimon until the end of your opponent's turn.";
  30. }
  31. bool CanSelectCardCondition(CardSource cardSource)
  32. {
  33. if (cardSource.CardNames.Contains("Shuu Yulin"))
  34. {
  35. return true;
  36. }
  37. if (cardSource.CardNames.Contains("ShuuYulin"))
  38. {
  39. return true;
  40. }
  41. return false;
  42. }
  43. bool CanUseCondition(Hashtable hashtable)
  44. {
  45. if (CardEffectCommons.IsExistOnBattleArea(card))
  46. {
  47. if (CardEffectCommons.IsOwnerTurn(card))
  48. {
  49. return true;
  50. }
  51. }
  52. return false;
  53. }
  54. //Check if Xu is in hand
  55. bool CanActivateCondition(Hashtable hashtable)
  56. {
  57. if (CardEffectCommons.IsExistOnBattleArea(card))
  58. {
  59. if (card.Owner.HandCards.Count(CanSelectCardCondition) >= 1)
  60. {
  61. return true;
  62. }
  63. }
  64. return false;
  65. }
  66. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  67. {
  68. bool canSelectHand = card.Owner.HandCards.Count(CanSelectCardCondition) >= 1;
  69. if (canSelectHand)
  70. {
  71. GManager.instance.userSelectionManager.SetBool(canSelectHand);
  72. }
  73. yield return ContinuousController.instance.StartCoroutine(GManager.instance.userSelectionManager.WaitForEndSelect());
  74. bool fromHand = GManager.instance.userSelectionManager.SelectedBoolValue;
  75. List<CardSource> selectedCards = new List<CardSource>();
  76. IEnumerator SelectCardCoroutine(CardSource cardSource)
  77. {
  78. selectedCards.Add(cardSource);
  79. yield return null;
  80. }
  81. if (fromHand)
  82. {
  83. int maxCount = 1;
  84. SelectHandEffect selectHandEffect = GManager.instance.GetComponent<SelectHandEffect>();
  85. selectHandEffect.SetUp(
  86. selectPlayer: card.Owner,
  87. canTargetCondition: CanSelectCardCondition,
  88. canTargetCondition_ByPreSelecetedList: null,
  89. canEndSelectCondition: null,
  90. maxCount: maxCount,
  91. canNoSelect: true,
  92. canEndNotMax: false,
  93. isShowOpponent: true,
  94. selectCardCoroutine: SelectCardCoroutine,
  95. afterSelectCardCoroutine: null,
  96. mode: SelectHandEffect.Mode.Custom,
  97. cardEffect: activateClass);
  98. selectHandEffect.SetUpCustomMessage("Select 1 card to place on bottom of digivolution cards.", "The opponent is selecting 1 card to place on bottom of digivolution cards.");
  99. selectHandEffect.SetUpCustomMessage_ShowCard("Digivolution Card");
  100. yield return StartCoroutine(selectHandEffect.Activate());
  101. }
  102. if (selectedCards.Count >= 1)
  103. {
  104. Permanent selectedPermanent = card.PermanentOfThisCard();
  105. if (selectedPermanent != null)
  106. {
  107. CanNotAffectedClass canNotAffectedClass = new CanNotAffectedClass();
  108. canNotAffectedClass.SetUpICardEffect("Isn't affected by opponent's Digimon's effect", CanUseCondition1, card);
  109. canNotAffectedClass.SetUpCanNotAffectedClass(CardCondition: CardCondition, SkillCondition: SkillCondition);
  110. selectedPermanent.UntilOpponentTurnEndEffects.Add((_timing) => canNotAffectedClass);
  111. yield return ContinuousController.instance.StartCoroutine(GManager.instance.GetComponent<Effects>().CreateBuffEffect(selectedPermanent));
  112. bool CanUseCondition1(Hashtable hashtable)
  113. {
  114. return CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent);
  115. }
  116. bool CardCondition(CardSource cardSource)
  117. {
  118. if (CardEffectCommons.IsPermanentExistsOnBattleArea(selectedPermanent))
  119. {
  120. if (cardSource == selectedPermanent.TopCard)
  121. {
  122. return true;
  123. }
  124. }
  125. return false;
  126. }
  127. bool SkillCondition(ICardEffect cardEffect)
  128. {
  129. if (cardEffect != null)
  130. {
  131. if (cardEffect.EffectSourceCard != null)
  132. {
  133. if (cardEffect.EffectSourceCard.Owner == card.Owner.Enemy)
  134. {
  135. if (cardEffect.IsDigimonEffect)
  136. {
  137. return true;
  138. }
  139. }
  140. }
  141. }
  142. return false;
  143. }
  144. }
  145. yield return ContinuousController.instance.StartCoroutine(card.PermanentOfThisCard().AddDigivolutionCardsBottom(selectedCards, activateClass));
  146. }
  147. }
  148. }
  149. //Inherited effect
  150. if (timing == EffectTiming.OnTappedAnyone)
  151. {
  152. ActivateClass activateClass = new ActivateClass();
  153. activateClass.SetUpICardEffect("Suspend opponent's Digimon or Tamers with play cost less than this Digimon.", CanUseCondition, card);
  154. activateClass.SetUpActivateClass(CanActivateCondition, ActivateCoroutine, 1, false, EffectDiscription());
  155. activateClass.SetIsInheritedEffect(true);
  156. activateClass.SetHashString("suspend_BT15_056_inherited");
  157. cardEffects.Add(activateClass);
  158. string EffectDiscription()
  159. {
  160. return "[All Turns] [Once Per Turn] When this Digimon becomes suspended, suspend 1 of your opponent's Digimon or Tamers with a play cost less than or equal to this Digimon's play cost.";
  161. }
  162. bool CanSelectPermanentCondition(Permanent permanent)
  163. {
  164. if (CardEffectCommons.IsPermanentExistsOnOpponentBattleArea(permanent, card))
  165. {
  166. if (permanent.TopCard.GetCostItself <= card.PermanentOfThisCard().TopCard.GetCostItself)
  167. {
  168. if (permanent.TopCard.IsDigimon || permanent.TopCard.IsTamer)
  169. {
  170. return true;
  171. }
  172. }
  173. }
  174. return false;
  175. }
  176. bool CanUseCondition(Hashtable hashtable)
  177. {
  178. if (CardEffectCommons.IsExistOnBattleArea(card))
  179. {
  180. if (CardEffectCommons.CanTriggerWhenSelfPermanentSuspends(hashtable, card))
  181. {
  182. return true;
  183. }
  184. }
  185. return false;
  186. }
  187. bool CanActivateCondition(Hashtable hashtable)
  188. {
  189. if (CardEffectCommons.IsExistOnBattleArea(card))
  190. {
  191. return true;
  192. }
  193. return false;
  194. }
  195. IEnumerator ActivateCoroutine(Hashtable _hashtable)
  196. {
  197. int maxCount = Math.Min(1, CardEffectCommons.MatchConditionPermanentCount(CanSelectPermanentCondition));
  198. SelectPermanentEffect selectPermanentEffect = GManager.instance.GetComponent<SelectPermanentEffect>();
  199. selectPermanentEffect.SetUp(
  200. selectPlayer: card.Owner,
  201. canTargetCondition: CanSelectPermanentCondition,
  202. canTargetCondition_ByPreSelecetedList: null,
  203. canEndSelectCondition: null,
  204. maxCount: maxCount,
  205. canNoSelect: false,
  206. canEndNotMax: false,
  207. selectPermanentCoroutine: null,
  208. afterSelectPermanentCoroutine: null,
  209. mode: SelectPermanentEffect.Mode.Tap,
  210. cardEffect: activateClass);
  211. yield return ContinuousController.instance.StartCoroutine(selectPermanentEffect.Activate());
  212. }
  213. }
  214. return cardEffects;
  215. }
  216. }
  217. }